WAR GAME/Nebula

[Exploit-Exercises: Nebula] level00 풀이

jir4vvit 2020. 3. 24. 16:01

환경설정 : iso 파일을 이용하여 서버를 연 후, cygwin을 이용하여 ssh로 서버에 접속함.

* level00 

ID: level00

PW: level00

 

Q. This level requires you to find a Set User ID program that will run as the “flag00” account. You could also find this by carefully looking in top level directories in / for suspicious looking directories.

이 수준에서는 "flag00" 계정으로 실행될 사용자 ID 설정 프로그램을 찾아야 한다. 당신은 또한 의심스러운 디렉토리를 찾기 위해/의 최상위 디렉토리를 주의 깊게 살펴봄으로써 이것을 발견할 수 있었다.

 

The authenticity of host '192.168.88.131 (192.168.88.131)' can't be established.
ECDSA key fingerprint is SHA256:16a5ODBVlg/V9P0PA2NRbFRi4PUW4We1R1U2xwX4F9s.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '192.168.88.131' (ECDSA) to the list of known hosts.

      _   __     __          __
     / | / /__  / /_  __  __/ /___ _
    /  |/ / _ \/ __ \/ / / / / __ `/
   / /|  /  __/ /_/ / /_/ / / /_/ /
  /_/ |_/\___/_.___/\__,_/_/\__,_/

    exploit-exercises.com/nebula


For level descriptions, please see the above URL.

To log in, use the username of "levelXX" and password "levelXX", where
XX is the level number.

Currently there are 20 levels (00 - 19).


level00@192.168.88.131's password:
Welcome to Ubuntu 11.10 (GNU/Linux 3.0.0-12-generic i686)

 * Documentation:  https://help.ubuntu.com/
New release '12.04 LTS' available.
Run 'do-release-upgrade' to upgrade to it.

level00@nebula:~$

위의 level00의 ID와 PW를 이용하여 접속해주었다.

 

flag00의 SetUID가 걸린 프로그램을 찾아야 한다.

저 명령어가 생소할 수도 있다.

차근차근 설명을 해보자면, find /는 루트 아래, 즉 전체에서 찾겠다는 말이다.

-user flag00 : user가 flag00인 것을

-perm -4000 : SetUID가 걸려있고 rwx 모두

2>/dev/null : permission denied이면 휴지통으로 버린다.

 

 

flag00의 SetUID가 걸린 프로그램이 두개가 나왔다.

저 두 파일 다 무작정 열어보는 것 보다는 혹시나 같은 파일일 수도 있으니 md5를 통하여 같은지 확인해 보겠다.

 

왼쪽의 영문숫자값이 md5값인데, 두 값이 같은 것으로 보아 /bin/.../flag00 과 /rofs/bin/.../flag00은 같은 파일인 것을 확인할 수 있다.

 

그럼 나는 /bin/.../flag00 파일만 한 번 보도록하겠다.

 

 

ls -al 명령을 통해 /bin/.../flag00 파일은 SetUID가 걸려있는 파일임을 확실히 확인할 수 있었다.

실행권한도 있었다.

 

 

해당 디렉터리로 이동하였고, flag00를 실행시켜보았다.

 

Congrats, now run getflag to get your flag!

getflag를 실행시켜 flag를 얻으라고 한다.

 

 

You have successfully executed getflag on a target account

성공적으로 getflag를 실행시켰다고 한다.

 

 

 

 

내가 이때까지 푼 워게임 들은(얼마 없지만) 패스워드를 얻어서 다음 레벨로 넘어가는 식이었는데, 이 워게임은 아니다. 찝찝하지만 이게 끝이다...

이전 게시물에서도 언급했지만, 다시 언급하자면

문제풀이 형식은 다음 레벨의 패스워드를 얻는 것이 아니라 flag0*의 권한을 획득하여 getflag를 실행시키는 것이다.