【问题标题】:How to find format of sscanf input assembly如何查找 sscanf 输入程序集的格式
【发布时间】:2017-03-04 22:57:11
【问题描述】:

我试图弄清楚 sscanf 函数在汇编中要求什么格式。我认为它需要两个输入,但我不确定它们应该是十进制还是字符串等。

我试过 x/s 和 x/d 0x400c30 但我得到了 \377%z4。我在哪里可以看到它显示 %d 或 %s 等?提前致谢!

Dump of assembler code for function phase_4:
   0x000000000040101e <+0>: sub    $0x18,%rsp
   0x0000000000401022 <+4>: lea    0xc(%rsp),%rcx
   0x0000000000401027 <+9>: lea    0x8(%rsp),%rdx
   0x000000000040102c <+14>:    mov    $0x4027cd,%esi
   0x0000000000401031 <+19>:    mov    $0x0,%eax
   0x0000000000401036 <+24>:    callq  0x400c30 <__isoc99_sscanf@plt> //???
   0x000000000040103b <+29>:    cmp    $0x2,%eax
   0x000000000040103e <+32>:    jne    0x40104c <phase_4+46>
   0x0000000000401040 <+34>:    mov    0xc(%rsp),%eax
   0x0000000000401044 <+38>:    sub    $0x2,%eax
   0x0000000000401047 <+41>:    cmp    $0x2,%eax
   0x000000000040104a <+44>:    jbe    0x401051 <phase_4+51>
   0x000000000040104c <+46>:    callq  0x401554 <explode_bomb>
   0x0000000000401051 <+51>:    mov    0xc(%rsp),%esi
   0x0000000000401055 <+55>:    mov    $0x7,%edi
   0x000000000040105a <+60>:    callq  0x400fe6 <func4>
   0x000000000040105f <+65>:    cmp    0x8(%rsp),%eax
   0x0000000000401063 <+69>:    je     0x40106a <phase_4+76>
   0x0000000000401065 <+71>:    callq  0x401554 <explode_bomb>
   0x000000000040106a <+76>:    add    $0x18,%rsp
   0x000000000040106e <+80>:    retq  

【问题讨论】:

    标签: c assembly reverse-engineering


    【解决方案1】:

    我在这里假设 x86。 AT&T 语法对我来说并不熟悉,但是 sscanf 的第二个参数,格式字符串,在 rsi 寄存器中。您要查找的字符串似乎位于地址 4027cd。

    0x000000000040102c <+14>:    mov    $0x4027cd,%esi
    0x0000000000401031 <+19>:    mov    $0x0,%eax
    0x0000000000401036 <+24>:    callq  0x400c30 <__isoc99_sscanf@plt> //???
    

    尝试检查该地址

    【讨论】:

    • 我就是这么想的,你说得对!试了一下,得到了 %d %d。谢谢!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-10-07
    • 1970-01-01
    • 2013-09-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-06-30
    相关资源
    最近更新 更多