Bandit Level 18 → Level 19

Level Goal

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.

Commands you may need to solve this level

ssh, ls, cat

From ssh man page, we can actually append an command after our login to execute it. Since we know which file the password stored, we can just display the file before we got logout

ssh cat readme

Another way is to use scp, secure file transfer using the private key we created from level16→level17 to copy the file from bandit18 home directory to /tmp. Everything done inside bandit17 with the bandit18 login password. The next password from both methods are the same as expected.

scp -i /tmp/key/b16pkey bandit18@localhost:readme /tmp/tmpfile/readme
cat /tmp/tmpfile/readme