Hacking/Pwn.
심볼 없을 때 gdb 디버깅
ch4n3
2017. 12. 14. 13:48
가끔씩 포너블 문제를 풀다보면 이상하게 Break Point가 걸리지 않는 경우가 있다. 대표적으로 'ropasaurusrex' 문제가 있다. 이런 문제를 디버깅하려고 할 때는 다음과 같은 화면이 뜬다.
ch4n3@ip-172-31-0-14 ~/ctf/plaid_ctf_2013 $ gdb -q ./ropasaurusrex
Reading symbols from ./ropasaurusrex...(no debugging symbols found)...done.
gdb-peda$ b * main
No symbol table is loaded. Use the "file" command.
gdb-peda$ disas main
No symbol table is loaded. Use the "file" command.
gdb-peda$
이럴 때는 생각보다 간단하게 해결할 수 있다.
`info file` 명령어를 치면 된다.
info file 명령을 사용하면 다음과 같이 각 Segment 들의 주소 범위가 뜬다. 우리가 디버깅할 main 함수는 .text 영역에 있기 때문에 .text 의 시작시점에 break point를 걸면 된다.
이렇게 Break Point가 잘 잡힌채 실행된다.