OverTheWire Bandit Level 4->Level 5 - Walkthrough

Introduction

In this article, I will be giving you a walkthrough to the Bandit wargame Level 4->Level 5. The new command used in this Level is "file".

CyberSecurity - OverTheWire Bandit
OverTheWire Bandit Solutions

The player is required to get the password from the only human readable file present among other files. You will also see the usage of wildcards in this post as it will be useful.

Goal

Get the password for Level 5 from the only human readable file present in the directory "inhere" along with other files.

Login Details

Server - bandit.labs.overthewire.org
Port - 2220
Username - bandit4
Password - 2EW7BBsr6aMMoJ2HjW067dm8EgX26xNe

Theory

Get into the "inhere" directory and run the ls command. You'll be able to see 10 files each starting with the character '-'. To read such files, please go through the Level 1->Level 2 walkthrough.
Using the cat command to read each file will give the output but it is not the most efficient way. For this, we will use the "file" command. Most common human readable data encodings are ASCII and Unicode. To read more about the file command, please go through this post. I would also encourage you to go through this discussion thread to understand different viewpoint on the same problem and learn different variants of the file command.

Since the file command needs to be executed on every file, we will use the wildcard character '*' which stands for any number of any literal characters. An example could be file* which would match to everything that starts with 'file', 'file00', 'fileXY', 'fileabcd' and so on. Please go through this article to know more about the Linux wildcards.

Solution

SSH into the user bandit4 using the command "ssh bandit4@bandit.labs.overthewire.org -p 2220" and the above password. Navigate to the directory "inhere" using "cd inhere". Type the command "ls -a" to see the files present in the inhere directory.


Now type the command "file ./-file*" to get the type of all the files present in the directory. You can see that the file -file07 is of Ascii type and therefore is human readable.


Execute the command "cat ./-file07" to get the password for next level.


This completes Level 5 walkthrough. Please feel free to post your doubts in the comments section.

Comments

Popular Posts