BanditOverTheWire

Bandit19

Website URL: http://overthewire.org/wargames/bandit/bandit19.html

 

Let’s have a look at the task

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.

Hmm… let’s try to log into the server as bandit18

ssh bandit18@bandit.labs.overthewire.org -p2220
Fig 1.

So, this is strange! As soon as we try to log in, we get kicked off of the server. Without logging in, we cannot solve the level. Conundrum!

Let’s think for a bit how we can work around this limitation. Direct SSH connection is out of the question. purely because of the fact that as soon as we log into SSH, .bashrc gets executed and we get kicked off!

We need some way, that either the .bashrc isn’t executed, or we are able to interrupt its operation long enough to sneak in a command or two of our own.

We can probably do it by chaining the commands to be executed in the ssh command itself. Let’s try it out.

ssh bandit18@bandit.labs.overthewire.org -p2220 cat readme

Let’s see the output.

Fig 2.

Mission accomplished!

Leave a Reply

Your email address will not be published. Required fields are marked *