티스토리 뷰

Pwnable/FTZ level

[hackerschool FTZ] level7

PAPICO 2017. 1. 3. 16:58

level7을 풀어보겠다.


[level7@ftz level7]$


우선 ls -al을 쳐서 무슨 파일이 있는지 확인한다.


[level7@ftz level7]$ ls -al

total 80

drwxr-xr-x    4 root     level7       4096 Mar 19  2003 .

drwxr-xr-x   34 root     root         4096 Sep 10  2011 ..

-rw-------    1 root     root            1 Jan 15  2010 .bash_history

-rw-r--r--    1 root     root           24 Feb 24  2002 .bash_logout

-rw-r--r--    1 root     root          224 Feb 24  2002 .bash_profile

-rw-r--r--    1 root     root          151 Feb 24  2002 .bashrc

-rw-r--r--    1 root     root          400 Sep 24  2000 .cshrc

-rw-r--r--    1 root     root         4742 Sep 24  2000 .emacs

-r--r--r--    1 root     root          319 Sep 24  2000 .gtkrc

-rw-r--r--    1 root     root          100 Sep 24  2000 .gvimrc

-rw-r--r--    1 root     root          185 Nov 23  2000 hint

-rw-r--r--    1 root     root          226 Sep 24  2000 .muttrc

-rw-r--r--    1 root     root          367 Sep 24  2000 .profile

drwxr-xr-x    2 root     level7       4096 Feb 24  2002 public_html

drwxrwxr-x    2 root     level7       4096 Jan  9  2009 tmp

-rw-r--r--    1 root     root            1 May  7  2002 .viminfo

-rw-r--r--    1 root     root         4145 Sep 24  2000 .vimrc

-rw-r--r--    1 root     root          245 Sep 24  2000 .Xdefaults


hint 파일을 열러 보겠다.


[level7@ftz level7]$ cat hint



/bin/level7 명령을 실행하면, 패스워드 입력을 요청한다.


1. 패스워드는 가까운곳에..

2. 상상력을 총동원하라.

3. 2진수를 10진수를 바꿀 수 있는가?

4. 계산기 설정을 공학용으로 바꾸어라.



수수께끼처럼 4개의 문제가 나와 있다.


1. 패스워드는 가까운 곳에...

   가까운 곳에 있나보다.


2. 상상력을 총동원하라.

   상상력은 준비가 된 것같다.


3. 2진수를 10진수를 바꿀 수 있는가?

   2진수를 10진수로 바꿔야 하는 것 같다.


4. 계산기 설정을 공학용으로 바꾸어라.

   공학용 계산기 설정이 필요하다.


그럼 일단 /bin/level7을 실행시켜 보겠다.


[level7@ftz level7]$ cd /bin

[level7@ftz bin]$ ./level7

Insert The Password :


password를 입력하란다. 일단 임의의 패스워드 "PAPICO"를 입력해보겠다.


[level7@ftz bin]$ ./level7

Insert The Password : PAPICO

cat: /bin/wrong.txt: No such file or directory


....!!!!! 아마 실행하고 잘못된 비밀번호를 치면 /bin/wrong.txt 을 읽어주는 것이었던거 같다.

인터넷을 찾아보니 개인이 서버를 열어서 실행하면 이런 오류가 발생한다고 나와있다.

그래서 원래 실행하면 나오는 것을 가져와서 풀어보겠다.


[level7@ftz level7]$ level7

Insert The Password : PAPICO

올바르지 않은 패스워드 입니다.

패스워드는 가까운곳에...

--_--_- --____- ---_-__ --__-_-


문제에서 - , _ 를 이용해서 암호를 주었다. -를 1, _을 0이라고 하고 암호를 해독하면 1101101 1100001 1110100 1100101이다.

아마 아까 힌트에서 2진수와 10진수에 관한 이야기가 나왔으므로 이수들을 10진수로 바꾸고 나온 10진수들의 2진 ASCII 갑싱 이번 level7의 비밀번호일 것이다.


파이썬으로 코드를 작성해 암호를 해독해 보겠다.


$passwd.py


message = "--_--_- --____- ---_-__ --__-_-"

result = ""


message = message.replace("-","1")

message = message.replace("_","0")


message = message.split(" ")


for i in message:

    result = result + chr(int(i, 2))


print("Password : " + result)


================ passwd.py ================

Password : mate


mate가 아마 /bin/level7의 비밀번호 인것 같다.

mate를 입력해보았다.


[level7@ftz bin]$ ./level7

Insert The Password : mate


Congratulation! next password is "break the world".


level7을 풀었다!!

'Pwnable > FTZ level' 카테고리의 다른 글

[hackerschool FTZ] level9  (0) 2017.03.23
[hackerschool FTZ] level8  (0) 2017.01.04
[hackerschool FTZ] level6  (0) 2016.12.27
[hackerschool FTZ] level5  (0) 2016.12.27
[hackerschool FTZ] level4  (0) 2016.12.26
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
TAG
more
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함