일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- pwncollege
- 하드링크
- css
- radare2
- 시스템해킹
- kernel
- pwn.college
- 컴퓨터구조
- 리버싱
- 시그널
- multiplexing
- 어셈블리어
- 리눅스
- write up
- Bandit
- 시스템 프로그래밍
- C언어
- 알고리즘
- 커널
- Pwnable.kr
- 리눅스 커널
- 시스템
- wargame
- C++
- 리눅스커널
- 포너블
- 시스템프로그래밍
- 워게임
- Leviathan
- 프로그래밍
- Today
- Total
Computer Security
#11 Wargame bandit 9 (Level17 ~ Level19), diff명령어,bashrc 본문
Level17 -> Level18
홈디렉토리에는 2개의 파일이 있습니다: passwords.old 및 passwords.new.
다음 수준의 암호는 passwords.new에 있으며 password.old와 passwords.new 사이에서 변경된 유일한 줄입니다.
참고: 이 레벨을 해결하고 bandit18에 로그인하려고 할 때 'Byebye!'가 표시되면 이것은 다음 레벨인 bandit19와 관련이 있습니다.
passwords.old 와 passwords.new의 차이점을 가진 strings이 비밀번호라 한다.
위 문제를 해결하기 위해 diff명령어에 대해 알아보자.
diff [differences]
-diff명령어는 differences의 약자로 두 파일 사이의 내용을 비교하는 명령어다.
-cmp 명령어 보다는 diff 명령어가 보다 직관적이고 명확하게 결과를 알려 준다.
-파일 비교 명령어, 일반적으로 하나의 파일 버전과 동일한 파일의 다른 버전 간의 변경 사항을 보여주는데 쓰인다.
-diff는 문서파일 의 줄 사이 변경 사항을 보여준다.diff명령어는 3개의 파일 까지 비교 가능하다.
사용법
#> diff [옵션][비교파일1][비교파일2]
#> diff [옵션][비교파일1][비교파일2][비교파일3]
옵션
-c
|
두 파일간의 차이점 출력
|
-d
|
두 파일간의 차이점을 상세하게 출력
|
-r
|
두 디렉토리간의 차이점 출력, 서브디렉토리 까지 비교
|
-i
|
대소문자의 차이 무시
|
-w
|
모든 공백 차이무시
|
-s
|
두 파일이 같을 때 알림
|
-u
|
두 파일의 변경되는 부분과 변경되는 부분의 근처의 내용도 출력
|
1. ls 로 파일이 존재하는지부터 확인해주고, diff 명령어를 이용해 비밀번호를 알아낸다!
bandit17@bandit:~$ ls
passwords.new passwords.old
bandit17@bandit:~$ diff passwords.old passwords.new
42c42
< w0Yfolrc5bwjS4qw5mq1nnQi6mF03bii
---
> kfBf3eYk5BPBRzwjqutbbfE887SVc5Yd
2. 얻어낸 비밀번호 kfBf3eYk5BPBRzwjqutbbfE887SVc5Yd 를 가지고 bandit18에 접속하면 성공!
비밀번호를 입력하니 바로 로그아웃이 된다.
다음문제에서 알아보자!
Level18 -> Level19
Level17에서 18로 접속하려 할 때, 바로 로그아웃이 되었다.
그 원인은 .bashrc때문에 바로 로그아웃이 되는 거였다.
putty를 이용해선 해결방법이 떠오르지 않았기에, ubuntu로 진행 하였다.
1.해결방법
접속할 때 실행할 명령어를 같이 보내주는 것이다.
ssh 명령어 다 쓰고 그 뒤에 큰 따옴표로 감싸서 보내면 바로 실행 시킬 수 있다.
.
godongsan@ubuntu:~$ ssh bandit18@bandit.labs.overthewire.org -p2220 "cat readme"
This is a OverTheWire game server. More information on http://www.overthewire.org/wargames
bandit18@bandit.labs.overthewire.org's password:
IueksS7Ubh8G3DCwVzrTd8rAVOwq3M5x
godongsan@ubuntu:~$
2.위에서 알아낸 비밀번호 IueksS7Ubh8G3DCwVzrTd8rAVOwq3M5x 로 bandit19에 접속하면 성공!
For your convenience we have installed a few usefull tools which you can find
in the following locations:
* gef (https://github.com/hugsy/gef) in /usr/local/gef/
* pwndbg (https://github.com/pwndbg/pwndbg) in /usr/local/pwndbg/
* peda (https://github.com/longld/peda.git) in /usr/local/peda/
* gdbinit (https://github.com/gdbinit/Gdbinit) in /usr/local/gdbinit/
* pwntools (https://github.com/Gallopsled/pwntools)
* radare2 (http://www.radare.org/)
* checksec.sh (http://www.trapkit.de/tools/checksec.html) in /usr/local/bin/checksec.sh
--[ More information ]--
For more information regarding individual wargames, visit
http://www.overthewire.org/wargames/
For support, questions or comments, contact us through IRC on
irc.overthewire.org #wargames.
Enjoy your stay!
bandit19@bandit:~$
'Wargame:Bandit' 카테고리의 다른 글
#13 Wargame bandit 10 (Level21 ~ Level23), tmp (0) | 2022.07.19 |
---|---|
#12 Wargame bandit 9 (Level19 ~ Level21), setuid,nc 명령어 (0) | 2022.07.18 |
#10 Wargame bandit 8 (Level15 ~ Level17), openssl,nmap명령어, 하트블리드 취약점 (0) | 2022.07.16 |
#9 Wargame bandit 7 (Level13 ~ Level15), ssh,리눅스 디렉토리,nc명령어 (0) | 2022.07.15 |
#8 Wargame bandit 6 (Level11 ~ Level13), tr,mkdir,cp,xxd,gzip,bzip2,tar,mv명령어 (0) | 2022.07.14 |