티스토리 뷰

Wargame/OverTheWire

[Bandit] Level 25

do9dark 2016. 2. 2. 22:11

Level Goal

다음 레벨로 넘어가는데 필요한 패스워드를 얻기 위해서 다음 레벨로 접속은 SSH 키 값을 이용해서 할 수 있지만, bandit26 유저의 shell은 /bin/bash가 아니기 때문에 정상적으로 동작을 할 수가 없다.


bandit26 유저의 shell을 확인해보면 /usr/bin/showtext로 되어있는 것을 확인할 수 있고, 내용을 살펴보면 more 명령어를 이용하여 ~/text.txt 파일을 읽고 종료하는 것을 볼 수 있다.

$ cat /etc/passwd | grep bandit26

$ cat /usr/bin/showtext


bandit26.sshkey 파일을 이용해서 다음 레벨로 접속 시도

$ ssh -i bandit26.sshkey bandit26@localhost 


터미널 창의 크기를 줄인 상태에서 접속을 시도해보면 more 명령어로 인해서 종료되지 않고 명령을 기다리는 상태가 된다.


이 때, v를 누르면 수정할 수 있는 상태가 된다.

[v]

Start up an editor at current line.  The editor is taken from the environment variable VISUAL if defined, or EDITOR if VISUAL is not defined, or defaults to "vi" if neither VISUAL nor EDITOR is defined.


그리고, r 명령을 이용해서 패스워드 파일을 불러올 수 있다.

:r /etc/bandit_pass/bandit26


다른 방법:

현재 사용 중인 쉘을 /bin/bash로 변경해서 패스워드를 확인할 수도 있다.

:set shell=/bin/bash

:sh

$ cat /etc/bandit_pass/bandit26


bandit26:5czgV9L3Xx8JPOyRbXh6lQbmIOWvPT6Z

'Wargame > OverTheWire' 카테고리의 다른 글

[Bandit] Level 26  (0) 2016.02.02
[Bandit] Level 24  (0) 2016.02.02
[Bandit] Level 23  (0) 2016.02.02
[Bandit] Level 22  (0) 2016.02.02
[Bandit] Level 21  (0) 2016.02.02
[Bandit] Level 20  (0) 2016.02.02
[Bandit] Level 19  (0) 2016.02.02
[Bandit] Level 18  (0) 2016.02.02
[Bandit] Level 17  (0) 2016.02.02
[Bandit] Level 16  (0) 2016.02.02
댓글
«   2024/04   »
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
링크
공지사항
Total
Today
Yesterday