OverTheWire - Bandit Walkthrough - Levels 30-33

OverTheWire’s wargames are offered to help learn and practice security concepts in the form of fun-filled games.
The Bandit wargame is aimed at absolute beginners and will teach them the basics needed to be able to play other wargames. All the challenges are focused on the Linux systems and their commands. It aims to get the player familiar with the Linux terminal and introduce some basic security concepts.
It consists of a total of 33 Levels. At each level, you have to find the password for the next level to continue playing. Each Level is a user that you connect as, using SSH in the bandit.labs.overthewire.org
server.
In this post, we will present the solutions for Levels 30-33 of the Bandit wargame.
- See the solutions for the previous Levels 20-29.
NOTE: These walkthroughs are written and published to help other members of the community that are stuck at some Level. It is strongly advised to first try the challenges yourself until you can progress no more, and only then come back here to see the solution.
Level 30
Level Goal
There is a git repository at
ssh://bandit30-git@localhost/home/bandit30-git/repo
. The password for the userbandit30-git
is the same as for the userbandit30
. Clone the repository and find the password for the next level.
Solution
Log in to bandit30
, using the password found from Level 29:
We first create a directory to work on, in /tmp
, in order to work:
We then clone the git repository:
The password is the same as the current’s level.
There is only one README file in the repo and we can cat
it:
Nothing much here.
We can navigate to the .git
directory:
There if we cat
the packed-refs
file we can see a hash that corresponds to a secret tag:
We can view all of the tags in the git repo with:
In order to see information about the tag we can use:
Level 31
Level Goal
There is a git repository at
ssh://bandit31-git@localhost/home/bandit31-git/repo
. The password for the userbandit31-git
is the same as for the userbandit31
. Clone the repository and find the password for the next level.
Solution
Log in to bandit31
, using the password found from Level 30:
We first create a directory to work on, in /tmp
, in order to work:
We then clone the git repository:
The password is the same as the current’s level.
There is only one README file in the repo and we can cat
it:
We do as he says, we create a file key.txt
and we append the phrase:
But if we list all the files in the repo:
We see a .gitignore
file that ignores all .txt
files:
In order to push our changes to the remote repo, we have to delete it:
Now we can add and commit our changes:
And push them to the remote repo:
Level 32
Level Goal
After all this git stuff its time for another escape. Good luck!
Solution
Log in to bandit32
, using the password found from Level 31:
When we log in are welcomed by the upper case shell and if we play around a little we can see that there is not a lot we can do:
All the commands are converted to uppercase and we can do nothing. But we are able to type shell variables starting with $
. After testing different variables like:
We can run $0
which is generally the first argument of a script, which basically it is its name:
Now we have a regular shell that we can execute commands. The shell is running with bandit33
permissions, we can check that if we are logged in as another user e.g. bandit31
and check the home directory of bandit32
:
So we can just cat
the password:
Level 33
Level Goal
At this moment, level 34 does not exist yet.
Solution
Log in to bandit33
, using the password found from Level 32:
If we cat the README.txt
file at our home directory:
bandit33@bandit:~$ cat README.txt
Congratulations on solving the last level of this game!
At this moment, there are no more levels to play in this game. However, we are constantly working
on new levels and will most likely expand this game with more levels soon.
Keep an eye out for an announcement on our usual communication channels!
In the meantime, you could play some of our other wargames.
If you have an idea for an awesome new level, please let us know!
The end!