[overthewire] Leviathan level5

mj·2023년 1월 16일
0
post-thumbnail

접속

ssh -p 2223 leviathan5@leviathan.labs.overthewire.org
pw: Tith4cokei

주어진 정보 확인

현재 디렉터리에서 정보를 확인한다.

leviathan5@leviathan:~$ ls -al
total 28
drwxr-xr-x  2 root       root       4096 Aug 26  2019 .
drwxr-xr-x 10 root       root       4096 Aug 26  2019 ..
-rw-r--r--  1 root       root        220 May 15  2017 .bash_logout
-rw-r--r--  1 root       root       3526 May 15  2017 .bashrc
-r-sr-x---  1 leviathan6 leviathan5 7560 Aug 26  2019 leviathan5
-rw-r--r--  1 root       root        675 May 15  2017 .profile
leviathan5@leviathan:~$ file leviathan5 
leviathan5: setuid ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=414fe0634bbd08f446816d4da55ea9a43484fc35, not stripped
leviathan5@leviathan:~$ 

현재 디렉터리를 확인해보니 leviathan5 바이너리 파일이 있다.

해당 바이너리 파일을 실행시켜보자

leviathan5@leviathan:~$ ./leviathan5 
Cannot find /tmp/file.log
leviathan5@leviathan:~$ 

해당 바이너리 파일을 실행시키니까 Cannot find /tmp/file.log 라는 문구가 떴다. /tmp 디렉터리에 file.log파일을 생성한 후에 다시 바이너리를 실행해보자

leviathan5@leviathan:~$ echo "hello" > /tmp/file.log
leviathan5@leviathan:~$ ./leviathan5 
hello
leviathan5@leviathan:~$ cat /tmp/file.log
cat: /tmp/file.log: No such file or directory
leviathan5@leviathan:~$ ./leviathan5 
Cannot find /tmp/file.log

/tmp/file.log 파일을 생성한 후에 바이너리를 실행시켰을 때 파일의 내용을 출력하고 해당 파일을 삭제해버린다.

/etc/leviathan_pass/leviathan5파일의 심볼릭 링크 파일로 /tmp/file.log파일을 만들어보자

leviathan5@leviathan:~$ ln -s /etc/leviathan_pass/leviathan6 /tmp/file.log
leviathan5@leviathan:~$ ./leviathan5 
UgaoFee4li
leviathan5@leviathan:~$ 

password를 획득했다.

id: leviathan6
pw: UgaoFee4li

profile
사는게 쉽지가 않네요

0개의 댓글