기본 콘텐츠로 건너뛰기

라벨이 Bandit인 게시물 표시

Bandit13

Bandit13 Bandit Level 13 bandit13@bandit:~$ ls -al total 24 drwxr-xr-x 2 root root 4096 Dec 28 14:34 . drwxr-xr-x 29 root root 4096 Dec 28 14:34 .. -rw-r--r-- 1 root root 220 Sep 1 2015 .bash_logout -rw-r--r-- 1 root root 3771 Sep 1 2015 .bashrc -rw-r--r-- 1 root root 655 Jun 24 2016 .profile -rw-r----- 1 bandit14 bandit13 1679 Dec 28 14:34 sshkey.private bandit14 계정 소유의 sshkey.private 파일이 디렉터리 내 존재하는 것을 확인할 수 있다. 이번 문제는 비밀번호 대신 sshkey.private 를 이용하여 ssh 접속을 하는 방법을 묻는 문제이다. man ssh 를 이용하면 -i 옵션을 확인할 수 있다. -i identity_file Selects a file from which the identity (private key) for public key authentication is read. The default is ~/.ssh/identity for protocol version 1, and ~/.ssh/id_dsa, ~/.ssh/id_ecdsa, ~/.ssh/id_ed25519 and ~/.ssh/id_rsa for protocol version 2. Identity files may also be specified on a per-host basis in the configuration file. It is possible to have multiple -i options (an

Bandit12

Bandit12 Bandit Level 12 이번 문제는 설명에서 확인할 수 있듯이 압축에 관련된 문제이다. 반복 압축된 파일을 file 명령어로 형식을 확인하며 압축 형식에 맞춰 해제시키면 된다. xxd , tar , gzip , bzip2 를 명령어 사용법을 익히는 것이 이번 문제에 목적이라고 볼 수 있다. hexdump로 파일 생성 bandit12@bandit:/tmp/bongbongco$ cp ~/data.txt . bandit12@bandit:/tmp/bongbongco$ cat data.txt 00000000: 1f8b 0808 ffb2 095a 0203 6461 7461 322e .. .. .. .Z .. data2. 00000010: 6269 6e00 0143 02bc fd42 5a68 3931 4159 bin .. C .. .BZh91AY 00000020: 2653 5915 1ab4 ec00 0016 ffff f9ef 39d7 & SY .. .. .. .. .. .9. 00000030: fd9f 55ff bf7d ebf7 7fb9 dfdf bb7b ddef .. U .. } .. .. .. . { .. 00000040: 5bff 9efd f5af 7fff defb ffbb b001 3b18 [ .. .. .. .. .. .. . ; . 00000050: a403 d41a 00d0 0000 0680 000d 0d06 9a06 .. .. .. .. .. .. .. .. 00000060: 8d00 f50d 01a0 001a 0003 2341 a683 4320 .. .. .. .. .. #A..C 00000070: 69ea 0323 4193 41a0 3653 434f 4880 d0d0 i .. #A.A.6SCOH... 00000080: 69a0 6434 00d0 01a3 200d 3400 6868 1a34 i.d4 .. .. .4.hh.4 00000090: d1a

Bandit11

Bandit11 Bandit Level 11 이번 level은 ROT13(13회 순환)된 대소문자를 원래대로 돌려 패스워드 값을 구하는 문제이다. tr 명령어를 사용하면 이를 쉽게 구할 수 있다. ascii table을 참고하면 13번째 문자는 n 이라는 것을 알 수 있다. 이를 참고하여 tr 명령어 구문을 구성해보자. ASCII Table Tables For convenience, below are more compact tables in hex and decimal. 2 3 4 5 6 7 30 40 50 60 70 80 90 100 110 120 ------------- --------------------------------- 0: 0 @ P ` p 0: ( 2 < F P Z d n x 1: ! 1 A Q a q 1: ) 3 = G Q [ e o y 2: " 2 B R b r 2: * 4 > H R \ f p z 3: # 3 C S c s 3: ! + 5 ? I S ] g q { 4: $ 4 D T d t 4: " , 6 @ J T ^ h r | 5: % 5 E U e u 5: # - 7 A K U _ i s } 6: & 6 F V f v 6: $ . 8 B L V ` j t ~ 7: ' 7 G W g w 7: % / 9 C M W a k u DEL 8: ( 8 H X h x 8: & 0 : D N X b l v 9: ) 9

Bandit10

Bandit10 Bandit Level 10 이번 level의 패스워드는 base64로 인코딩되어 있다. 간단히 base64 명령어를 이용하여 디코딩 후 패스워드를 얻을 수 있다. bandit10@bandit:~$ ls -al total 24 drwxr-xr-x 2 root root 4096 Nov 13 15:58 . drwxr-xr-x 29 root root 4096 Nov 13 15:57 .. -rw-r--r-- 1 root root 220 Sep 1 2015 .bash_logout -rw-r--r-- 1 root root 3771 Sep 1 2015 .bashrc -rw-r--r-- 1 root root 655 Jun 24 2016 .profile -rw-r----- 1 bandit11 bandit10 69 Nov 13 15:58 data.txt bandit10@bandit:~$ base64 -d data.txt The password is IFukwKGsFW8MOq3IRFqrxE1hxTNEbUPR

Bandit9

Bandit9 Bandit Level 9 data.txt 파일에서 = 으로 시작하는 문자열 중 이번 level의 패스워드가 있다. 우선 문자열 목록을 얻기 위해서는 strings 명령어를 사용해야한다. 그렇게 얻은 목록에서 grep 명령어를 이용하여 = 이 포함된 문자열을 추출해내면 패스워드를 확인할 수 있다. bandit9@bandit:~$ ls -al total 40 drwxr-xr-x 2 root root 4096 Nov 13 15:58 . drwxr-xr-x 29 root root 4096 Nov 13 15:57 .. -rw-r--r-- 1 root root 220 Sep 1 2015 .bash_logout -rw-r--r-- 1 root root 3771 Sep 1 2015 .bashrc -rw-r--r-- 1 root root 655 Jun 24 2016 .profile -rw-r----- 1 bandit10 bandit9 19379 Nov 13 15:58 data.txt bandit9@bandit:~$ strings data.txt | grep = == == == == == theOkM L = 8@ = hrV` == == == == == password == == == == == is H ) = QU > ] ".x = { = u/,i_ { = jh = GUl e = y: 4H5 = ) == == == == == truKLdjsbJ5g7yyJ2X2R0o3a5HQJFuLk = /wW ~BX =

Bandit8

Bandit8 Bandit Level 8 data.txt 에서 중복되지 않는 문자열이 이번 level의 패스워드이다. 중복 제거를 위해서 흔히 sort 와 uniq 를 활용한다. uniq [-c/d/D/u][파일 명] c: 중복 수 출력 d: 중복 라인 중 한 열만 출력 D: 중복되는 모든 열 출력 u: 중복 열이 없는 열만 출력 bandit8@bandit:~$ ls -al total 56 drwxr-xr-x 2 root root 4096 Nov 13 15:58 . drwxr-xr-x 29 root root 4096 Nov 13 15:57 .. -rw-r--r-- 1 root root 220 Sep 1 2015 .bash_logout -rw-r--r-- 1 root root 3771 Sep 1 2015 .bashrc -rw-r--r-- 1 root root 655 Jun 24 2016 .profile -rw-r----- 1 bandit9 bandit8 33033 Nov 13 15:58 data.txt bandit8@bandit:~$ cat data.txt | sort | uniq -u UsvVyFSfZZWbi6wgC7dAFyFuR6jQQUhR

Bandit7

Bandit7 Bandit Level 7 패스워드를 찾을 수 있는 단서 하나를 제공하고 있다. The password for the next level is stored in the file data.txt next to the word millionth grep 명령어를 이용하여 data.txt 파일에 저장된 millionth 문자열 위치를 찾고, 그 뒤에 삽입된 패스워드 를 확인한다. bandit7@bandit:~$ ls -al total 4108 drwxr-xr-x 2 root root 4096 Nov 13 15:58 . drwxr-xr-x 29 root root 4096 Nov 13 15:57 .. -rw-r--r-- 1 root root 220 Sep 1 2015 .bash_logout -rw-r--r-- 1 root root 3771 Sep 1 2015 .bashrc -rw-r--r-- 1 root root 655 Jun 24 2016 .profile -rw-r----- 1 bandit8 bandit7 4184396 Nov 13 15:58 data.txt bandit7@bandit:~$ grep -rn millionth ./data.txt 34210:millionth cvX2JJa4CFALtqS87jk27qwqGhBM9plV

Bandit6

Bandit6 Bandit Level 6 패스워드 파일을 찾을 수 있는 세 가지 단서를 제공하고 있다. owned by user bandit7 owned by group bandit6 33 bytes in size 이 정보를 조합하여 find 명령어를 구성하여 문제를 해결할 수 있다. -user [유저 명] -group [그룹 명] 2> /dev/null (/dev/null로 표준 에러 리다이렉트) bandit6@bandit:~$ find / -size 33c -user bandit7 -group bandit6 2 > /dev/null /var/lib/dpkg/info/bandit7.password bandit6@bandit:~$ cat /var/lib/dpkg/info/bandit7.password HKBPTKQnIay4Fw76bEy8PVxKEDQRKTzs

Bandit5

Bandit5 Bandit Level 5 패스워드 파일을 찾을 수 있는 세 가지 단서를 제공하고 있다. human-readable 1033 bytes in size not executable 이 정보를 조합하여 find 명령어를 구성하여 문제를 해결할 수 있다. -size [+파일크기/-파일크기/파일크기][b/c/k/w] b: 블록단위 512kb, c: byte, k: kbyte, w: 2byte 워드 (default: b) -perm [-][권한] ([-]: 최소한) -exec [command] {} ; bandit5@bandit:~/inhere$ ls -al total 88 drwxr-x--- 22 root bandit5 4096 Nov 13 15:58 . drwxr-xr-x 3 root root 4096 Nov 13 15:58 .. drwxr-x--- 2 root bandit5 4096 Nov 13 15:58 maybehere00 drwxr-x--- 2 root bandit5 4096 Nov 13 15:58 maybehere01 drwxr-x--- 2 root bandit5 4096 Nov 13 15:58 maybehere02 drwxr-x--- 2 root bandit5 4096 Nov 13 15:58 maybehere03 drwxr-x--- 2 root bandit5 4096 Nov 13 15:58 maybehere04 drwxr-x--- 2 root bandit5 4096 Nov 13 15:58 maybehere05 drwxr-x--- 2 root bandit5 4096 Nov 13 15:58 maybehere06 drwxr-x--- 2 root bandit5 4096 Nov 13 15:58 maybehere07 drwxr-x--- 2 root bandit5 4096 Nov 13 15:58 maybehere08 drwxr-x--- 2 root ba

Bandit4

Bandit4 Bandit Level 4 inhere 디렉터리 안에 파일들의 내용을 확인해보면 -file07 만이 내용을 제대로 출력하고 있다. 해당 파일이 이번 level의 해답이다. bandit4@bandit:~/inhere$ ls -al total 48 -rw-r----- 1 bandit5 bandit4 33 Nov 13 15:58 -file00 -rw-r----- 1 bandit5 bandit4 33 Nov 13 15:58 -file01 -rw-r----- 1 bandit5 bandit4 33 Nov 13 15:58 -file02 -rw-r----- 1 bandit5 bandit4 33 Nov 13 15:58 -file03 -rw-r----- 1 bandit5 bandit4 33 Nov 13 15:58 -file04 -rw-r----- 1 bandit5 bandit4 33 Nov 13 15:58 -file05 -rw-r----- 1 bandit5 bandit4 33 Nov 13 15:58 -file06 -rw-r----- 1 bandit5 bandit4 33 Nov 13 15:58 -file07 -rw-r----- 1 bandit5 bandit4 33 Nov 13 15:58 -file08 -rw-r----- 1 bandit5 bandit4 33 Nov 13 15:58 -file09 drwxr-xr-x 2 root root 4096 Nov 13 15:58 . drwxr-xr-x 3 root root 4096 Nov 13 15:58 .. bandit4@bandit:~/inhere$ cat ./ "-file07" koReBOKuIDDepwhWk7jZC0RTdopnAYKh

Bandit3

Bandit3 Bandit Level 3 inhere 폴더 안에 숨김 파일이 존재한다. ls 명령어를 -a 옵션 없이 사용하면 숨김 파일을 출력하지 않는다. 흔히 디렉터리 목록 출력을 위해 사용하는 ls -al 을 사용하여 숨김 파일 확인 후 cat 으로 파일 내용을 확인하자. bandit3@bandit:~$ ls -al total 24 drwxr-xr-x 3 root root 4096 Nov 13 15:58 . drwxr-xr-x 29 root root 4096 Nov 13 15:57 .. -rw-r--r-- 1 root root 220 Sep 1 2015 .bash_logout -rw-r--r-- 1 root root 3771 Sep 1 2015 .bashrc -rw-r--r-- 1 root root 655 Jun 24 2016 .profile drwxr-xr-x 2 root root 4096 Nov 13 15:58 inhere bandit3@bandit:~$ cd inhere/ bandit3@bandit:~/inhere$ ls -al total 12 drwxr-xr-x 2 root root 4096 Nov 13 15:58 . drwxr-xr-x 3 root root 4096 Nov 13 15:58 .. -rw-r----- 1 bandit4 bandit3 33 Nov 13 15:58 .hidden bandit3@bandit:~/inhere$ cat ./.hidden pIwrPrtPN36QITSp3EQaw936yaFoFgAB

Bandit2

Bandit2 Bandit Level 2 파일 명에 공백이 삽입되어 있을 경우 전체 파일 명을 싱글 쿼터 혹은 더블 쿼터로 묶어주거나 공백 앞에 역슬러시를 입력하여 처리한다. bandit2@bandit:~$ ls -al total 24 drwxr-xr-x 2 root root 4096 Nov 13 15:58 . drwxr-xr-x 29 root root 4096 Nov 13 15:57 .. -rw-r--r-- 1 root root 220 Sep 1 2015 .bash_logout -rw-r--r-- 1 root root 3771 Sep 1 2015 .bashrc -rw-r--r-- 1 root root 655 Jun 24 2016 .profile -rw-r----- 1 bandit3 bandit2 33 Nov 13 15:58 spaces in this filename bandit2@bandit:~$ cat 'spaces in this filename' UmHadQclWmgdLOKQ3YNgjWxGoRMb5luK bandit2@bandit:~$ cat "spaces in this filename" UmHadQclWmgdLOKQ3YNgjWxGoRMb5luK bandit2@bandit:~$ cat ./spaces\ in\ this\ filename UmHadQclWmgdLOKQ3YNgjWxGoRMb5luK

Bandit1

Bandit1 Bandit Level 1 level 0와 유사하게 파일 명이 - 라서 경로 없이 파일 명만 사용하면 내용이 출력되지 않으므로 절대 경로 혹은 상대 경로를 명시하여 cat 명령어로 읽으면 내용을 확인할 수 있다. bandit1@bandit:~$ ls -al total 24 -rw-r----- 1 bandit2 bandit1 33 Nov 13 15:58 - drwxr-xr-x 2 root root 4096 Nov 13 15:58 . drwxr-xr-x 29 root root 4096 Nov 13 15:57 .. -rw-r--r-- 1 root root 220 Sep 1 2015 .bash_logout -rw-r--r-- 1 root root 3771 Sep 1 2015 .bashrc -rw-r--r-- 1 root root 655 Jun 24 2016 .profile bandit1@bandit:~$ cat ./- CV1DtqXWVFXTvM2F0k09SHz0YwRINYA9

Bandit0

Bandit0 Bandit Level 0 OverTheWire - bandit 페이지에서 Level 0을 선택하여 제공된 SSH 서버에 접속하면 readme 파일을 확인할 수 있다. 간단히 출력하여 내용을 확인해보면 bandit1의 접속 패스워드 정보를 확인할 수 있다. bandit0@bandit:~$ ls readme bandit0@bandit:~$ cat readme boJ9jbbUNNfktd78OOpsqOltutMc3MY1