Tech/heap
stdout을 이용한 leak
hackctf childheap 문제로 처음 접한 기법이다. 최근 heap문제에서 자주 사용되기도 하고 한번 정리해두고 싶어 글을 쓰게 되었다. (모자란 부분은 조금씩 채워 나갈 예정) Source Code source code는 puts의 code를 간단하게 분석하면서 최종적으로 _IO_SYSWRITE가 어떻게 호출이 되는지 알아보자. 먼저 호출되는 puts함수부터 살펴보면 다음과 같다. _IO_puts #include "libioP.h" #include #include int _IO_puts (const char *str) { int result = EOF; size_t len = strlen (str); _IO_acquire_lock (_IO_stdout); if ((_IO_vtable_of..