【pwnable.kr】Toddler‘s Bottle-[flag]


下载题目文件


image-20211120112822068

Papa brought me a packed present! let's open it.

Download : http://pwnable.kr/bin/flag

This is reversing task. all you need is binary

这是逆向任务。你所需要的只是二进制。

下载文件

>wegt http://pwnable.kr/bin/flag


二进制分析


  • 查看文件类型
>file flag
flag: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), statically linked, stripped
  • 使用ida64进行分析

image-20211120113820565

发现并没有显示有效函数结构。看到二进制中有px 。

当我们拿到一个pwn文件时,首先应当查壳。在ctf比赛中的pwn大多在Linux下,Linux下没有很强力的壳,一般都是upx格式的壳,所以可以在命令行中用upx -d file来进行脱壳操作。安装方式不同,我这里的命令是./upx.out -d flag

可以用 PEID查壳工具检查,另外可用checksec 查看保护机制。

hispark@ubuntu:~/桌面$ ./upx.out -d flag 
                       Ultimate Packer for eXecutables
                          Copyright (C) 1996 - 2020
UPX 3.96        Markus Oberhumer, Laszlo Molnar & John Reiser   Jan 23rd 2020

        File size         Ratio      Format      Name
   --------------------   ------   -----------   -----------
    883745 <-    335288   37.94%   linux/amd64   flag

Unpacked 1 file.

unpack 之后 ida64 分析

int __cdecl main(int argc, const char **argv, const char **envp)
{
  char *dest; // ST08_8

  puts("I will malloc() and strcpy the flag there. take it.", argv, envp);
  dest = (char *)malloc(100LL);
  strcpy(dest, flag); 
  return 0;
}

果然正如题目所说,flag 只是二进制罢了,在源程序中就有了。


获取flag


flag

 aUpxSoundsLikeA db 'UPX...? sounds like a delivery service :)',0
UPX...? sounds like a delivery service :)

此外,还可使用gdb调试的方式。


gdb调试


【下次更新】


参考:

https://www.jianshu.com/p/755e52d48a77

https://blog.csdn.net/okawari_richi/article/details/57411796

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
THE END
分享
二维码
< <上一篇
下一篇>>