Computer Security

#5 Wargame leviathan5 (Level6 ~ Level7(End)) 본문

Wargame:leviathan

#5 Wargame leviathan5 (Level6 ~ Level7(End))

쿠리 Kuri 2022. 7. 30. 18:30

Level6 -> Level7

1. ls -al 을 확인해보니, leviathan6 라는 파일이 있고, 얘도 역시 setuid 이다.

leviathan6@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 leviathan7 leviathan6 7452 Aug 26  2019 leviathan6
-rw-r--r--  1 root       root        675 May 15  2017 .profile

 

 

 

2. ./leviathan6 를 해보니, 4자리 비밀번호를 입력해야 하는 것 같다. bruite force 공격이 떠오른다.

leviathan6@leviathan:~$ ./leviathan6
usage: ./leviathan6 <4 digit code>
leviathan6@leviathan:~$ ./leviathan6 1111
Wrong

 

 

 

3. r2 leviathan6 -d 로 분석을 해보자.

pdf @main

위를 살펴보면, mov dword  0x1bd3 인데, 16진수를 10진수로 바꾸면 7123이 나온다. 얘를 넣고 cmp 를 하는거 보니, 얘가 비밀번호인것 같다.

 

 

 

4. ./leviathan6 7123 을 쳐보니, 쉘권한을 얻은걸 보아 비밀번호가 맞는 것 같다.

leviathan6@leviathan:~$ ./leviathan6 7123
$ cat /etc/leviathan_pass/leviathan7
ahy7MaeBo9

 

 

 

5. 위에서 얻은 leviathan7 비밀번호:ahy7MaeBo9 로 leviathan7에 접속하면 성공!

leviathan7

이로써, leviathan의 모든 문제를 끝냈다!


문제를 풀면서 정말 많이 느낀 점이 초반에 컴퓨터구조론, 어셈블리어를 익혀놓은 것이 결국 리버싱 할 때 매우 많이 좋은 이점으로 작용한 것 같다. 

Comments