Level 26 → Level 27

옥영진·2020년 5월 20일
0

Bandit - OverTheWire

목록 보기
27/33

Level 26 → Level 27

목표

Level Goal
Good job getting a shell! Now hurry and grab the password for bandit27!

Commands you may need to solve this level
ls

쉘을 얻었으니 bandit27 패스워드를 얻어보자.

해결

일단 bandit26의 로그인 쉘로는 접속이 되지 않으므로 전과 이어서 bandit25 계정으로 로그인하여 진행한다.

ssh -i ./bandit26.sshkey bandit26@localhost

이전 레벨과 마찬가지로 터미널 화면 크기를 줄여서 sshbandit26 사용자로 접속했을 때 more 명령어가 실행되어 중간에 멈추도록 만들어야 한다. 그 후 :set shell=/bin/bash를 입력하면 쉘을 현재의 쉘 설정을 변경한다. 변경 후 :sh를 입력하면 변경한 쉘을 얻을 수 있다.

ls -al
./bandit27-do

획득한 쉘을 이용해 bandit26 홈 디렉토리 내 파일 목록을 살펴보니 bandit27-do 라는 실행파일이 보인다. 해당 파일은 setuid가 설정되어 실행할 때 bandit27 계정의 권한을 잠시 부여받을 수 있다.

./bandit27-do cat /etc/bandit_pass/bandit27

/etc/bandit_pass/bandit27 파일의 내용을 출력하는 명령어를 입력하면 다음 레벨로 가는 패스워드를 얻을 수 있다.

profile
안녕하세요 함께 공부합시다

0개의 댓글