在审计sebug.net代码时,发现的一处问题,以前好像没怎么注意,这里记录下
- $query = $db->query("select * from DB where id IN (".$id.")");
- $query = $db->query("select * from DB where id IN ('".$id."')");
这两个最大的不同就是多了个''引用。
如果我们提交php?id=1 and 1=2,最后变成:
- select * from DB where id=1 and 1=2 //and 1=2 变成表达式了
- select * from DB where id='1 and 1=2' //and 1=2 还是字符串
记录下。但这绝不仅仅是sql注入!


2009-01-14, 15:01:06