简体   繁体   English

当我学习pwn时,使用gdb调试,但汇编返回失败

[英]when I learn pwn, use gdb debug, but assembly return failed

I'm learning pwn about stack overflow.我正在学习关于堆栈溢出的 pwn。 I use gdb to debug a linux elf file.我使用 gdb 来调试一个 linux elf 文件。

Elf binary only turns on NX. Elf 二进制文件只打开 NX。

在此处输入图片说明

I execute stack overflow successfully.我成功执行堆栈溢出。

But when execute但是当执行

leave  
ret

I meet a error.我遇到一个错误。

First arrived leave初到leave

在此处输入图片说明

you can see你可以看到

在此处输入图片说明

step

在此处输入图片说明

error shows错误显示

Cannot access memory at address 0x8

I do not access memory at 0x8 .我不在0x8访问内存。 Now $rbp is 0x0 , ubuntu check $rbp+0x8 when ret execute?现在 $rbp 是0x0 ,ubuntu 在ret执行时检查$rbp+0x8吗? why this happend?为什么会这样?

My Environment我的环境

uname -a
Linux ubuntu 4.4.0-142-generic #168~14.04.1-Ubuntu SMP Sat Jan 19 11:26:28 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

This can be because the instruction pointer points to 0x8 when you are overflowing the buffer.这可能是因为当您溢出缓冲区时,指令指针指向0x8 So the program tries to get to that location but there is no such location in the memory allocated for the binary.所以程序试图到达那个位置,但在为二进制分配的内存中没有这样的位置。 It would be better if you tell what the buffer size was and what was the amount of junk that you gave.如果您告诉缓冲区大小是多少以及您提供的垃圾量是多少,那会更好。

Thank You谢谢你

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM