你使用的shellcode是这个
0: 6a 01 push 0x1
2: 5f pop edi
3: 68 01 01 01 01 push 0x1010101
8: 81 34 24 75 79 75 01 xor DWORD PTR [esp], 0x1757975
f: 68 6f 61 64 2e push 0x2e64616f
14: 68 70 61 79 6c push 0x6c796170
19: 6a 05 push 0x5
1b: 58 pop eax
1c: 89 e3 mov ebx, esp
1e: 31 c9 xor ecx, ecx
20: cd 80 int 0x80
22: 89 c5 mov ebp, eax
24: 89 c3 mov ebx, eax
26: 6a 6c push 0x6c
28: 58 pop eax
29: 89 e1 mov ecx, esp
2b: cd 80 int 0x80
2d: 83 c4 14 add esp, 0x14
30: 8b 34 24 mov esi, DWORD PTR [esp]
33: 31 c0 xor eax, eax
35: b0 bb mov al, 0xbb
37: 89 fb mov ebx, edi
39: 89 e9 mov ecx, ebp
3b: 99 cdq
3c: cd 80 int 0x80
这是来自pwntools 的这里。
第一个系统调用是i386.syscall('SYS_open', 'esp', 'O_RDONLY')
针对 payload.txt,如果 cwd 拥有该文件,它将成功。下一个是${i386.syscall('SYS_fstat', 'eax', 'esp')}
具有像这样的签名
int fstat(int fd, struct stat *statbuf);
根据手册页
这些函数在 statbuf 指向的缓冲区中返回有关文件的信息。
在您的情况下statbuf
是 esp,因此堆栈被覆盖。总是调试和阅读你正在使用的 shellcode。