"利用汇编中的系统调用"

2024-09-27 07:33:06 发布

您现在位置:Python中文网/ 问答频道 /正文

我正试图解决pwnable.tw's start challenge以了解更多有关漏洞利用的信息。提供的解汇编二进制文件如下所示:

start:     file format elf32-i386


Disassembly of section .text:

08048060 <_start>:
 8048060:   54                      push   esp
 8048061:   68 9d 80 04 08          push   0x804809d
 8048066:   31 c0                   xor    eax,eax
 8048068:   31 db                   xor    ebx,ebx
 804806a:   31 c9                   xor    ecx,ecx
 804806c:   31 d2                   xor    edx,edx
 804806e:   68 43 54 46 3a          push   0x3a465443
 8048073:   68 74 68 65 20          push   0x20656874
 8048078:   68 61 72 74 20          push   0x20747261
 804807d:   68 73 20 73 74          push   0x74732073
 8048082:   68 4c 65 74 27          push   0x2774654c
 8048087:   89 e1                   mov    ecx,esp ; buffer = $esp
 8048089:   b2 14                   mov    dl,0x14 ; count = 0x14 (20)
 804808b:   b3 01                   mov    bl,0x1  ; fd = 1 (stdout)
 804808d:   b0 04                   mov    al,0x4  ; system call = 4 (sys_write)
 804808f:   cd 80                   int    0x80    ; call sys_write(1, $esp, 20)
 8048091:   31 db                   xor    ebx,ebx ; fd = 0 (stdin)
 8048093:   b2 3c                   mov    dl,0x3c ; count = 0x36 (60)
 8048095:   b0 03                   mov    al,0x3  ; system call = 3 (sys_read)
 8048097:   cd 80                   int    0x80    ; sys_read(0, ecx/$esp, 60)
 8048099:   83 c4 14                add    esp,0x14
 804809c:   c3                      ret    

0804809d <_exit>:
 804809d:   5c                      pop    esp
 804809e:   31 c0                   xor    eax,eax
 80480a0:   40                      inc    eax

一些writeup(12,和3)指出,解决方案在于泄漏通过利用sys_write和{}上的计数值而移动到ecx的{}地址。这样,我们可以强制将返回地址改为0x8048087,这样程序将循环并打印esp的内容。在

然而,我不明白这到底是怎么回事。系统调用到底对寄存器做了什么,以及如何更改返回地址?为什么下面的漏洞会起作用?在

^{pr2}$

我相信,一步一步地显示寄存器值的演练可以真正帮助澄清问题。在


Tags: 利用地址syscallstartpushwritemov

热门问题