OverTheWire.org Walkthrough: Bandit

~ Level 30→31 ~

Level Description

There is a git repository at ssh://bandit30-git@localhost/home/bandit30-git/repo. The password for the user bandit30-git is the same as for the user bandit30.

Clone the repository and find the password for the next level.

The command suite of git is needed for this level.


Research Before Solving

Research will be completed as we delve deeper into the level.


Solution Walkthrough

We will begin this level the same way as the last two. By first creating a directory, /tmp/user and then moving into it. We must then clone the provided repository git clone ssh://bandit30-git@localhost/home/bandit30-git/repo. Confirm the connection and enter the password.

Use ls and then cd repo. After using another ls, we will read the file called README.md.

contents of file named README.md

Using git log we find that only one commit is available. The aforementioned commit is just of the empty file shown above.

Issuing an ls -a will allow us to see a hidden directory by the name of .git. Let's move into this directory and have a look around. While perusing through this directory we eventually find a file named packed-refs. The contents of this file are shown below:

contents of file packed-refs

The third line from the top is the repository that we cloned. The next item down points to something called refs/tag/secret. Secret sounds like something we might be interested in!

Using a search engine, we find that refs stands for references. These are files that contain the hash of a committed object. The hashes in the above picture are the long strings of characters. This packed-refs file simply stores all commits of files in one easily accesible place. Research into tags tells us that a tag is used to mark a specific, important point during a commit files history. We can use git tag to list all tag objects within the repository.

using command of git tag to show all tags

Going through the man pages of git we then find we can use git show to look at the contents of specific objects. In this case, we use git show secret to see its contents:

password to bandit31

We've found the password to level 31! Delete the directory that we created using rm -rf /tmp/user before tackling the next level.

Password: 47e603bb428404d265f59c42920d81e5