https://overthewire.org/wargames/bandit/
OverTheWire: Bandit
We're hackers, and we are good-looking. We are the 1%. Bandit The Bandit wargame is aimed at absolute beginners. It will teach the basics needed to be able to play other wargames. If you notice something essential is missing or have ideas for new levels, p
overthewire.org
* 미션 풀이
[Level 0]
1. 자신의 운영체제에 맞는 PuTTY를 다운로드 한다.
2. PuTTY를 실행하고 Host Name 칸에 반딧 홈페이지에 있는 Host 주소를 입력하고, Port에 2220을 입력한다.
3. Saved Sessions에 bandit_server 입력 후, Save
4. bandit_server에 들어간다.
5. login as 옆에 bandit0을 입력.

6. 비번에 bandit0을 입력.
bandit0의 비번은 bandit0 이다.
7. 이런 창이 뜨면서 성공.
login as: bandit0
Pre-authentication banner message from server:
| This is a OverTheWire game server. More information on http://www.overthewire
> .org/wargames
|
End of banner message from server
bandit0@bandit.labs.overthewire.org's password:
Linux bandit.otw.local 5.4.8 x86_64 GNU/Linux
,----.. ,----, .---.
/ / \ ,/ .`| /. ./|
/ . : ,` .' : .--'. ' ;
. / ;. \ ; ; / /__./ \ : |
. ; / ` ; .'___,/ ,' .--'. ' \' .
; | ; \ ; | | : | /___/ \ | ' '
| : | ; | ' ; |.'; ; ; \ \; :
. | ' ' ' : `----' | | \ ; ` |
' ; \; / | ' : ; . \ .\ ;
\ \ ', / | | ' \ \ ' \ |
; : / ' : | : ' |--"
\ \ .' ; |.' \ \ ;
www. `---` ver '---' he '---" ire.org
Welcome to OverTheWire!
If you find any problems, please report them to Steven or morla on
irc.overthewire.org.
--[ Playing the games ]--
This machine might hold several wargames.
If you are playing "somegame", then:
* USERNAMES are somegame0, somegame1, ...
* Most LEVELS are stored in /somegame/.
* PASSWORDS for each level are stored in /etc/somegame_pass/.
Write-access to homedirectories is disabled. It is advised to create a
working directory with a hard-to-guess name in /tmp/. You can use the
command "mktemp -d" in order to generate a random and hard to guess
directory in /tmp/. Read-access to both /tmp/ and /proc/ is disabled
so that users can not snoop on eachother. Files and directories with
easily guessable or short names will be periodically deleted!
Please play nice:
* don't leave orphan processes running
* don't leave exploit-files laying around
* don't annoy other players
* don't post passwords or spoilers
* again, DONT POST SPOILERS!
This includes writeups of your solution on your blog or website!
--[ Tips ]--
This machine has a 64bit processor and many security-features enabled
by default, although ASLR has been switched off. The following
compiler flags might be interesting:
-m32 compile for 32bit
-fno-stack-protector disable ProPolice
-Wl,-z,norelro disable relro
In addition, the execstack tool can be used to flag the stack as
executable on ELF binaries.
Finally, network-access is limited for most levels by a local
firewall.
--[ Tools ]--
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!
bandit0@bandit:~$
[Level 0 -> Level 1]
1. clear로 화면을 정리해준다.
2. ls 엔터
3. cat readme 엔터
4. 그러면 bandit1의 비번이 나오게 된다.
bandit1의 비번은 boJ9jbbUNNfktd78OOpsqOltutMc3MY1 이다.
bandit0@bandit:~$ ls
readme
bandit0@bandit:~$ cat readme
boJ9jbbUNNfktd78OOpsqOltutMc3MY1
bandit0@bandit:~$
5. bandit1로 접속
6. 아까 찾아낸 비번인 boJ9jbbUNNfktd78OOpsqOltutMc3MY1 입력 (마우스 오른쪽 클릭이 붙여넣기이다.)
7. 다음과 같은 화면이 나오면서 성공.
login as: bandit1
Pre-authentication banner message from server:
| This is a OverTheWire game server. More information on http://www.overthewire
> .org/wargames
|
End of banner message from server
bandit1@bandit.labs.overthewire.org's password:
Linux bandit.otw.local 5.4.8 x86_64 GNU/Linux
,----.. ,----, .---.
/ / \ ,/ .`| /. ./|
/ . : ,` .' : .--'. ' ;
. / ;. \ ; ; / /__./ \ : |
. ; / ` ; .'___,/ ,' .--'. ' \' .
; | ; \ ; | | : | /___/ \ | ' '
| : | ; | ' ; |.'; ; ; \ \; :
. | ' ' ' : `----' | | \ ; ` |
' ; \; / | ' : ; . \ .\ ;
\ \ ', / | | ' \ \ ' \ |
; : / ' : | : ' |--"
\ \ .' ; |.' \ \ ;
www. `---` ver '---' he '---" ire.org
Welcome to OverTheWire!
If you find any problems, please report them to Steven or morla on
irc.overthewire.org.
--[ Playing the games ]--
This machine might hold several wargames.
If you are playing "somegame", then:
* USERNAMES are somegame0, somegame1, ...
* Most LEVELS are stored in /somegame/.
* PASSWORDS for each level are stored in /etc/somegame_pass/.
Write-access to homedirectories is disabled. It is advised to create a
working directory with a hard-to-guess name in /tmp/. You can use the
command "mktemp -d" in order to generate a random and hard to guess
directory in /tmp/. Read-access to both /tmp/ and /proc/ is disabled
so that users can not snoop on eachother. Files and directories with
easily guessable or short names will be periodically deleted!
Please play nice:
* don't leave orphan processes running
* don't leave exploit-files laying around
* don't annoy other players
* don't post passwords or spoilers
* again, DONT POST SPOILERS!
This includes writeups of your solution on your blog or website!
--[ Tips ]--
This machine has a 64bit processor and many security-features enabled
by default, although ASLR has been switched off. The following
compiler flags might be interesting:
-m32 compile for 32bit
-fno-stack-protector disable ProPolice
-Wl,-z,norelro disable relro
In addition, the execstack tool can be used to flag the stack as
executable on ELF binaries.
Finally, network-access is limited for most levels by a local
firewall.
--[ Tools ]--
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!
bandit1@bandit:~$
# ls : 리눅스에서는 ls 명령어를 사용하여 디렉토리에 있는 내용을 확인한다.
[자주 사용되는 ls 명령어 옵션]
ls -a 옵션
숨겨진 파일이나 디렉토리를 보여준다.
ls -l 옵션
자세한 내용을 출력한다.
ls -s 옵션
파일 크기 순으로 정렬하여 출력한다.
ls -r 옵션
거꾸로 출력한다. (기본 명령은 알파벳 순서이다.)
ls -R 옵션
하위 디렉토리까지 출력한다.
ls -h 옵션
K, M, G 단위를 사용하여 파일 크기를 사람이 보기 좋게 표시한다.
ls -d 옵션
지정된 디렉토리의 정보 출력
ls -F 옵션
파일 형식을 알리는 문자를 각 파일 뒤에 추가
# cat : cat 명령 뒤에 파일 이름을 입력하면 그 파일의 내용을 출력한다.
- cat file1 file2 file3
여러 개의 파일을 전달하여 파일 내용을 연속해서 출력할 수 있다.
- cat -n file1 file2 file3
cat 명령의 n 옵션을 사용하면 행 번호를 표시한다.
[Level 1 -> Level 2]
1. clear로 화면 정리
2. ls 입력 후, cat -을 입력했지만 아무런 반응이 없다.
--> 이유를 찾아보니, cat 명령어 뒤에 cat -n과 같은 옵션인자가 대쉬와 함께 입력이 되기 때문이라고 한다.
이를 해결하기 위한 방법을 2가지 찾았다.
(1) cat ./'파일명'
파일명 앞에 '현재 디렉토리'를 뜻하는 ./를 추가하는 것이다.
원래는 ./를 생략해도 무방한 것이지만 지금 같은 경우에 사용하면 파일을 읽을 수 있게 된다.
(2) cat <'파일명'
파일명 앞에 <를 사용하는 것이다.
3. 2번째 방법을 사용하여 실행했다.

bandit2의 비번은 CV1DtqXWVFXTvM2F0k09SHz0YwRINYA9 이다.
4. bandit2로 접속 후, 위의 비번 입력
5. 다음과 같은 창이 뜨며 성공
login as: bandit2
Pre-authentication banner message from server:
| This is a OverTheWire game server. More information on http://www.overthewire
> .org/wargames
|
End of banner message from server
bandit2@bandit.labs.overthewire.org's password:
Linux bandit.otw.local 5.4.8 x86_64 GNU/Linux
,----.. ,----, .---.
/ / \ ,/ .`| /. ./|
/ . : ,` .' : .--'. ' ;
. / ;. \ ; ; / /__./ \ : |
. ; / ` ; .'___,/ ,' .--'. ' \' .
; | ; \ ; | | : | /___/ \ | ' '
| : | ; | ' ; |.'; ; ; \ \; :
. | ' ' ' : `----' | | \ ; ` |
' ; \; / | ' : ; . \ .\ ;
\ \ ', / | | ' \ \ ' \ |
; : / ' : | : ' |--"
\ \ .' ; |.' \ \ ;
www. `---` ver '---' he '---" ire.org
Welcome to OverTheWire!
If you find any problems, please report them to Steven or morla on
irc.overthewire.org.
--[ Playing the games ]--
This machine might hold several wargames.
If you are playing "somegame", then:
* USERNAMES are somegame0, somegame1, ...
* Most LEVELS are stored in /somegame/.
* PASSWORDS for each level are stored in /etc/somegame_pass/.
Write-access to homedirectories is disabled. It is advised to create a
working directory with a hard-to-guess name in /tmp/. You can use the
command "mktemp -d" in order to generate a random and hard to guess
directory in /tmp/. Read-access to both /tmp/ and /proc/ is disabled
so that users can not snoop on eachother. Files and directories with
easily guessable or short names will be periodically deleted!
Please play nice:
* don't leave orphan processes running
* don't leave exploit-files laying around
* don't annoy other players
* don't post passwords or spoilers
* again, DONT POST SPOILERS!
This includes writeups of your solution on your blog or website!
--[ Tips ]--
This machine has a 64bit processor and many security-features enabled
by default, although ASLR has been switched off. The following
compiler flags might be interesting:
-m32 compile for 32bit
-fno-stack-protector disable ProPolice
-Wl,-z,norelro disable relro
In addition, the execstack tool can be used to flag the stack as
executable on ELF binaries.
Finally, network-access is limited for most levels by a local
firewall.
--[ Tools ]--
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!
bandit2@bandit:~$
[Level 2 -> Level 3]
1. ls 입력 후, 나오는 spaces in this file name을 cat spaces in this filename 으로 입력하면 밑과 같이 따로따로 불러오려고 하게 된다.

이와 같은 상황을 해결하기 위해서는 문자 공백 앞에 \을 입력해주면 된다.
2. 공백 앞에 \을 입력

bandit3의 비번은 UmHadQclWmgdLOKQ3YNgjWxGoRMb5luK 이다.
3. bandit3 접속 후, 비번 입력을 마치면 다음과 같은 창이 뜨며 성공
login as: bandit3
Pre-authentication banner message from server:
| This is a OverTheWire game server. More information on http://www.overthewire
> .org/wargames
|
End of banner message from server
bandit3@bandit.labs.overthewire.org's password:
Linux bandit.otw.local 5.4.8 x86_64 GNU/Linux
,----.. ,----, .---.
/ / \ ,/ .`| /. ./|
/ . : ,` .' : .--'. ' ;
. / ;. \ ; ; / /__./ \ : |
. ; / ` ; .'___,/ ,' .--'. ' \' .
; | ; \ ; | | : | /___/ \ | ' '
| : | ; | ' ; |.'; ; ; \ \; :
. | ' ' ' : `----' | | \ ; ` |
' ; \; / | ' : ; . \ .\ ;
\ \ ', / | | ' \ \ ' \ |
; : / ' : | : ' |--"
\ \ .' ; |.' \ \ ;
www. `---` ver '---' he '---" ire.org
Welcome to OverTheWire!
If you find any problems, please report them to Steven or morla on
irc.overthewire.org.
--[ Playing the games ]--
This machine might hold several wargames.
If you are playing "somegame", then:
* USERNAMES are somegame0, somegame1, ...
* Most LEVELS are stored in /somegame/.
* PASSWORDS for each level are stored in /etc/somegame_pass/.
Write-access to homedirectories is disabled. It is advised to create a
working directory with a hard-to-guess name in /tmp/. You can use the
command "mktemp -d" in order to generate a random and hard to guess
directory in /tmp/. Read-access to both /tmp/ and /proc/ is disabled
so that users can not snoop on eachother. Files and directories with
easily guessable or short names will be periodically deleted!
Please play nice:
* don't leave orphan processes running
* don't leave exploit-files laying around
* don't annoy other players
* don't post passwords or spoilers
* again, DONT POST SPOILERS!
This includes writeups of your solution on your blog or website!
--[ Tips ]--
This machine has a 64bit processor and many security-features enabled
by default, although ASLR has been switched off. The following
compiler flags might be interesting:
-m32 compile for 32bit
-fno-stack-protector disable ProPolice
-Wl,-z,norelro disable relro
In addition, the execstack tool can be used to flag the stack as
executable on ELF binaries.
Finally, network-access is limited for most levels by a local
firewall.
--[ Tools ]--
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!
bandit3@bandit:~$
[Level 3 -> Level 4]
1. ls를 입력하면 inhere이 나오고, cat inhere을 하면 inhere은 디렉토리라는 것을 알려준다.

2. inhere 디렉토리에 들어가기 위해 cd inhere을 입력
cd는 디렉토리를 이동하는 명령어이다.
- cd [디렉토리 경로] : 이동하려는 디렉토리로 이동한다.
- cd . : 현재 디렉토리
- cd .. : 상위 디렉토리로 이동한다.
- cd $ 변수명 : 변수에 지정된 디렉토리로 이동한다.
- cd / : 가장 상위 디렉토리로 이동한다.
- cd -cd $HOME cd : 사용자의 홈 디렉토리로 이동한다.
- cd ~사용자 계정 : 지정된 사용자의 홈 디렉토리로 이동한다.
3. 그냥 ls를 치면 아무것도 나오지 않기 때문에 ls -a를 입력
4. 그러면 .hidden 이라는 파일이 나온다.
5. cat .hidden 입력하면 bandit4의 비번이 나오게 된다.

bandit4의 비번은 pIwrPrtPN36QITSp3EQaw936yaFoFgAB 이다.
6. bandit4 접속 후, 비번 입력을 하면 성공.
login as: bandit4
Pre-authentication banner message from server:
| This is a OverTheWire game server. More information on http://www.overthewire
> .org/wargames
|
End of banner message from server
bandit4@bandit.labs.overthewire.org's password:
Linux bandit.otw.local 5.4.8 x86_64 GNU/Linux
,----.. ,----, .---.
/ / \ ,/ .`| /. ./|
/ . : ,` .' : .--'. ' ;
. / ;. \ ; ; / /__./ \ : |
. ; / ` ; .'___,/ ,' .--'. ' \' .
; | ; \ ; | | : | /___/ \ | ' '
| : | ; | ' ; |.'; ; ; \ \; :
. | ' ' ' : `----' | | \ ; ` |
' ; \; / | ' : ; . \ .\ ;
\ \ ', / | | ' \ \ ' \ |
; : / ' : | : ' |--"
\ \ .' ; |.' \ \ ;
www. `---` ver '---' he '---" ire.org
Welcome to OverTheWire!
If you find any problems, please report them to Steven or morla on
irc.overthewire.org.
--[ Playing the games ]--
This machine might hold several wargames.
If you are playing "somegame", then:
* USERNAMES are somegame0, somegame1, ...
* Most LEVELS are stored in /somegame/.
* PASSWORDS for each level are stored in /etc/somegame_pass/.
Write-access to homedirectories is disabled. It is advised to create a
working directory with a hard-to-guess name in /tmp/. You can use the
command "mktemp -d" in order to generate a random and hard to guess
directory in /tmp/. Read-access to both /tmp/ and /proc/ is disabled
so that users can not snoop on eachother. Files and directories with
easily guessable or short names will be periodically deleted!
Please play nice:
* don't leave orphan processes running
* don't leave exploit-files laying around
* don't annoy other players
* don't post passwords or spoilers
* again, DONT POST SPOILERS!
This includes writeups of your solution on your blog or website!
--[ Tips ]--
This machine has a 64bit processor and many security-features enabled
by default, although ASLR has been switched off. The following
compiler flags might be interesting:
-m32 compile for 32bit
-fno-stack-protector disable ProPolice
-Wl,-z,norelro disable relro
In addition, the execstack tool can be used to flag the stack as
executable on ELF binaries.
Finally, network-access is limited for most levels by a local
firewall.
--[ Tools ]--
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!
bandit4@bandit:~$
[Level 4 -> Level 5]
1. ls 입력 후, cd inhere을 통해 inhere 디렉토리에 들어간다.
2. ls를 입력하면 총 10개의 파일이 나온다.

3. , cat 명령을 통해 00부터 04파일까지 열어봤지만 알아볼 수 없는 문자로 되어 있었다.

4. 나머지 파일들을 열어봤다.
멀쩡한 문자 발견!

5. 어디서부터 어디까지 비번인지 모르기 때문에 다시 차례대로 확인해봤다.
6. 결과적으로 -file07에 들어있었다.

bandit5의 비번은 koReBOKuIDDepwhWk7jZC0RTdopnAYKh 이다.
7. bandit5에 접속 후, 비번을 입력하면 성공
bandit5@bandit.labs.overthewire.org's password:
Linux bandit.otw.local 5.4.8 x86_64 GNU/Linux
,----.. ,----, .---.
/ / \ ,/ .`| /. ./|
/ . : ,` .' : .--'. ' ;
. / ;. \ ; ; / /__./ \ : |
. ; / ` ; .'___,/ ,' .--'. ' \' .
; | ; \ ; | | : | /___/ \ | ' '
| : | ; | ' ; |.'; ; ; \ \; :
. | ' ' ' : `----' | | \ ; ` |
' ; \; / | ' : ; . \ .\ ;
\ \ ', / | | ' \ \ ' \ |
; : / ' : | : ' |--"
\ \ .' ; |.' \ \ ;
www. `---` ver '---' he '---" ire.org
Welcome to OverTheWire!
If you find any problems, please report them to Steven or morla on
irc.overthewire.org.
--[ Playing the games ]--
This machine might hold several wargames.
If you are playing "somegame", then:
* USERNAMES are somegame0, somegame1, ...
* Most LEVELS are stored in /somegame/.
* PASSWORDS for each level are stored in /etc/somegame_pass/.
Write-access to homedirectories is disabled. It is advised to create a
working directory with a hard-to-guess name in /tmp/. You can use the
command "mktemp -d" in order to generate a random and hard to guess
directory in /tmp/. Read-access to both /tmp/ and /proc/ is disabled
so that users can not snoop on eachother. Files and directories with
easily guessable or short names will be periodically deleted!
Please play nice:
* don't leave orphan processes running
* don't leave exploit-files laying around
* don't annoy other players
* don't post passwords or spoilers
* again, DONT POST SPOILERS!
This includes writeups of your solution on your blog or website!
--[ Tips ]--
This machine has a 64bit processor and many security-features enabled
by default, although ASLR has been switched off. The following
compiler flags might be interesting:
-m32 compile for 32bit
-fno-stack-protector disable ProPolice
-Wl,-z,norelro disable relro
In addition, the execstack tool can be used to flag the stack as
executable on ELF binaries.
Finally, network-access is limited for most levels by a local
firewall.
--[ Tools ]--
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!
bandit5@bandit:~$
**위와 같은 방법은 노가다이기 때문에 다른 방법을 찾아봤다. **
file ./* 를 입력하면 현재 경로의 모든 파일의 종류를 확인해준다.

7번 파일만 ASCII text 라는 것을 알 수 있다.
++
다음과 같은 명령어를 사용하면 7번 파일만 ASCII text라는 것을 바로 알려준다.

[Level 5 -> Level 6]
1. ls 입력 후 cd inhere을 입력하여 디렉토리에 들어가기
2. ls -a를 입력했더니 다음과 같이 나온다

du로 파일의 용량을 확인할 수 있다.
-a 옵션으로 숨겨진 파일이나 디렉토리를 볼 수 있고, -b 옵션으로 byte 수를 출력한다.
즉, 명령어는 du -a -b | grep 1033
++다른 방법
find 명령어 사용
find ./ -type f -readable ! -executable -size 1033c
=> type f는 지정한 파일의 유형을 찾는다.
=> readable은 읽을 수 있는 파일
=> ! -executable 은 실행 불가능한 파일
=> 1033c는 1033byte

3. du -a -b | grep 1033 입력

4. cat ./maybehere07/.file2 입력

bandit6의 비번은 DXjZPULLxYr17uwoI01bNLQbtFemEgo7 이다.
5. bandit6에 접속 후, 비번 입력하면 성공.
login as: bandit6
Pre-authentication banner message from server:
| This is a OverTheWire game server. More information on http://www.overthewire
> .org/wargames
|
End of banner message from server
bandit6@bandit.labs.overthewire.org's password:
Linux bandit.otw.local 5.4.8 x86_64 GNU/Linux
,----.. ,----, .---.
/ / \ ,/ .`| /. ./|
/ . : ,` .' : .--'. ' ;
. / ;. \ ; ; / /__./ \ : |
. ; / ` ; .'___,/ ,' .--'. ' \' .
; | ; \ ; | | : | /___/ \ | ' '
| : | ; | ' ; |.'; ; ; \ \; :
. | ' ' ' : `----' | | \ ; ` |
' ; \; / | ' : ; . \ .\ ;
\ \ ', / | | ' \ \ ' \ |
; : / ' : | : ' |--"
\ \ .' ; |.' \ \ ;
www. `---` ver '---' he '---" ire.org
Welcome to OverTheWire!
If you find any problems, please report them to Steven or morla on
irc.overthewire.org.
--[ Playing the games ]--
This machine might hold several wargames.
If you are playing "somegame", then:
* USERNAMES are somegame0, somegame1, ...
* Most LEVELS are stored in /somegame/.
* PASSWORDS for each level are stored in /etc/somegame_pass/.
Write-access to homedirectories is disabled. It is advised to create a
working directory with a hard-to-guess name in /tmp/. You can use the
command "mktemp -d" in order to generate a random and hard to guess
directory in /tmp/. Read-access to both /tmp/ and /proc/ is disabled
so that users can not snoop on eachother. Files and directories with
easily guessable or short names will be periodically deleted!
Please play nice:
* don't leave orphan processes running
* don't leave exploit-files laying around
* don't annoy other players
* don't post passwords or spoilers
* again, DONT POST SPOILERS!
This includes writeups of your solution on your blog or website!
--[ Tips ]--
This machine has a 64bit processor and many security-features enabled
by default, although ASLR has been switched off. The following
compiler flags might be interesting:
-m32 compile for 32bit
-fno-stack-protector disable ProPolice
-Wl,-z,norelro disable relro
In addition, the execstack tool can be used to flag the stack as
executable on ELF binaries.
Finally, network-access is limited for most levels by a local
firewall.
--[ Tools ]--
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!
bandit6@bandit:~$
[Level 6 -> Level 7]
1. ls -a 입력

find 명령어의 옵션인 -group -user -size를 이용한다.
2. find / -group bandit6 -user bandit7 -size 33c를 입력하면 다음과 같이 뜬다.
bandit6@bandit:~$ find / -group bandit6 -user bandit7 -size 33c
find: ‘/root’: Permission denied
find: ‘/home/bandit28-git’: Permission denied
find: ‘/home/bandit30-git’: Permission denied
find: ‘/home/bandit5/inhere’: Permission denied
find: ‘/home/bandit27-git’: Permission denied
find: ‘/home/bandit29-git’: Permission denied
find: ‘/home/bandit31-git’: Permission denied
find: ‘/lost+found’: Permission denied
find: ‘/etc/ssl/private’: Permission denied
find: ‘/etc/polkit-1/localauthority’: Permission denied
find: ‘/etc/lvm/archive’: Permission denied
find: ‘/etc/lvm/backup’: Permission denied
find: ‘/sys/fs/pstore’: Permission denied
find: ‘/proc/tty/driver’: Permission denied
find: ‘/proc/24694/task/24694/fd/6’: No such file or directory
find: ‘/proc/24694/task/24694/fdinfo/6’: No such file or directory
find: ‘/proc/24694/fd/5’: No such file or directory
find: ‘/proc/24694/fdinfo/5’: No such file or directory
find: ‘/cgroup2/csessions’: Permission denied
find: ‘/boot/lost+found’: Permission denied
find: ‘/tmp’: Permission denied
find: ‘/run/lvm’: Permission denied
find: ‘/run/screen/S-bandit0’: Permission denied
find: ‘/run/screen/S-bandit1’: Permission denied
find: ‘/run/screen/S-bandit12’: Permission denied
find: ‘/run/screen/S-bandit11’: Permission denied
find: ‘/run/screen/S-bandit10’: Permission denied
find: ‘/run/screen/S-bandit3’: Permission denied
find: ‘/run/screen/S-bandit29’: Permission denied
find: ‘/run/screen/S-bandit15’: Permission denied
find: ‘/run/screen/S-bandit8’: Permission denied
find: ‘/run/screen/S-bandit13’: Permission denied
find: ‘/run/screen/S-bandit19’: Permission denied
find: ‘/run/screen/S-bandit9’: Permission denied
find: ‘/run/screen/S-bandit27’: Permission denied
find: ‘/run/screen/S-bandit2’: Permission denied
find: ‘/run/screen/S-bandit14’: Permission denied
find: ‘/run/screen/S-bandit16’: Permission denied
find: ‘/run/screen/S-bandit22’: Permission denied
find: ‘/run/screen/S-bandit4’: Permission denied
find: ‘/run/screen/S-bandit31’: Permission denied
find: ‘/run/screen/S-bandit24’: Permission denied
find: ‘/run/screen/S-bandit21’: Permission denied
find: ‘/run/screen/S-bandit25’: Permission denied
find: ‘/run/screen/S-bandit23’: Permission denied
find: ‘/run/screen/S-bandit20’: Permission denied
find: ‘/run/shm’: Permission denied
find: ‘/run/lock/lvm’: Permission denied
find: ‘/var/spool/bandit24’: Permission denied
find: ‘/var/spool/cron/crontabs’: Permission denied
find: ‘/var/spool/rsyslog’: Permission denied
find: ‘/var/tmp’: Permission denied
find: ‘/var/lib/apt/lists/partial’: Permission denied
find: ‘/var/lib/polkit-1’: Permission denied
/var/lib/dpkg/info/bandit7.password
find: ‘/var/log’: Permission denied
find: ‘/var/cache/apt/archives/partial’: Permission denied
find: ‘/var/cache/ldconfig’: Permission denied
bandit6@bandit:~$
이 중 /var/lib/dpkg/info/bandit7.password 에 비번이 들어있다는 것을 확인할 수 있다.
3. cat /var/lib/dpkg/info/bandit7.password

bandit7의 비번은 HKBPTKQnIay4Fw76bEy8PVxKEDQRKTzs 이다.
4. bandit7에 접속 후, 비번 입력하면 성공.
login as: bandit7
Pre-authentication banner message from server:
| This is a OverTheWire game server. More information on http://www.overthewire
> .org/wargames
|
End of banner message from server
bandit7@bandit.labs.overthewire.org's password:
Linux bandit.otw.local 5.4.8 x86_64 GNU/Linux
,----.. ,----, .---.
/ / \ ,/ .`| /. ./|
/ . : ,` .' : .--'. ' ;
. / ;. \ ; ; / /__./ \ : |
. ; / ` ; .'___,/ ,' .--'. ' \' .
; | ; \ ; | | : | /___/ \ | ' '
| : | ; | ' ; |.'; ; ; \ \; :
. | ' ' ' : `----' | | \ ; ` |
' ; \; / | ' : ; . \ .\ ;
\ \ ', / | | ' \ \ ' \ |
; : / ' : | : ' |--"
\ \ .' ; |.' \ \ ;
www. `---` ver '---' he '---" ire.org
Welcome to OverTheWire!
If you find any problems, please report them to Steven or morla on
irc.overthewire.org.
--[ Playing the games ]--
This machine might hold several wargames.
If you are playing "somegame", then:
* USERNAMES are somegame0, somegame1, ...
* Most LEVELS are stored in /somegame/.
* PASSWORDS for each level are stored in /etc/somegame_pass/.
Write-access to homedirectories is disabled. It is advised to create a
working directory with a hard-to-guess name in /tmp/. You can use the
command "mktemp -d" in order to generate a random and hard to guess
directory in /tmp/. Read-access to both /tmp/ and /proc/ is disabled
so that users can not snoop on eachother. Files and directories with
easily guessable or short names will be periodically deleted!
Please play nice:
* don't leave orphan processes running
* don't leave exploit-files laying around
* don't annoy other players
* don't post passwords or spoilers
* again, DONT POST SPOILERS!
This includes writeups of your solution on your blog or website!
--[ Tips ]--
This machine has a 64bit processor and many security-features enabled
by default, although ASLR has been switched off. The following
compiler flags might be interesting:
-m32 compile for 32bit
-fno-stack-protector disable ProPolice
-Wl,-z,norelro disable relro
In addition, the execstack tool can be used to flag the stack as
executable on ELF binaries.
Finally, network-access is limited for most levels by a local
firewall.
--[ Tools ]--
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!
bandit7@bandit:~$
* 미션 풀이에 필요한 지식 정리
- SSH
secure shell의 약어이며, 네트워크 보안 도구 중 하나로 원격접속을 안전하게 할 수 있도록 해주는 프로토콜이다.
대표적으로 데이터 전송, 원격 제어를 위해 사용된다.
- 리눅스 명령어 : ls, cd, cat, file, find
ls
|
리눅스에서는 ls 명령어를 사용하여 디렉토리에 있는 내용을 확인한다.
[자주 사용되는 ls 명령어 옵션] ls -a 옵션 숨겨진 파일이나 디렉토리를 보여준다. ls -l 옵션 자세한 내용을 출력한다. ls -s 옵션 파일 크기 순으로 정렬하여 출력한다. ls -r 옵션 거꾸로 출력한다. (기본 명령은 알파벳 순서이다.) ls -R 옵션 하위 디렉토리까지 출력한다. ls -h 옵션 K, M, G 단위를 사용하여 파일 크기를 사람이 보기 좋게 표시한다. ls -d 옵션 지정된 디렉토리의 정보 출력 ls -F 옵션 파일 형식을 알리는 문자를 각 파일 뒤에 추가 |
cd
|
cd는 디렉토리를 이동하는 명령어이다.
- cd [디렉토리 경로] : 이동하려는 디렉토리로 이동한다. - cd . : 현재 디렉토리 - cd .. : 상위 디렉토리로 이동한다. - cd $ 변수명 : 변수에 지정된 디렉토리로 이동한다. - cd / : 가장 상위 디렉토리로 이동한다. - cd -cd $HOME cd : 사용자의 홈 디렉토리로 이동한다. - cd ~사용자 계정 : 지정된 사용자의 홈 디렉토리로 이동한다. |
cat
|
cat 명령 뒤에 파일 이름을 입력하면 그 파일의 내용을 출력한다.
- cat file1 file2 file3 여러 개의 파일을 전달하여 파일 내용을 연속해서 출력할 수 있다. - cat -n file1 file2 file3 cat 명령의 n 옵션을 사용하면 행 번호를 표시한다. |
file
|
file은 파일의 종류 확인 및 파일의 속성 값을 확인할 때 사용한다.
[옵션] -b : 지정한 파일명은 출력하지 않고 파일의 유형만 출력 -f : 파일목록에서 지정한 파일들에 대해서만 명령을 실행 -i : MIME 타입 문자로 출력 -L : 심볼릭 링크된 파일을 추적하여 원본 파일 정보를 출력 -m : 임의로 매직파일을 지정 -z : 압축된 파일의 내용을 출력 -v : 버전 정보를 출력 |
find
|
find는 파일 및 디렉토리를 검색할 때 사용한다.
-name : 지정된 문자열 패턴데 해당하는 파일 검색 -empty : 빈 디렉토리 또는 크기가 0인 파일 검색 -delete : 검색된 파일 또는 디렉토리 삭제 -exec : 검색된 파일에 대해 지정된 명령 실행 -path : 지정된 문자열 패턴에 해당하는 경로에서 검색 -print : 검색 결과를 출력 -size : 파일 크기를 사용하여 파일 검색 -type : 지정된 파일 타입에 해당하는 파일 검색 -atime : 파일 접근 시각을 기준으로 파일 검색 -ctime : 파일 내용 및 속성 변경 시각을 기준으로 파일 검색 -mtime : 파일의 데이터 수정 시각을 기준으로 파일 검색 |
- 리눅스 명령어에서 -(dash) 특수문자의 의미
dash는 옵션을 나타낼 때 사용되는 특수문자이다.
- 리눅스 숨김 파일
.으로 시작되는 파일은 숨김파일이다.
이를 보기 위해서는 ls -a 명령이 필요하다.
- 리눅스 파일 타입
파일의 종류에 관한 정보는 ls 명령어의 -l 옵션을 사용하여 출력되는 화면에 첫 번째 문자에서 확인할 수 있다.
-
|
일반 파일
|
d
|
디렉토리 파일
|
b
|
블록 디바이스 파일
|
c
|
문자 디바이스 파일
|
l
|
심볼릭 링크
|
- 리눅스 파일 권한(Permission)
리눅스는 하나의 컴퓨터를 여러 사람이 사용할 수 있는 멀티유저 운영체제이기 때문에 권한 관리가 굉장히 중요하다.
# 리눅스 파일, 디렉토리 권한 확인하기
ls -l명령을 사용하여 파일, 디렉토리 리스트를 출력하면 권한을 확인할 수 있다.
# 권한 구성은 총 10개의 문자로 구성되어 있고, 4개의 그룹으로 나뉜다.
1번째 문자 : -(파일이라는 표시), d(폴더/디렉토리라는 표시), l(링크라는 표시)
2~4번째 문자 : 파일 주인의 읽기, 쓰기, 실행하기 권한
5~7번째 문자 : 파일 주인이 속한 그룹의 읽기, 쓰기, 실행하기 권한
8~10번째 문자 : 그 외 유저들의 읽기, 쓰기, 실행하기 권한
# 권한 변경
chmod 명령어를 사용한다. chmod는 change mode의 약자이다.
--> chmod [변경하고자 하는 권한 값] [파일 혹은 디렉토리]
# 접근 권한
r
|
읽기
|
w
|
쓰기
|
x
|
실행하기
|
- 리눅스/etc/passwd 파일
리눅스/etc/passwd 파일에는 시스템에 등록된 사용자의 정보들이 담겨있다.
이를 이용하여 사용자의 계정과 인증을 관리한다.
각 필드들이 의미하는 바가 있으며, 각 필드는 콜론(:)으로 구분된다.
ex) root:x:0:0:root:/root:/bin/bashroot:x:0:0:root:/root:/bin/bash
사용자 계정명
|
맨 앞에 필드는 사용자의 계정명을 나타낸다.
|
패스워드
|
패스워드 필드로, /etc/shadow 파일에 암호화되어 있다.
|
UID
|
사용자의 user id를 나타낸다. 관리자 계정(root)는 UID는 0이다.
|
GID
|
사용자의 group id를 나타낸다. 관리자 그룹(root)의 GID는 0이다.
|
comment
|
사용자와 관련한 기타 정보를 나타낸다. 일반적으로 사용자의 이름을 나타낸다.
|
홈 디렉토리
|
사용자의 홈 디렉토리를 의미한다. 관리자 계정의 홈 디렉토리는 /root이다.
|
로그인 쉘
|
사용자가 로그인시에 사용할 쉘을 의미한다. 보통 사용자의 쉘은 성능이 우수한 bash 쉘을 사용한다.
|
'ETC > Hacking' 카테고리의 다른 글
[해킹] Bandit Level 22 ~ 26 단계 - 정리 (0) | 2021.11.24 |
---|---|
[해킹] Bandit Level 15 ~ 21 단계 - 정리 (0) | 2021.11.24 |
[해킹] Bandit Level 8 ~ 14 단계 - 정리 (0) | 2021.11.24 |