【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

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值