使用 GDB 调试 Linux 上的根应用程序
我正在学习一本叫做“黑客的艺术”的书,在理论之后,我试图对真正的旧漏洞做一些练习,只是为了做一些练习。
因此,我“配置”、“制作”和“制作安装”一个 ftp 易受攻击的服务,然后以 root 身份启动它。
此时,我需要在 ftp 服务以 root 身份运行时对其进行调试。 我从书中了解到的是,要为类似的情况创建一个有效的漏洞利用程序,我需要在服务以 root 身份运行时研究堆栈,以便获得我所使用的程序的真实“堆栈情况”。想要工作...并且要做到这一点,我需要将我的 gdb 附加到正在运行的进程!
我的问题是,当我启动命令
gdb
时,我的 gdb 正在附加到进程,但当然我加载了任何符号,并且有可能研究程序的堆栈。
由于我拥有应用程序的所有源代码,如何编译它们以创建调试正在运行的进程所需的符号?
I'm studying on a book called "the art of hacking" and after the theory, I'm trying to do some exercises on real old vulnerabilities just to do some exercises.
So, I "configure", "make" and "make install" an ftp vulnerable service and then I launch it as root.
At this point, I need to debug the ftp service while it is running as root.
What I have understood from the book is that, to create a working exploit for a case like that, I need to study the stack while the service is running as root in order to have a real "stack situation" of the program on which I want to work... and to do it I need to attach my gdb to the running process!
My problem is that when I launch the command
gdb
my gdb is attaching to the process, BUT of course I have any symbol loaded and any possibility to study the stack of the program.
Since I have all the sources of the application, how can I compile them in order to create the symbols needed to debug the running process?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要将
-g
添加到编译标志中。大多数软件包都会使用configure --enable-debug
来执行此操作,但您可能需要执行一些操作,例如使用export CFLAGS=-g< 设置
CFLAGS
环境变量/code> 在运行配置之前如果这不起作用。You need to add a
-g
to the compile flags. Most packages will do this withconfigure --enable-debug
, but you may need to do something like set theCFLAGS
environment variable usingexport CFLAGS=-g
before running configure if that doesn't work.