Pwnable.kr
Pwnable.kr Notes
flag
运行程序得到如下输出:
I will malloc() and strcpy the flag there. take it.
根据提示信息,flag会被存放载程序中并且通过strcpy进行处理,按理说应该刻意直接通过strings获取flag,而直接通过strings来识别程序中的字符串无法获得这段输出,且利用radare2尝试分析,没有办法找到main函数。由此部分推论程序被做过手脚。
利用grep对strings的输出进行分析
stings ./flag|wc -l
给出strings的行数
strings ./flag | grep '[^ ]\{10\}' | wc -l
给出strings输出中长度大于10的字符串的行数,数量不多可直接略读
strings ./flag | grep '[^ ]\{10\}
的输出,找到关键信息:$Info: This file is packed with the UPX executable packer http://upx.sf.net $
查找upx的wiki得知upx(the ultimate packer for executables)是一个开源的可执行文件加壳器,下载upx对文件进行解压缩
upx -d ./flag
解压缩后再次查看flag的string,利用命令
strings ./flag | grep -C 5 'I will'
查看可执行文件运行给出的输出前后5行的内容,找到flag
进一步学习知道这就是所谓的压缩壳,UPX是经典的给程序加壳的一种方式,除了此题的用法还有更为复杂的应用
Comment is disabled to avoid unwanted discussions from 'localhost:1313' on your Disqus account...