【问题标题】:gdb commands on bin file does not work for my binary filebin 文件上的 gdb 命令不适用于我的二进制文件
【发布时间】:2021-07-31 03:37:41
【问题描述】:

我正在尝试使用 gdb 来修改 .bin 文件。我尝试了一堆指南,但我所做的每一件事似乎都失败了。

首先我只是用 gdb 打开文件:

$ gdb impossible_password.bin 
GNU gdb (Ubuntu 9.2-0ubuntu1~20.04) 9.2
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from impossible_password.bin...
(No debugging symbols found in impossible_password.bin)

我尝试反汇编 main:

(gdb) disassemble main
No symbol table is loaded.  Use the "file" command.

好的,奇怪,这在我看到的视频中有效。我在这里做错了什么?

另外,我看到了另一个视频,其中一个人启动了文件,并且可以使用 ghidra 的位置 ID 设置断点。我也想试试这个:

$ gdb impossible_password.bin 
GNU gdb (Ubuntu 9.2-0ubuntu1~20.04) 9.2
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from impossible_password.bin...
(No debugging symbols found in impossible_password.bin)
(gdb) start
Function "main" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y
Temporary breakpoint 1 (-qualified main) pending.
Starting program: /home/ask/Notes/ethHack/wetransfer-85179d/Export/impossible_password.bin 
* b *00400961
[b]
[Inferior 1 (process 29475) exited with code 01]
(gdb) 

设置断点失败的地方。而且我在文件中绝对看不到任何值。

我做错了什么?我真的只想开始看看这个文件中的一些值 编辑:

以下是有关文件的信息:

$ file impossible_password.bin
impossible_password.bin: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=ba116ba1912a8c3779ddeb579404e2fdf34b1568, stripped

【问题讨论】:

标签: gdb reverse-engineering


【解决方案1】:

您的 .bin 文件已完全删除。这意味着其中没有符号,并且每个需要符号的命令(例如break mainstart)都会失败。

您只能在地址上设置断点。

假设0x0400961 确实是main 的地址,这应该可以:

(gdb) break *0x0400961
(gdb) run

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-02-20
    • 1970-01-01
    • 2013-05-09
    相关资源
    最近更新 更多