Level13

Level Goal

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.

Solution

root@0xCAB: /writeups/overthewire/bandit/level13/

$ ll
...
-rw-r----- 1 bandit14 bandit13 1679 Sep 1 06:30 sshkey.private
...

$

If we look at the contents of bandit13’s home directory we see a SSH private key that is owned by the user bandit14. The bandit13 group, which the bandit13 user is a member of, has read permissions to this file. Since our current user, bandit13, can read this file, we can use it to SSH back to the server as bandit14.

root@0xCAB: /writeups/overthewire/bandit/level13/

$ ssh -i sshkey.private -p2220 bandit14@127.0.0.1
...

$ cat /etc/bandit_pass/bandit14
fGrHPx402xGC7U7rXKDaxiWFTOiF0ENq

$

The -i flag is telling ssh which identity file (private key) to use and the -p flag is telling it what port to use since it is not the default port 22. See the ssh man page and this post about Linux file permissions for further reading.