The password for the next level is stored in the file data.txt, which contains base64 encoded data
grep, sort, uniq, strings, base64, tr, tar, gzip, bzip2, xxd
bandit10@bandit:~$ cat data.txt
VGhlIHBhc3N3b3JkIGlzIGR0UjE3M2ZaS2IwUlJzREZTR3NnMlJXbnBOVmozcVJyCg==
bandit10@bandit:~$ base64 -d data.txt
The password is dtR173fZKb0RRsDFSGsg2RWnpNVj3qRr
bandit10@bandit:~$
The password for the next level is stored in the file data.txt, where all lowercase (a-z) and uppercase (A-Z) letters have been rotated by 13 positions
grep, sort, uniq, strings, base64, tr, tar, gzip, bzip2, xxd

bandit11@bandit:~$ cat data.txt |tr 'a-z' 'n-za-m'|tr 'A-Z' 'N-ZA-M'
The password is 7x16WNeHIi5YkIhWsfFIqoognUTyj9Q4
bandit11@bandit:~$
The password for the next level is stored in the file data.txt, which is a hexdump of a file that has been repeatedly compressed. For this level it may be useful to create a directory under /tmp in which you can work. Use mkdir with a hard to guess directory name. Or better, use the command “mktemp -d”. Then copy the datafile using cp, and rename it using mv (read the manpages!)
grep, sort, uniq, strings, base64, tr, tar, gzip, bzip2, xxd, mkdir, cp, mv, file
bandit12@bandit:~$ cat data.txt
00000000: 1f8b 0808 dfcd eb66 0203 6461 7461 322e .......f..data2.
00000010: 6269 6e00 013e 02c1 fd42 5a68 3931 4159 bin..>...BZh91AY
00000020: 2653 59ca 83b2 c100 0017 7fff dff3 f4a7 &SY.............
00000030: fc9f fefe f2f3 cffe f5ff ffdd bf7e 5bfe .............~[.
00000040: faff dfbe 97aa 6fff f0de edf7 b001 3b56 ......o.......;V
00000050: 0400 0034 d000 0000 0069 a1a1 a000 0343 ...4.....i.....C
00000060: 4686 4341 a680 068d 1a69 a0d0 0068 d1a0 F.CA.....i...h..
00000070: 1906 1193 0433 5193 d4c6 5103 4646 9a34 .....3Q...Q.FF.4
# ...
hexdump 라서, 역변환 시켜서 바이너리로 만들고 작업 진행해본다.
일단, 내 컴터가 아니라서, mktemp -d 로 temp 폴더 생성 후에 작업을 진행한다.
bandit12@bandit:~$ mktemp -d
/tmp/tmp.ZgKkkao5ZD
bandit12@bandit:~$
여기서 작업하란다. 파일을 copy 해서 작업 진행해보자.
hexdump 이므로, 원본 파일로 역변환 시킨다.
bandit12@bandit:~$ cp data.txt /tmp/tmp.ZgKkkao5ZD
bandit12@bandit:~$ cd /tmp/tmp.ZgKkkao5ZD
bandit12@bandit:/tmp/tmp.ZgKkkao5ZD$ ls
data.txt
bandit12@bandit:/tmp/tmp.ZgKkkao5ZD$ file data.txt
data.txt: ASCII text
bandit12@bandit:/tmp/tmp.ZgKkkao5ZD$ xxd -r data.txt > data.bin
파일 형태를 보니 gzip 이다. 압축 풀자.
bandit12@bandit:/tmp/tmp.ZgKkkao5ZD$ file data.bin
data.bin: gzip compressed data, was "data2.bin", last modified: Thu Sep 19 07:08:15 2024, max compression, from Unix, original size modulo 2^32 574
bandit12@bandit:/tmp/tmp.ZgKkkao5ZD$ mv data.bin data.gz
bandit12@bandit:/tmp/tmp.ZgKkkao5ZD$ gzip -d data.gz
bandit12@bandit:/tmp/tmp.ZgKkkao5ZD$ ls -alrt
total 17020
-rw-r----- 1 bandit12 bandit12 2583 Jan 15 07:43 data.txt
-rw-rw-r-- 1 bandit12 bandit12 574 Jan 15 07:43 data
drwx------ 2 bandit12 bandit12 4096 Jan 15 07:44 .
drwxrwx-wt 1 root root 17412096 Jan 15 07:45 ..
bandit12@bandit:/tmp/tmp.ZgKkkao5ZD$ file data
data: bzip2 compressed data, block size = 900k
bandit12@bandit:/tmp/tmp.ZgKkkao5ZD$
bandit12@bandit:/tmp/tmp.mCXPoksTDR$ cat data8.bin
The password is FO5dwFsc0cbaIiH0h8J2eUks2vdTDwAn
bandit12@bandit:/tmp/tmp.ZgKkkao5ZD$ bzip2 -d data
bzip2: Can't guess original name for data -- using data.out
bandit12@bandit:/tmp/tmp.ZgKkkao5ZD$ file data.out
data.out: gzip compressed data, was "data4.bin", last modified: Thu Sep 19 07:08:15 2024, max compression, from Unix, original size modulo 2^32 20480
bandit12@bandit:/tmp/tmp.ZgKkkao5ZD$ gzip -d data.out
gzip: data.out: unknown suffix -- ignored
bandit12@bandit:/tmp/tmp.ZgKkkao5ZD$ mv data.out data.gz
bandit12@bandit:/tmp/tmp.ZgKkkao5ZD$ gzip -d data.gz
bandit12@bandit:/tmp/tmp.ZgKkkao5ZD$ ls
data data.txt
bandit12@bandit:/tmp/tmp.ZgKkkao5ZD$ file data
data: POSIX tar archive (GNU)
bandit12@bandit:/tmp/tmp.ZgKkkao5ZD$ file data
data: POSIX tar archive (GNU)
bandit12@bandit:/tmp/tmp.ZgKkkao5ZD$ tar -xvf data
data5.bin
bandit12@bandit:/tmp/tmp.ZgKkkao5ZD$ file data5.bin
data5.bin: POSIX tar archive (GNU)
bandit12@bandit:/tmp/tmp.ZgKkkao5ZD$ tar -xvf data5.bin
data6.bin
bandit12@bandit:/tmp/tmp.ZgKkkao5ZD$ file data6.bin
data6.bin: bzip2 compressed data, block size = 900k
bandit12@bandit:/tmp/tmp.ZgKkkao5ZD$ bzip2 -d data6.bin
bzip2: Can't guess original name for data6.bin -- using data6.bin.out
bandit12@bandit:/tmp/tmp.ZgKkkao5ZD$ file data6.bin.out
data6.bin.out: POSIX tar archive (GNU)
bandit12@bandit:/tmp/tmp.ZgKkkao5ZD$ tar -xvf data6.bin.out
data8.bin
bandit12@bandit:/tmp/tmp.ZgKkkao5ZD$ file data8.bin
data8.bin: gzip compressed data, was "data9.bin", last modified: Thu Sep 19 07:08:15 2024, max compression, from Unix, original size modulo 2^32 49
bandit12@bandit:/tmp/tmp.ZgKkkao5ZD$ mv data8.bin data8.bin.gz
bandit12@bandit:/tmp/tmp.ZgKkkao5ZD$ gzip -d data8.bin.gz
bandit12@bandit:/tmp/tmp.ZgKkkao5ZD$
bandit12@bandit:/tmp/tmp.ZgKkkao5ZD$ cat data8.bin
The password is FO5dwFsc0cbaIiH0h8J2eUks2vdTDwAn
bandit12@bandit:/tmp/tmp.ZgKkkao5ZD$
ㅡㅡ 맞냐 이게.. 압축 풀고 풀고 또 풀고 풀엇다..
The password for the next level is stored in /etc/bandit_pass/bandit14 and can only be read by user bandit14. For this level, you don’t get the next password, but you get a private SSH key that can be used to log into the next level. Note: localhost is a hostname that refers to the machine you are working on
ssh, telnet, nc, openssl, s_client, nmap
bandit13@bandit:~$ ls
sshkey.private
bandit13@bandit:~$ ls -alrt
total 24
-rw-r--r-- 1 root root 807 Mar 31 2024 .profile
-rw-r--r-- 1 root root 3771 Mar 31 2024 .bashrc
-rw-r--r-- 1 root root 220 Mar 31 2024 .bash_logout
-rw-r----- 1 bandit14 bandit13 1679 Sep 19 07:08 sshkey.private
drwxr-xr-x 2 root root 4096 Sep 19 07:08 .
drwxr-xr-x 70 root root 4096 Sep 19 07:09 ..
bandit13@bandit:~$ cat sshkey.private
-----BEGIN RSA PRIVATE KEY-----
MIIEpAIBAAKCAQEAxkkOE83W2cOT7IWhFc9aPaaQmQDdgzuXCv+ppZHa++buSkN+
gg0tcr7Fw8NLGa5+Uzec2rEg0WmeevB13AIoYp0MZyETq46t+jk9puNwZwIt9XgB
ZufGtZEwWbFWw/vVLNwOXBe4UWStGRWzgPpEeSv5Tb1VjLZIBdGphTIK22Amz6Zb
ThMsiMnyJafEwJ/T8PQO3myS91vUHEuoOMAzoUID4kN0MEZ3+XahyK0HJVq68KsV
ObefXG1vvA3GAJ29kxJaqvRfgYnqZryWN7w3CHjNU4c/2Jkp+n8L0SnxaNA+WYA7
jiPyTF0is8uzMlYQ4l1Lzh/8/MpvhCQF8r22dwIDAQABAoIBAQC6dWBjhyEOzjeA
J3j/RWmap9M5zfJ/wb2bfidNpwbB8rsJ4sZIDZQ7XuIh4LfygoAQSS+bBw3RXvzE
pvJt3SmU8hIDuLsCjL1VnBY5pY7Bju8g8aR/3FyjyNAqx/TLfzlLYfOu7i9Jet67
xAh0tONG/u8FB5I3LAI2Vp6OviwvdWeC4nOxCthldpuPKNLA8rmMMVRTKQ+7T2VS
nXmwYckKUcUgzoVSp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.private bandit14@bandit.labs.overthewire.org -p 2220
The authenticity of host '[bandit.labs.overthewire.org]:2220 ([127.0.0.1]:2220)' can't be established.
ED25519 key fingerprint is SHA256:C2ihUBV7ihnV1wUXRb4RrEcLfXC5CXlhmAAM/urerLY.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Could not create directory '/home/bandit13/.ssh' (Permission denied).
Failed to add the host to the list of known hosts (/home/bandit13/.ssh/known_hosts).
_ _ _ _
| |__ __ _ _ __ __| (_) |_
| '_ \ / _` | '_ \ / _` | | __|
| |_) | (_| | | | | (_| | | |_
|_.__/ \__,_|_| |_|\__,_|_|\__|
This is an OverTheWire game server.
More information on http://www.overthewire.org/wargames
!!! You are trying to log into this SSH server with a password on port 2220 from localhost.
!!! Connecting from localhost is blocked to conserve resources.
!!! Please log out and log in again.
,----.. ,----, .---.
/ / \ ,/ .`| /. ./|
/ . : ,` .' : .--'. ' ;
. / ;. \ ; ; / /__./ \ : |
. ; / ` ; .'___,/ ,' .--'. ' \' .
; | ; \ ; | | : | /___/ \ | ' '
| : | ; | ' ; |.'; ; ; \ \; :
. | ' ' ' : `----' | | \ ; ` |
' ; \; / | ' : ; . \ .\ ;
\ \ ', / | | ' \ \ ' \ |
; : / ' : | : ' |--"
\ \ .' ; |.' \ \ ;
www. `---` ver '---' he '---" ire.org
Welcome to OverTheWire!
If you find any problems, please report them to the #wargames channel on
discord or IRC.
--[ 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/ is disabled and to /proc
restricted so that users cannot snoop on eachother. Files and directories
with easily guessable or short names will be periodically deleted! The /tmp
directory is regularly wiped.
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 useful tools which you can find
in the following locations:
* gef (https://github.com/hugsy/gef) in /opt/gef/
* pwndbg (https://github.com/pwndbg/pwndbg) in /opt/pwndbg/
* gdbinit (https://github.com/gdbinit/Gdbinit) in /opt/gdbinit/
* pwntools (https://github.com/Gallopsled/pwntools)
* radare2 (http://www.radare.org/)
--[ More information ]--
For more information regarding individual wargames, visit
http://www.overthewire.org/wargames/
For support, questions or comments, contact us on discord or IRC.
Enjoy your stay!
bandit14@bandit:~$ id
uid=11014(bandit14) gid=11014(bandit14) groups=11014(bandit14)
bandit14@bandit:~$
bandit14@bandit:~$ cat /etc/bandit_pass/bandit14
MU4VWeTyJk8ROof1qqmcBPaLh7lDCPvS
bandit14@bandit:~$
The password for the next level can be retrieved by submitting the password of the current level to port 30000 on localhost.
ssh, telnet, nc, openssl, s_client, nmap
bandit14@bandit:~/.ssh$ cat /etc/bandit_pass/bandit14 |nc localhost 30000
Correct!
8xCjnmgoKbGLhHFAZlGE5Tmu4M2tKJQo
bandit14@bandit:~/.ssh$
bandit14@bandit:~/.ssh$ nc -l 33333 # 1
MU4VWeTyJk8ROof1qqmcBPaLh7lDCPvS # 3
bandit14@bandit:~$ cat /etc/bandit_pass/bandit14 |nc localhost 33333 # 2
The password for the next level can be retrieved by submitting the password of the current level to port 30001 on localhost using SSL/TLS encryption.
Helpful note: Getting “DONE”, “RENEGOTIATING” or “KEYUPDATE”? Read the “CONNECTED COMMANDS” section in the manpage.
ssh, telnet, nc, ncat, socat, openssl, s_client, nmap, netstat, ss
bandit15@bandit:~$ cat /etc/bandit_pass/bandit15
8xCjnmgoKbGLhHFAZlGE5Tmu4M2tKJQo
bandit15@bandit:~$
https://nmap.org/ncat/guide/ncat-ssl.html
bandit15@bandit:~$ ncat -v --listen --ssl localhost 30001
Ncat: Version 7.94SVN ( https://nmap.org/ncat )
Ncat: Generating a temporary 2048-bit RSA key. Use --ssl-key and --ssl-cert to use a permanent one.
Ncat: SHA-1 fingerprint: DC14 AF29 75DE D9D1 DB61 2314 9C75 3139 FCF7 7A4C
Ncat: bind to 127.0.0.1:30001: Address already in use. QUITTING.
bandit15@bandit:~$
bandit15@bandit:~$ ncat localhost 30001 --ssl
8xCjnmgoKbGLhHFAZlGE5Tmu4M2tKJQo
Correct!
kSkvUpMQ7lBYyCM4GBPvCvT1BfWRy0Dx
bandit15@bandit:~$ ncat localhost 30001 --ssl < /etc/bandit_pass/bandit15
Correct!
kSkvUpMQ7lBYyCM4GBPvCvT1BfWRy0Dx
bandit15@bandit:~$
The credentials for the next level can be retrieved by submitting the password of the current level to a port on localhost in the range 31000 to 32000. First find out which of these ports have a server listening on them. Then find out which of those speak SSL/TLS and which don’t. There is only 1 server that will give the next credentials, the others will simply send back to you whatever you send to it.
Helpful note: Getting “DONE”, “RENEGOTIATING” or “KEYUPDATE”? Read the “CONNECTED COMMANDS” section in the manpage.
ssh, telnet, nc, ncat, socat, openssl, s_client, nmap, netstat, ss
bandit16@bandit:~$ nc -z localhost -z 31000-32000
Connection to localhost (127.0.0.1) 31046 port [tcp/*] succeeded!
Connection to localhost (127.0.0.1) 31518 port [tcp/*] succeeded!
Connection to localhost (127.0.0.1) 31691 port [tcp/*] succeeded!
Connection to localhost (127.0.0.1) 31790 port [tcp/*] succeeded!
Connection to localhost (127.0.0.1) 31960 port [tcp/*] succeeded!
bandit16@bandit:~$
openssl s_client -connect localhost:31046 -tls1_2
bandit16@bandit:~$ openssl s_client -connect localhost:31046 -tls1_2
CONNECTED(00000003)
4087F0F7FF7F0000:error:0A0000F4:SSL routines:ossl_statem_client_read_transition:unexpected message:../ssl/statem/statem_clnt.c:398:
---
no peer certificate available
---
No client certificate CA names sent
---
SSL handshake has read 188 bytes and written 195 bytes
Verification: OK
---
New, (NONE), Cipher is (NONE)
Secure Renegotiation IS NOT supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
SSL-Session:
Protocol : TLSv1.2
Cipher : 0000
Session-ID:
Session-ID-ctx:
Master-Key:
PSK identity: None
PSK identity hint: None
SRP username: None
Start Time: 1736933000
Timeout : 7200 (sec)
Verify return code: 0 (ok)
Extended master secret: no
---
openssl s_client -connect localhost:31518 -tls1_2
bandit16@bandit:~$ openssl s_client -connect localhost:31518 -tls1_2
CONNECTED(00000003)
Can't use SSL_get_servername
depth=0 CN = SnakeOil
verify error:num=18:self-signed certificate
verify return:1
depth=0 CN = SnakeOil
verify return:1
---
Certificate chain
0 s:CN = SnakeOil
i:CN = SnakeOil
a:PKEY: rsaEncryption, 4096 (bit); sigalg: RSA-SHA256
v:NotBefore: Jun 10 03:59:50 2024 GMT; NotAfter: Jun 8 03:59:50 2034 GMT
---
Server certificate
-----BEGIN CERTIFICATE-----
MIIFBzCCAu+gAwIBAgIUBLz7DBxA0IfojaL/WaJzE6Sbz7cwDQYJKoZIhvcNAQEL
BQAwEzERMA8GA1UEAwwIU25ha2VPaWwwHhcNMjQwNjEwMDM1OTUwWhcNMzQwNjA4
MDM1OTUwWjATMREwDwYDVQQDDAhTbmFrZU9pbDCCAiIwDQYJKoZIhvcNAQEBBQAD
ggIPADCCAgoCggIBANI+P5QXm9Bj21FIPsQqbqZRb5XmSZZJYaam7EIJ16Fxedf+
jXAv4d/FVqiEM4BuSNsNMeBMx2Gq0lAfN33h+RMTjRoMb8yBsZsC063MLfXCk4p+
09gtGP7BS6Iy5XdmfY/fPHvA3JDEScdlDDmd6Lsbdwhv93Q8M6POVO9sv4HuS4t/
jEjr+NhE+Bjr/wDbyg7GL71BP1WPZpQnRE4OzoSrt5+bZVLvODWUFwinB0fLaGRk
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oEJi0C+UPwS8CDngJB4TyrZqEld3
rH87W+Et1t/Nepoc/Eoaux9PFp5VPXP+qwQGmhir/hv7OsgBhrkYuhkjxZ8+1uk7
tUWC/XM0mpLoxsq6vVl3AJaJe1ivdA9xLytsuG4iv02Juc593HXYR8yOpow0Eq2T
U5EyeuFg5RXYwAPi7ykw1PW7zAPL4MlonEVz+QXOSx6eyhimp1VZC11SCg==
-----END CERTIFICATE-----
subject=CN = SnakeOil
issuer=CN = SnakeOil
---
No client certificate CA names sent
Peer signing digest: SHA256
Peer signature type: RSA-PSS
Server Temp Key: X25519, 253 bits
---
SSL handshake has read 2204 bytes and written 281 bytes
Verification error: self-signed certificate
---
New, TLSv1.2, Cipher is ECDHE-RSA-AES256-GCM-SHA384
Server public key is 4096 bit
Secure Renegotiation IS supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
SSL-Session:
Protocol : TLSv1.2
Cipher : ECDHE-RSA-AES256-GCM-SHA384
Session-ID: 551574E502B1CF3ADD19D75053DE0AD012F96B34E92D7386323B9AFDA4D3A3C1
Session-ID-ctx:
Master-Key: AA57CF62A57F446BD2C80038DD7527C40E8D679A620B423459474D396C241FC5D66BFBC71C2758BDDE190E4D42DDAC8D
PSK identity: None
PSK identity hint: None
SRP username: None
TLS session ticket lifetime hint: 300 (seconds)
TLS session ticket:
0000 - f5 2e 5d ba ef 90 54 8c-02 38 66 57 1d 09 df 31 ..]...T..8fW...1
0010 - 03 a2 4a d7 7f c3 74 e1-3e 1a 23 34 09 3f 38 e6 ..J...t.>.#4.?8.
0020 - 68 0a e6 46 dd 49 7d b5-99 64 8d 8a 90 fc b7 77 h..F.I}..d.....w
0030 - 63 26 9f 0f 72 56 fb 43-38 6a f1 7c 9b 22 19 78 c&..rV.C8j.|.".x
0040 - 12 0f df 97 bc 3a 41 c9-b8 dc bb 8b b5 9e b9 bb .....:A.........
0050 - 30 fc 31 ab f3 67 0d c0-c4 61 74 76 cc 46 ef 36 0.1..g...atv.F.6
0060 - a7 53 eb d7 99 c8 70 e2-03 e8 cb f5 e9 d1 57 4b .S....p.......WK
0070 - 40 eb e8 76 99 08 7a 12-43 73 2a 5b 22 e1 a9 62 @..v..z.Cs*["..b
0080 - 98 9a 9c 9b 94 7a e3 5b-87 f3 17 18 ec 43 c8 69 .....z.[.....C.i
0090 - 61 d9 5a b8 a9 20 d9 0c-5d cf e6 79 86 77 78 40 a.Z.. ..]..y.wx@
00a0 - e0 9e 7e 3c 53 15 12 55-2b 39 08 a5 b4 9f 1e 45 ..~<S..U+9.....E
00b0 - e1 4b e1 58 54 3c 6a 80-a9 2e 97 a1 83 7a d8 7a .K.XT<j......z.z
Start Time: 1736933036
Timeout : 7200 (sec)
Verify return code: 18 (self-signed certificate)
Extended master secret: yes
---
test
test
openssl s_client -connect localhost:31691 -tls1_2
bandit16@bandit:~$ openssl s_client -connect localhost:31691 -tls1_2
CONNECTED(00000003)
4087F0F7FF7F0000:error:0A0000F4:SSL routines:ossl_statem_client_read_transition:unexpected message:../ssl/statem/statem_clnt.c:398:
---
no peer certificate available
---
No client certificate CA names sent
---
SSL handshake has read 188 bytes and written 195 bytes
Verification: OK
---
New, (NONE), Cipher is (NONE)
Secure Renegotiation IS NOT supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
SSL-Session:
Protocol : TLSv1.2
Cipher : 0000
Session-ID:
Session-ID-ctx:
Master-Key:
PSK identity: None
PSK identity hint: None
SRP username: None
Start Time: 1736933076
Timeout : 7200 (sec)
Verify return code: 0 (ok)
Extended master secret: no
---
bandit16@bandit:~$
openssl s_client -connect localhost:31790 -tls1_2
bandit16@bandit:~$ openssl s_client -connect localhost:31790 -tls1_2
CONNECTED(00000003)
Can't use SSL_get_servername
depth=0 CN = SnakeOil
verify error:num=18:self-signed certificate
verify return:1
depth=0 CN = SnakeOil
verify return:1
---
Certificate chain
0 s:CN = SnakeOil
i:CN = SnakeOil
a:PKEY: rsaEncryption, 4096 (bit); sigalg: RSA-SHA256
v:NotBefore: Jun 10 03:59:50 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BAf8EBTADAQH/MA0GCSqGSIb3
DQEBCwUAA4ICAQAKHomtmcGqyiLnhziLe97Mq2+Sul5QgYVwfx/KYOXxv2T8ZmcR
Ae9XFhZT4jsAOUDK1OXx9aZgDGJHJLNEVTe9zWv1ONFfNxEBxQgP7hhmDBWdtj6d
taqEW/Jp06X+08BtnYK9NZsvDg2YRcvOHConeMjwvEL7tQK0m+GVyQfLYg6jnrhx
egH+abucTKxabFcWSE+Vk0uJYMqcbXvB4WNKz9vj4V5Hn7/DN4xIjFko+nREw6Oa
/AUFjNnO/FPjap+d68H1LdzMH3PSs+yjGid+6Zx9FCnt9qZydW13Miqg3nDnODXw
+Z682mQFjVlGPCA5ZOQbyMKY4tNazG2n8qy2famQT3+jF8Lb6a4NGbnpeWnLMkIu
jWLWIkA9MlbdNXuajiPNVyYIK9gdoBzbfaKwoOfSsLxEqlf8rio1GGcEV5Hlz5S2
txwI0xdW9MWeGWoiLbZSbRJH4TIBFFtoBG0LoEJi0C+UPwS8CDngJB4TyrZqEld3
rH87W+Et1t/Nepoc/Eoaux9PFp5VPXP+qwQGmhir/hv7OsgBhrkYuhkjxZ8+1uk7
tUWC/XM0mpLoxsq6vVl3AJaJe1ivdA9xLytsuG4iv02Juc593HXYR8yOpow0Eq2T
U5EyeuFg5RXYwAPi7ykw1PW7zAPL4MlonEVz+QXOSx6eyhimp1VZC11SCg==
-----END CERTIFICATE-----
subject=CN = SnakeOil
issuer=CN = SnakeOil
---
No client certificate CA names sent
Peer signing digest: SHA256
Peer signature type: RSA-PSS
Server Temp Key: X25519, 253 bits
---
SSL handshake has read 2204 bytes and written 281 bytes
Verification error: self-signed certificate
---
New, TLSv1.2, Cipher is ECDHE-RSA-AES256-GCM-SHA384
Server public key is 4096 bit
Secure Renegotiation IS supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
SSL-Session:
Protocol : TLSv1.2
Cipher : ECDHE-RSA-AES256-GCM-SHA384
Session-ID: 85E619AE9118609BA73295A12068029E74597569C45D893E7968D8F388DF4B23
Session-ID-ctx:
Master-Key: 473ACCBE9BC2D9462CB92A5B80BCD9838E87D144B083554D2A9D63CF6D48BD52CA456AC80DF9D866301949164E3C2582
PSK identity: None
PSK identity hint: None
SRP username: None
TLS session ticket lifetime hint: 300 (seconds)
TLS session ticket:
0000 - 61 09 f3 e8 db 95 d3 cc-35 83 2c 95 ea ad 5f 0c a.......5.,..._.
0010 - 35 a4 fe cd c2 d4 6b 48-9c 68 26 c5 ac 3d e2 ee 5.....kH.h&..=..
0020 - b1 4b dc 3b 44 e3 1b b0-20 f2 da 6e ec 22 66 18 .K.;D... ..n."f.
0030 - 62 44 ac 5a 9c 2a e7 d4-c6 40 ec c9 8e 17 78 94 bD.Z.*...@....x.
0040 - 49 48 52 e7 44 29 3d 27-4f a1 83 d6 b1 14 dd 03 IHR.D)='O.......
0050 - 02 0b 0a ac 6f 95 f6 a6-f4 13 e5 c3 af 81 c3 97 ....o...........
0060 - 70 e2 f2 92 a8 f2 33 b7-91 92 15 cc 43 c9 2d 7d p.....3.....C.-}
0070 - a9 73 17 c1 b9 95 77 85-aa f1 47 19 db 88 df 6a .s....w...G....j
0080 - b2 06 6d 8d 2d a3 10 b5-19 af 74 26 cd 2c 44 74 ..m.-.....t&.,Dt
0090 - f0 d4 66 82 4b 48 58 45-ee ed 0c 7d 94 22 c7 83 ..f.KHXE...}."..
00a0 - 37 d9 10 35 6d 61 ed ec-09 0c 3e 48 de 77 29 b2 7..5ma....>H.w).
00b0 - 6b 25 4c 66 92 f4 a8 6b-c3 4a 40 2c 0e 6e 8c 46 k%Lf...k.J@,.n.F
Start Time: 1736933123
Timeout : 7200 (sec)
Verify return code: 18 (self-signed certificate)
Extended master secret: yes
---
test
Wrong! Please enter the correct current password.
closed
openssl s_client -connect localhost:31960 -tls1_2
bandit16@bandit:~$ openssl s_client -connect localhost:31960 -tls1_2
CONNECTED(00000003)
4087F0F7FF7F0000:error:0A0000F4:SSL routines:ossl_statem_client_read_transition:unexpected message:../ssl/statem/statem_clnt.c:398:
---
no peer certificate available
---
No client certificate CA names sent
---
SSL handshake has read 188 bytes and written 195 bytes
Verification: OK
---
New, (NONE), Cipher is (NONE)
Secure Renegotiation IS NOT supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
SSL-Session:
Protocol : TLSv1.2
Cipher : 0000
Session-ID:
Session-ID-ctx:
Master-Key:
PSK identity: None
PSK identity hint: None
SRP username: None
Start Time: 1736933179
Timeout : 7200 (sec)
Verify return code: 0 (ok)
Extended master secret: no
---
bandit16@bandit:~$
두 port 의 server 가 ssl 연결.
openssl s_client -connect localhost:31518 -tls1_2
openssl s_client -connect localhost:31790 -tls1_2
password 에 관하 말해주는 포트는 31790 따라서
bandit16@bandit:~$ cat /etc/bandit_pass/bandit16
kSkvUpMQ7lBYyCM4GBPvCvT1BfWRy0Dx
bandit16@bandit:~$
Start Time: 1736934201
Timeout : 7200 (sec)
Verify return code: 18 (self-signed certificate)
Extended master secret: yes
---
kSkvUpMQ7lBYyCM4GBPvCvT1BfWRy0Dx
KEYUPDATE
4087F0F7FF7F0000:error:0A00010A:SSL routines:SSL_key_update:wrong ssl version:../ssl/ssl_lib.c:2286:
bandit16@bandit:~$
bandit16@bandit:~$ openssl s_client -connect localhost:31790 -tls1_2 -ign_eof
#...
---
kSkvUpMQ7lBYyCM4GBPvCvT1BfWRy0Dx
Correct!
-----BEGIN RSA PRIVATE KEY-----
MIIEogIBAAKCAQEAvmOkuifmMg6HL2YPIOjon6iWfbp7c3jx34YkYWqUH57SUdyJ
imZzeyGC0gtZPGujUSxiJSWI/oTqexh+cAMTSMlOJf7+BrJObArnxd9Y7YT2bRPQ
Ja6Lzb558YW3FZl87ORiO+rW4LCDCNd2lUvLE/GL2GWyuKN0K5iCd5TbtJzEkQTu
DSt2mcNn4rhAL+JFr56o4T6z8WWAW18BR6yGrMq7Q/kALHYW3OekePQAzL0VUYbW
JGTi65CxbCnzc/w4+mqQyvmzpWtMAzJTzAzQxNbkR2MBGySxDLrjg0LWN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pxm0TSgyvmfLF2MIAEwyzRqaM
77pBAoGAMmjmIJdjp+Ez8duyn3ieo36yrttF5NSsJLAbxFpdlc1gvtGCWW+9Cq0b
dxviW8+TFVEBl1O4f7HVm6EpTscdDxU+bCXWkfjuRb7Dy9GOtt9JPsX8MBTakzh3
vBgsyi/sN3RqRBcGU40fOoZyfAMT8s1m/uYv52O6IgeuZ/ujbjY=
-----END RSA PRIVATE KEY-----
closed
bandit16@bandit:~$
bandit16@bandit:/tmp/tmp.ZJ91CRV3oB$ ssh -i ./sshkey.private bandit17@bandit.labs.overthewire.org -p 2220
The authenticity of host '[bandit.labs.overthewire.org]:2220 ([127.0.0.1]:2220)' can't be established.
ED25519 key fingerprint is SHA256:C2ihUBV7ihnV1wUXRb4RrEcLfXC5CXlhmAAM/urerLY.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Could not create directory '/home/bandit16/.ssh' (Permission denied).
Failed to add the host to the list of known hosts (/home/bandit16/.ssh/known_hosts).
_ _ _ _
| |__ __ _ _ __ __| (_) |_
| '_ \ / _` | '_ \ / _` | | __|
| |_) | (_| | | | | (_| | | |_
|_.__/ \__,_|_| |_|\__,_|_|\__|
This is an OverTheWire game server.
More information on http://www.overthewire.org/wargames
!!! You are trying to log into this SSH server with a password on port 2220 from localhost.
!!! Connecting from localhost is blocked to conserve resources.
!!! Please log out and log in again.
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: UNPROTECTED PRIVATE KEY FILE! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0664 for './sshkey.private' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
Load key "./sshkey.private": bad permissions
664 권한을 내려서 보안을 낮춰보자.
bandit16@bandit:/tmp/tmp.ZJ91CRV3oB$ chmod 400 sshkey.private
bandit16@bandit:/tmp/tmp.ZJ91CRV3oB$ ssh -i ./sshkey.private bandit17@bandit.labs.overthewire.org -p 2220
The authenticity of host '[bandit.labs.overthewire.org]:2220 ([127.0.0.1]:2220)' can't be established.
ED25519 key fingerprint is SHA256:C2ihUBV7ihnV1wUXRb4RrEcLfXC5CXlhmAAM/urerLY.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Could not create directory '/home/bandit16/.ssh' (Permission denied).
Failed to add the host to the list of known hosts (/home/bandit16/.ssh/known_hosts).
_ _ _ _
| |__ __ _ _ __ __| (_) |_
| '_ \ / _` | '_ \ / _` | | __|
| |_) | (_| | | | | (_| | | |_
|_.__/ \__,_|_| |_|\__,_|_|\__|
This is an OverTheWire game server.
More information on http://www.overthewire.org/wargames
!!! You are trying to log into this SSH server with a password on port 2220 from localhost.
!!! Connecting from localhost is blocked to conserve resources.
!!! Please log out and log in again.
,----.. ,----, .---.
/ / \ ,/ .`| /. ./|
/ . : ,` .' : .--'. ' ;
. / ;. \ ; ; / /__./ \ : |
. ; / ` ; .'___,/ ,' .--'. ' \' .
; | ; \ ; | | : | /___/ \ | ' '
| : | ; | ' ; |.'; ; ; \ \; :
. | ' ' ' : `----' | | \ ; ` |
' ; \; / | ' : ; . \ .\ ;
\ \ ', / | | ' \ \ ' \ |
; : / ' : | : ' |--"
\ \ .' ; |.' \ \ ;
www. `---` ver '---' he '---" ire.org
Welcome to OverTheWire!
If you find any problems, please report them to the #wargames channel on
discord or IRC.
--[ 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/ is disabled and to /proc
restricted so that users cannot snoop on eachother. Files and directories
with easily guessable or short names will be periodically deleted! The /tmp
directory is regularly wiped.
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 useful tools which you can find
in the following locations:
* gef (https://github.com/hugsy/gef) in /opt/gef/
* pwndbg (https://github.com/pwndbg/pwndbg) in /opt/pwndbg/
* gdbinit (https://github.com/gdbinit/Gdbinit) in /opt/gdbinit/
* pwntools (https://github.com/Gallopsled/pwntools)
* radare2 (http://www.radare.org/)
--[ More information ]--
For more information regarding individual wargames, visit
http://www.overthewire.org/wargames/
For support, questions or comments, contact us on discord or IRC.
Enjoy your stay!
bandit17@bandit:~$
bandit17@bandit:~$ cat /etc/bandit_pass/bandit17
EReVavePLFHtFlFsjn3hyzMlvSuSAcRD
bandit17@bandit:~$
There are 2 files in the homedirectory: passwords.old and passwords.new. The password for the next level is in passwords.new and is the only line that has been changed between passwords.old and passwords.new
NOTE: if you have solved this level and see ‘Byebye!’ when trying to log into bandit18, this is related to the next level, bandit19
cat, grep, ls, diff
bandit17@bandit:~$ ls -alrt
total 36
-rw-r--r-- 1 root root 807 Mar 31 2024 .profile
-rw-r--r-- 1 root root 3771 Mar 31 2024 .bashrc
-rw-r--r-- 1 root root 220 Mar 31 2024 .bash_logout
-rw-r----- 1 bandit17 bandit17 33 Sep 19 07:08 .bandit16.password
drwxr-xr-x 2 root root 4096 Sep 19 07:08 .ssh
-rw-r----- 1 bandit18 bandit17 3300 Sep 19 07:08 passwords.old
-rw-r----- 1 bandit18 bandit17 3300 Sep 19 07:08 passwords.new
drwxr-xr-x 3 root root 4096 Sep 19 07:08 .
drwxr-xr-x 70 root root 4096 Sep 19 07:09 ..
bandit17@bandit:~$
bandit17@bandit:~$ diff passwords.old passwords.new
42c42
< ktfgBvpMzWKR5ENj26IbLGSblgUG9CzB
---
> x2gLTTjFwMOhQ8oWNbMN362QKxfRqGlO
bandit17@bandit:~$
bye bye 에서 window 에서 접속.
> ssh -p 2220 bandit18@bandit.labs.overthewire.org
_ _ _ _
| |__ __ _ _ __ __| (_) |_
| '_ \ / _` | '_ \ / _` | | __|
| |_) | (_| | | | | (_| | | |_
|_.__/ \__,_|_| |_|\__,_|_|\__|
This is an OverTheWire game server.
More information on http://www.overthewire.org/wargames
bandit18@bandit.labs.overthewire.org's password:
,----.. ,----, .---.
/ / \ ,/ .`| /. ./|
/ . : ,` .' : .--'. ' ;
. / ;. \ ; ; / /__./ \ : |
. ; / ` ; .'___,/ ,' .--'. ' \' .
; | ; \ ; | | : | /___/ \ | ' '
| : | ; | ' ; |.'; ; ; \ \; :
. | ' ' ' : `----' | | \ ; ` |
' ; \; / | ' : ; . \ .\ ;
\ \ ', / | | ' \ \ ' \ |
; : / ' : | : ' |--"
\ \ .' ; |.' \ \ ;
www. `---` ver '---' he '---" ire.org
Welcome to OverTheWire!
If you find any problems, please report them to the #wargames channel on
discord or IRC.
--[ 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/ is disabled and to /proc
restricted so that users cannot snoop on eachother. Files and directories
with easily guessable or short names will be periodically deleted! The /tmp
directory is regularly wiped.
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 useful tools which you can find
in the following locations:
* gef (https://github.com/hugsy/gef) in /opt/gef/
* pwndbg (https://github.com/pwndbg/pwndbg) in /opt/pwndbg/
* gdbinit (https://github.com/gdbinit/Gdbinit) in /opt/gdbinit/
* pwntools (https://github.com/Gallopsled/pwntools)
* radare2 (http://www.radare.org/)
--[ More information ]--
For more information regarding individual wargames, visit
http://www.overthewire.org/wargames/
For support, questions or comments, contact us on discord or IRC.
Enjoy your stay!
Byebye !
Connection to bandit.labs.overthewire.org closed.
이렇게 끊어져서 cat /etc/bandit_pass/bandit18 알려준다.
> ssh -p 2220 bandit18@bandit.labs.overthewire.org "cat /etc/bandit_pass/bandit18"
_ _ _ _
| |__ __ _ _ __ __| (_) |_
| '_ \ / _` | '_ \ / _` | | __|
| |_) | (_| | | | | (_| | | |_
|_.__/ \__,_|_| |_|\__,_|_|\__|
This is an OverTheWire game server.
More information on http://www.overthewire.org/wargames
bandit18@bandit.labs.overthewire.org's password:
x2gLTTjFwMOhQ8oWNbMN362QKxfRqGlO
비번 맞는지 확인 됬고,
bandit17@bandit:~$ diff passwords.old passwords.new
42c42
< ktfgBvpMzWKR5ENj26IbLGSblgUG9CzB
---
> x2gLTTjFwMOhQ8oWNbMN362QKxfRqGlO
bandit17@bandit:~$
The password for the next level is stored in a file readme in the homedirectory. Unfortunately, someone has modified .bashrc to log you out when you log in with SSH.
ssh, ls, cat
bandit18 비번으로는 들어가면 끊어지니, bandit17 에서 18의 파일 구조를 본다.
bandit17@bandit:~$ ls -al /home/bandit18/*
-rw-r----- 1 bandit19 bandit18 33 Sep 19 07:08 /home/bandit18/readme
bandit17@bandit:~$
C:\Users\d4r6j>ssh -p 2220 bandit18@bandit.labs.overthewire.org "cat /home/bandit18/readme"
_ _ _ _
| |__ __ _ _ __ __| (_) |_
| '_ \ / _` | '_ \ / _` | | __|
| |_) | (_| | | | | (_| | | |_
|_.__/ \__,_|_| |_|\__,_|_|\__|
This is an OverTheWire game server.
More information on http://www.overthewire.org/wargames
bandit18@bandit.labs.overthewire.org's password:
cGWpMaKXVwDUNgPAVJbWYuGHVn9zl3j8
ㅡㅡ^ 19번 비번 문제.
To gain access to the next level, you should use the setuid binary in the homedirectory. Execute it without arguments to find out how to use it. The password for this level can be found in the usual place (/etc/bandit_pass), after you have used the setuid binary.
bandit19@bandit:~$ ls -al
total 36
drwxr-xr-x 2 root root 4096 Sep 19 07:08 .
drwxr-xr-x 70 root root 4096 Sep 19 07:09 ..
-rwsr-x--- 1 bandit20 bandit19 14880 Sep 19 07:08 bandit20-do
-rw-r--r-- 1 root root 220 Mar 31 2024 .bash_logout
-rw-r--r-- 1 root root 3771 Mar 31 2024 .bashrc
-rw-r--r-- 1 root root 807 Mar 31 2024 .profile
bandit19@bandit:~$
setuid 설정이 되어 있다. 실행 시 bandit20 의 user 권한을 갖는다.
-r-------- 1 bandit19 bandit19 33 Sep 19 07:07 /etc/bandit_pass/bandit19
-r-------- 1 bandit20 bandit20 33 Sep 19 07:07 /etc/bandit_pass/bandit20
group 도 볼 수가 없고, user 만 볼 수 있다.
bandit19@bandit:~$ ./bandit20-do ls -al
total 36
drwxr-xr-x 2 root root 4096 Sep 19 07:08 .
drwxr-xr-x 70 root root 4096 Sep 19 07:09 ..
-rwsr-x--- 1 bandit20 bandit19 14880 Sep 19 07:08 bandit20-do
-rw-r--r-- 1 root root 220 Mar 31 2024 .bash_logout
-rw-r--r-- 1 root root 3771 Mar 31 2024 .bashrc
-rw-r--r-- 1 root root 807 Mar 31 2024 .profile
bandit19@bandit:~$
그냥 명령어 실행 같은데, 좀 더 들어가 보자.
(gdb) disassemble main
Dump of assembler code for function main:
0x08049186 <+0>: lea 0x4(%esp),%ecx
0x0804918a <+4>: and $0xfffffff0,%esp
0x0804918d <+7>: push -0x4(%ecx)
0x08049190 <+10>: push %ebp
0x08049191 <+11>: mov %esp,%ebp
0x08049193 <+13>: push %ecx
0x08049194 <+14>: sub $0x4,%esp
0x08049197 <+17>: mov %ecx,%eax
0x08049199 <+19>: cmpl $0x1,(%eax)
0x0804919c <+22>: jg 0x80491be <main+56>
0x0804919e <+24>: mov 0x4(%eax),%eax
0x080491a1 <+27>: mov (%eax),%eax
0x080491a3 <+29>: sub $0x8,%esp
0x080491a6 <+32>: push %eax
0x080491a7 <+33>: push $0x804a008
0x080491ac <+38>: call 0x8049040 <printf@plt>
0x080491b1 <+43>: add $0x10,%esp
0x080491b4 <+46>: sub $0xc,%esp
0x080491b7 <+49>: push $0x1
0x080491b9 <+51>: call 0x8049050 <exit@plt>
0x080491be <+56>: mov 0x4(%eax),%edx
0x080491c1 <+59>: movl $0x804a039,(%edx)
0x080491c7 <+65>: sub $0x8,%esp
0x080491ca <+68>: push 0x4(%eax)
0x080491cd <+71>: push $0x804a03d
0x080491d2 <+76>: call 0x8049060 <execv@plt>
0x080491d7 <+81>: add $0x10,%esp
0x080491da <+84>: mov $0x0,%eax
0x080491df <+89>: mov -0x4(%ebp),%ecx
0x080491e2 <+92>: leave
0x080491e3 <+93>: lea -0x4(%ecx),%esp
0x080491e6 <+96>: ret
End of assembler dump.
execv 가 보이고,
(gdb) p (char *) 0x804a03d
$1 = 0x804a03d "/usr/bin/env"
(gdb) break main
Breakpoint 1 at 0x8049194
(gdb) r id
Starting program: /home/bandit19/bandit20-do id
Download failed: Permission denied. Continuing without separate debug info for system-supplied DSO at 0xf7fc7000.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Breakpoint 1, 0x08049194 in main ()
(gdb) s
Single stepping until exit from function main,
which has no line number information.
Download failed: Invalid argument. Continuing without source file ./posix/./posix/execv.c.
execv (path=0x804a03d "/usr/bin/env", argv=0xffffd434) at ./posix/execv.c:24
warning: 24 ./posix/execv.c: No such file or directory
(gdb) bt
#0 execv (path=0x804a03d "/usr/bin/env", argv=0xffffd434) at ./posix/execv.c:24
#1 0x080491d7 in main ()
(gdb) x/8x 0xffffd434
0xffffd434: 0x39 0xa0 0x04 0x08 0xb7 0xd5 0xff 0xff
(gdb) p (char *) 0xffffd5b7
$12 = 0xffffd5b7 "id"
(gdb)
(gdb) r ls -al
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program: /home/bandit19/bandit20-do ls -al
Download failed: Permission denied. Continuing without separate debug info for system-supplied DSO at 0xf7fc7000.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Breakpoint 1, 0x08049194 in main ()
(gdb) s
Single stepping until exit from function main,
which has no line number information.
Download failed: Invalid argument. Continuing without source file ./posix/./posix/execv.c.
execv (path=0x804a03d "/usr/bin/env", argv=0xffffd424) at ./posix/execv.c:24
warning: 24 ./posix/execv.c: No such file or directory
(gdb) s
25 in ./posix/execv.c
(gdb) bt
#0 execv (path=0x804a03d "/usr/bin/env", argv=0xffffd424) at ./posix/execv.c:25
#1 0x080491d7 in main ()
(gdb) x/16x 0xffffd424
0xffffd424: 0x39 0xa0 0x04 0x08 0xb3 0xd5 0xff 0xff
0xffffd42c: 0xb6 0xd5 0xff 0xff 0x00 0x00 0x00 0x00
(gdb) p (char *) 0xffffd5b3
$14 = 0xffffd5b3 "ls"
(gdb) p (char *) 0xffffd5b6
$15 = 0xffffd5b6 "-al"
(gdb) p (char *) 0x0804a039
$16 = 0x804a039 "env"
(gdb)
그래서 보면, execv 함수로 /usr/bin/env 실행과 argument 로 cat /etc/bandit_pass/bandit20 을 넣으면 될 듯. 해보자.
bandit19@bandit:~$ ./bandit20-do cat /etc/bandit_pass/bandit20
0qXahG8ZjOVMN9Ghs7iOWsCfZyXOUbYO
bandit19@bandit:~$