# Walkthrough Level 0 to 34

## **Level 0 → Level 1** <a href="#id-7baa" id="id-7baa"></a>

ls -la command is the terminal command used in Kali Linux or other Linux distributions.

* ls: This command is abbreviation of the word “list” and shows the files and directories in the current section.
* -l: Provides detailed information about the file. It includes permissions, file owner, group, file size, creation date, and the name of each file or directory
* -a: This argument displays all files, including hidden files (those starting with ‘.’).

<figure><img src="https://miro.medium.com/v2/resize:fit:699/1*spF5EZCFSYrv8oehau9NXw.jpeg" alt="" height="224" width="559"><figcaption></figcaption></figure>

## Level 1 → Level 2 <a href="#id-628c" id="id-628c"></a>

Here we have a file that cannot be read with the ‘cat’ command. We’ll try the ‘more’ command. You can read more details through the [**link**](https://www.liquidweb.com/blog/how-to-display-contents-of-a-file-linux/).

<figure><img src="https://miro.medium.com/v2/resize:fit:518/1*XRhhnIflVqwqNc3qos94mA.jpeg" alt="" height="178" width="414"><figcaption></figcaption></figure>

## Level 2 → Level 3 <a href="#id-23be" id="id-23be"></a>

Here we encounter an error when typing “cat spaces in this filename”. Therefore, we can read the file using the ‘more’ command, referring to the article from the [**link**](https://superuser.com/questions/606874/cannot-cat-file-which-has-space-in-name-in-linux).

<figure><img src="https://miro.medium.com/v2/resize:fit:615/1*sPGWHrVmRLkKobub5LDn_A.jpeg" alt="" height="148" width="492"><figcaption></figcaption></figure>

## Level 3 → Level 4 <a href="#id-88e1" id="id-88e1"></a>

As mentioned in the first level, it is possible to see hidden directories with the command “ls -la”.

<figure><img src="https://miro.medium.com/v2/resize:fit:563/1*Hrevyr2gSF7UH-JxAHv_Dg.jpeg" alt="" height="221" width="450"><figcaption></figcaption></figure>

## Level 4 → Level 5 <a href="#bea8" id="bea8"></a>

In this round, we are told that the file is formatted in a way that can be read by humans. However, due to the large number of files, determining their type rather than opening each one individually is a quicker solution.

The [`file`](https://medium.com/r?url=https%3A%2F%2Fwww.hostinger.in%2Ftutorials%2Flinux-file-command%2F)[ ](https://medium.com/r?url=https%3A%2F%2Fwww.hostinger.in%2Ftutorials%2Flinux-file-command%2F)command is used in Unix/Linux systems to determine the type of files.

* “.” (dot) represents the current directory. It is used when specifying a file path.
* “/” represents all files in the current directory. For example, to represent files in a subdirectory two levels deep, you would use “/\*/\*”.

<figure><img src="https://miro.medium.com/v2/resize:fit:470/1*aBu7_0A_R3hDec4Jo_dDWQ.jpeg" alt="" height="501" width="376"><figcaption></figcaption></figure>

When typing “cat -file07,” we’ll get an error, so we should write it in the following format (./ indicates the current directory).

<figure><img src="https://miro.medium.com/v2/resize:fit:875/1*uEXGDD-bsta-3iGEPPdS7A.png" alt="" height="149" width="700"><figcaption></figcaption></figure>

### Level 5 → Level 6 <a href="#id-4c4e" id="id-4c4e"></a>

In this level, we are informed that the file size is 1033 bytes. Therefore, we search in the following format. You can read more about the [**`find`**](https://www.tecmint.com/35-practical-examples-of-linux-find-command/)[ ](https://www.tecmint.com/35-practical-examples-of-linux-find-command/)command from the link.

<figure><img src="https://miro.medium.com/v2/resize:fit:875/1*dM0u2w075_8eyS70PoEp9w.png" alt="" height="164" width="700"><figcaption></figcaption></figure>

<figure><img src="https://miro.medium.com/v2/resize:fit:488/1*AMfY4HWCFv0fvVpMZ7z3Mw.jpeg" alt="" height="495" width="390"><figcaption></figcaption></figure>

### Level 6 → Level 7 <a href="#id-61d1" id="id-61d1"></a>

In this level, we are told that the searched file’s owner is bandit7, group is bandit06, and size is 33 bytes. We already learned how to search for files based on size in a previous level. Now, let’s learn how to search based on owner and group according to the article from the [**link**](https://unix.stackexchange.com/questions/22747/finding-files-by-their-owner-and-file-permissions/).

<figure><img src="https://miro.medium.com/v2/resize:fit:649/1*35tbNZ_Oz_7VYxSbnRVshA.jpeg" alt="" height="160" width="519"><figcaption></figcaption></figure>

### Level 7 → Level 8 <a href="#f13c" id="f13c"></a>

In this level, we are told that the password is next to the word “millionth” inside data.txt. However, we notice that directly reading the file to find this is time-consuming. Therefore, we use the following command:

cat data.txt ┃grep ‘millionth’

* Here, as we know, `cat data.txt` reads the contents of the file.
* The “|” (pipe symbol) takes the output of the first command and passes it as input to the second command. You can find more detailed information in the [link](https://www.redhat.com/sysadmin/pipes-command-line-linux).
* The “grep” command extracts lines from a file that match a specified word or pattern. In this context, since the word is associated with “password,” grep provided results. In other cases, you can use grep with arguments as explained in the [**link**](https://www.geeksforgeeks.org/grep-command-in-unixlinux/).

<figure><img src="https://miro.medium.com/v2/resize:fit:549/1*1fmIQGz4slKi43HUkV1Zuw.jpeg" alt="" height="149" width="439"><figcaption></figcaption></figure>

### Level 8 → Level 9 <a href="#id-5543" id="id-5543"></a>

In this level, as a hint, we are told that the password is in the line of data.txt that does not repeat. Additionally, although there are sorting algorithms, it is possible to solve the problem with just two Linux commands :)

<figure><img src="https://miro.medium.com/v2/resize:fit:875/1*pRR5U25jBL6bH8ORWnH92A.png" alt="" height="192" width="700"><figcaption></figcaption></figure>

<figure><img src="https://miro.medium.com/v2/resize:fit:524/1*Loris3PDoQiR-ZEBQOhOoA.jpeg" alt="" height="135" width="419"><figcaption></figcaption></figure>

### Level 9 → Level 10 <a href="#id-6d20" id="id-6d20"></a>

In this level, as a hint, it’s mentioned that the password for the next level is stored in one of the lines that can be read by several people in the data.txt file, preceded by several ‘=’ symbols. Initially, when we directly read the file, we see unreadable characters like “��̃�q���Y�\_�C�G�b�g”. Therefore, first, to extract readable parts, we use the command “strings data.txt”. You can find more information about the strings command from the [**link**](https://www.howtogeek.com/427805/how-to-use-the-strings-command-on-linux/). Then, we pass this result as input to the “grep” command using the “|” (pipe symbol) as mentioned in the hint, to retrieve parts containing the ‘=’ symbol:

<figure><img src="https://miro.medium.com/v2/resize:fit:531/1*zFpkmbAuKVUlyp9VPzE06Q.jpeg" alt="" height="323" width="425"><figcaption></figcaption></figure>

### Level 10 → Level 11 <a href="#id-9c33" id="id-9c33"></a>

In this level, we are told that the password is stored in the data.txt file encoded in base64. It remains for us to decode it ☕

<figure><img src="https://miro.medium.com/v2/resize:fit:533/1*tuG9oyCoH5piGK3DbSOBBw.jpeg" alt="" height="139" width="426"><figcaption></figcaption></figure>

### Level 11 → Level 12 <a href="#id-093e" id="id-093e"></a>

We are told that the letters have shifted by 13 positions. Searching “Rotating 13 symbols” on the internet brings up articles about “ROT13”. Later, when searching for ROT13 decode, we come across the command `tr '[a-zA-Z]' '[n-za-mN-ZA-M]'`.

`[a-zA-Z]`: Represents all lowercase letters from ‘a’ to ‘z’ and uppercase letters from ‘A’ to ‘Z’. `[n-za-mN-ZA-M]`: Represents the letters to which each letter will be shifted. Here, each letter’s Unicode code (ASCII) is shifted by 13 positions. For more detailed information, you can follow the [**link**](https://askubuntu.com/questions/1085069/how-can-i-decode-a-file-where-each-letter-has-been-replaced-with-the-letter-13-l).

<figure><img src="https://miro.medium.com/v2/resize:fit:573/1*4UCNRFdQ4dGujiF4kUo-Dg.jpeg" alt="" height="141" width="458"><figcaption></figcaption></figure>

### Level 12 → Level 13 <a href="#af7b" id="af7b"></a>

Here, we are told that the data.txt file is a repeatedly compressed hexdump file. It is recommended to create a directory in /tmp and work there. Since the file is repeatedly compressed as a hexdump, we use reverse algorithms. While we could solve this stage by writing a script, we chose this approach to practice using commands.

xxd -r data.txt data.out

* xxd: Hexdump is a command that performs hexadecimal dump operations.
* -r:”Reverse” means to do the opposite or to undo something. In this context, it refers to converting a hexadecimal (hex) dump file back into a regular file format.
* data.txt: The input file’s name. This file should be in hexdump format.
* data.out: The output file’s name.

At each stage, we use the `file` command to determine the type of the resulting file, which helps us identify which operation to reverse.

If the result of the `file` command is "gzip compressed data," it means the file is compressed in gzip format. In such a case, we use the `mv` command to rename `data.out` to `data.gz` because we need to reverse this file format.

gzip -d data.gz

* gzip: This is a program used for compressing and decompressing files.
* -d: “Dekompress” means to decompress, and it is used to open or extract files.
* data.gz: The name of the file to be opened. This file is compressed in gzip format.

Other commands in sequence proceed in this format. The compression method of the file is identified, reversed, and then the file is opened. As a result, an ASCII text file is obtained.

<figure><img src="https://miro.medium.com/v2/resize:fit:875/1*ioLjrWto5SB5ibj8vEiMGQ.jpeg" alt="" height="472" width="700"><figcaption></figcaption></figure>

### Level 13 → Level 14 <a href="#id-219f" id="id-219f"></a>

In this round, we are told that the password for the next level is located in the directory `/etc/bandit_pass/bandit14`, but it can only be read by the user bandit14. Instead of a password, we are given an SSH key to proceed to the next stage. Note: localhost refers to the machine we are working on (in our case, the Kali Linux machine).

First, because the file we’re working with is an SSH key, we need to securely download it instead of copying it to our local machine, as it raises security concerns when used directly.

scp -P 2220 <bandit13@bandit.labs.overthewire.org>:sshkey.private .

* `scp`,”Secure Copy Protocol” (SCP) is an abbreviation used to securely copy documents from one system to another.
* `-P 2220`: It indicates that SSH will connect over port 2220.
* `bandit13@bandit.labs.overthewire.org:sshkey.private`: This part indicates that the user bandit13 wants to retrieve the file named sshkey.private from the server named bandit.labs.overthewire.org.
* `.`: This point indicates that the document will be copied to our current directory.

Later, we change the permissions of that SSH key to 600. This means read and write permissions are granted: `chmod 600`

ssh <bandit14@bandit.labs.overthewire.org> -p 2220 -i sshkey.private

* `ssh`: It’s a command to connect to a remote system using the SSH protocol.
* `bandit14@bandit.labs.overthewire.org`: This part indicates that the user bandit14 will connect to the server named bandit.labs.overthewire.org.
* `-p 2220`: It indicates that the SSH connection will be made over port 2220.
* `-i sshkey.private`: Here, `-i` is used to specify the SSH key for identification.

<figure><img src="https://miro.medium.com/v2/resize:fit:620/1*IJoP5Nz8UjHZ3jGoaJrS1A.jpeg" alt="" height="694" width="496"><figcaption></figcaption></figure>

After successfully connecting with SSH, as mentioned at the beginning of the level, we read `/etc/bandit_pass/bandit14` and obtain the password.

<figure><img src="https://miro.medium.com/v2/resize:fit:429/1*eHg1mwGdZXge5ZR7O60EtA.jpeg" alt="" height="35" width="343"><figcaption></figcaption></figure>

### Level 14 → Level 15 <a href="#id-2640" id="id-2640"></a>

Here, it tells us to connect to localhost on port 30000 and submit the password we found, and then we’ll receive the password for the next level. In this case, we need to connect using either telnet or netcat and enter the password.

<figure><img src="https://miro.medium.com/v2/resize:fit:385/1*4lU4ayk9yfKKCuRl4PsN4g.jpeg" alt="" height="62" width="308"><figcaption></figcaption></figure>

### Level 15 → Level 16 <a href="#id-802d" id="id-802d"></a>

In this level, we are tasked with confirming the password we find on localhost’s port 30001. However, this time, we need to connect using SSL encryption. To achieve this, we use the `openssl` command. For detailed information, refer to the [**link**](https://community.tenable.com/s/article/Using-OpenSSL-to-verify-certificate-information-on-a-port?language=en_US).

*openssl s\_client -connect localhost:30001*

<figure><img src="https://miro.medium.com/v2/resize:fit:268/1*diSBtKUUIbhu9hr0OTYmBw.jpeg" alt="" height="86" width="214"><figcaption></figcaption></figure>

### Level 16 → Level 17 <a href="#fd58" id="fd58"></a>

In this round, we are tasked with first identifying which port is up within the range of 31000 to 32000 on localhost. Then, we need to determine which of these ports are using SSL encryption. This requires individually testing the ports using openssl connection. (I’ve directly provided the result to avoid confusion since I’ve already checked.)

<figure><img src="https://miro.medium.com/v2/resize:fit:575/1*EVlPMxrkVRyuQ4gVXX3Iwg.jpeg" alt="" height="178" width="460"><figcaption></figcaption></figure>

Later, we pass the password for bandit16 through port 31790 using the `echo` command, and then we obtain the SSH key.

<figure><img src="https://miro.medium.com/v2/resize:fit:875/1*tr2-rIgmmSZDZ2aHCH0W5w.jpeg" alt="" height="446" width="700"><figcaption></figcaption></figure>

### Level 17 → Level 18 <a href="#id-7803" id="id-7803"></a>

First, we connect to bandit17 using the `id_rsa` key we found in the previous level, and then we obtain the password for bandit17.

<figure><img src="https://miro.medium.com/v2/resize:fit:611/1*8z0QSrmsqAEeq9Y5iN-GuQ.jpeg" alt="" height="167" width="489"><figcaption></figcaption></figure>

<figure><img src="https://miro.medium.com/v2/resize:fit:628/1*FVGRjTBchEdbb25sz3EKWA.jpeg" alt="" height="35" width="502"><figcaption></figcaption></figure>

In this round, we’re informed that one of the lines in the files `passwords.new` and `passwords.old` has been modified, and that modified line contains the password. To compare these files, we use the `diff` tool. The line above is the password:

<figure><img src="https://miro.medium.com/v2/resize:fit:454/1*dJBKqyliO1CArijdDCRZaA.jpeg" alt="" height="95" width="363"><figcaption></figcaption></figure>

### Level 18 → Level 19 <a href="#f3f4" id="f3f4"></a>

SSH login attempts are automatically terminated with a “Bye Bye” message because of a configuration in `.bashrc`. Additionally, we are informed that the password is in the readme file. In fact, there are several ways to solve this level, such as modifying the `.bashrc` file and so on. However, the simplest way is to issue a command directly without logging in via SSH. For detailed information, you can find it at the link provided.

<figure><img src="https://miro.medium.com/v2/resize:fit:574/1*JhfSRpa6Ma1RxC6K8g1_8Q.jpeg" alt="" height="198" width="459"><figcaption></figcaption></figure>

### Level 19 → Level 20 <a href="#id-7c5d" id="id-7c5d"></a>

SUID (Set User ID) permission allows a file to be executed with the privileges of the file’s owner rather than the user who is executing it. For more detailed information, you can obtain it from the provided [link](https://medium.com/@rzashirinov38/linux-fayl-icaz%C9%99l%C9%99ri-x%C3%BCsusi-icaz%C9%99l%C9%99r-29e9e257c02d).

<figure><img src="https://miro.medium.com/v2/resize:fit:570/1*p02NIL8n99eUdsP6oppEaA.jpeg" alt="" height="149" width="456"><figcaption></figcaption></figure>

### Level 20 → Level 21 <a href="#id-8009" id="id-8009"></a>

Here, the SUID file is explained as follows: it connects to the specified port on localhost, reads the lines written to that port, and compares them with the password of bandit20. If correct, it provides the password for bandit21. To achieve this, we simply need to dedicate one terminal window to listening and the other to executing the SUID file.

<figure><img src="https://miro.medium.com/v2/resize:fit:875/1*N0I3pF3o4nJ0EoS9oSjG0g.jpeg" alt="" height="138" width="700"><figcaption></figcaption></figure>

### Level 21 → Level 22 <a href="#id-6e6c" id="id-6e6c"></a>

In this level, we are tasked with finding out which command is scheduled to run at regular intervals in the `/etc/cron.d/` directory. When we list the contents of this directory using `ls -la`, we see the file for the next round, bandit22. Upon reading this file, we are directed to `/usr/bin/cronjob_bandit22.sh`. When we read that file, it shows us a directory under `/tmp`. The directory name resembles a password but isn't actually the password itself. Afterwards, we need to read that file. For information about cron, you can read from the article provided in the [**link**](https://opensource.com/article/17/11/how-use-cron-linux).

<figure><img src="https://miro.medium.com/v2/resize:fit:601/1*6bpGXGcML_0TrgOWMDwJXg.jpeg" alt="" height="285" width="481"><figcaption></figcaption></figure>

### Level 22 → Level 23 <a href="#id-5d56" id="id-5d56"></a>

Here, you simply need to read the script and find out where the password is located. Initially, in the script, the ‘**myname**’ variable is assigned the value ‘bandit23’. Then, instead of ‘**myname**’, we write ‘bandit23’ into the ‘**mytarget**’ variable in the code as it is in the terminal. At this point, this line of code will first convert our input into our writing into md5 hash format, then it will take the first word with the cut command and write it to the screen (in backstage, will have mytarget). In the next piece of code, the **/etc/bandit\_pass/bandit23** will be held to **/tmp/$mytarget**. When we read that file in the .tmp, we will have found the next password

<figure><img src="https://miro.medium.com/v2/resize:fit:606/1*RJfxyqPbMDH8rJQ0c61h_w.jpeg" alt="" height="227" width="485"><figcaption></figcaption></figure>

### Level 23 → Level 24 <a href="#id-7704" id="id-7704"></a>

We obtain the script advancing in this level as we did in the previous level.

<figure><img src="https://miro.medium.com/v2/resize:fit:583/1*LeoA5dd7O8AJXRuiEje-QQ.jpeg" alt="" height="324" width="466"><figcaption></figcaption></figure>

The algorithm for executing the script is in this form:

1. The command `whoami` assigns the user name to the variable `myname`.
2. Then it changes to the directory `/var/spool/$myname/foo` using the command `cd`.
3. A loop begins to traverse all files and directories inside the directory(`for i in * .*; do)`
4. For each file/directory, this algorithm is followed:

a. If the file/directory is not `.`or `..`, meaning it’s not the current directory or the parent directory, the process begins.

b. Assign the owner of the file to the `owner` variable (using the command `stat --format "%U" ./$i`).

c. If the owner of the file is ‘bandit23’, execute the file within a timeout of 60 seconds (`timeout -s 9 60 ./$i`)

d. Delete the file (`rm -f ./$i`).

We need to copy this operation if it hasn’t finished (if the password hasn’t been deleted). For this, we create our directory in the tmp directory, then write our script:

```
#!/bin/bash
cat /etc/bandit_pass/bandit24 > /tmp/hooligan24/pass
```

The script reads the file /etc/bandit\_pass/bandit24 and copies it to /tmp/hooligan24/pass. Then, it sets all permissions (chmod 777) for the script file where the password will be written, the pass file, and the /tmp/hooligan24 directory to avoid any issues during execution. Afterwards, the script moves our script file to the directory /var/spool/bandit24/foo as specified. After 60 seconds, the password will be in the file we specified.

<figure><img src="https://miro.medium.com/v2/resize:fit:748/1*82YK1vFl88l7fKlCBV_3Aw.jpeg" alt="" height="292" width="598"><figcaption></figcaption></figure>

## Level 24 → Level 25 <a href="#id-9552" id="id-9552"></a>

In this level, it is said that we can obtain the password for bandit25 by providing the password for bandit24 and a 4-digit PIN code to localhost on port 30002. Additionally, it’s noted that understanding how the system works and seeing error messages involves first manually attempting brute-force methods.

<figure><img src="https://miro.medium.com/v2/resize:fit:875/1*sI5eFCw1z4wXVC5hR-3leg.jpeg" alt="" height="63" width="700"><figcaption></figcaption></figure>

You should write a bruteforce script that will check all PIN codes from 0000 to 9999 later (you can see the result with ‘cat bruteforce.sh’

```
./brutforce.sh | nc localhost 30002 | grep -v "Wrong"
```

This command first executes a bash script named bruteforce.sh, then sends its output to localhost on port 30002, processes the result using the grep command, and outputs the lines that do not contain the string “Wrong“.

<figure><img src="https://miro.medium.com/v2/resize:fit:875/1*TNAuQsLyl3SbrKxaciOkWQ.jpeg" alt="" height="233" width="700"><figcaption></figcaption></figure>

## Level 25 → Level 26 <a href="#id-3f05" id="id-3f05"></a>

In this level, it is mentioned that bandit26’s shell is not `/bin/bash`, and you need to find out which shell it is and how to exit from it. First, connect to bandit25. Then, you will see `bandit26.sshkey`. When trying to connect to bandit26 with this SSH key, you encounter two scenarios: initially, you connect successfully (1), but then you are logged out (2).

<figure><img src="https://miro.medium.com/v2/resize:fit:869/1*Ve0m476XZXhtUWKJt0LNXw.jpeg" alt="" height="701" width="695"><figcaption><p>1</p></figcaption></figure>

<figure><img src="https://miro.medium.com/v2/resize:fit:424/1*9OoksxmDaN_1zyAGpwl4kw.jpeg" alt="" height="130" width="339"><figcaption><p>2</p></figcaption></figure>

Later, when we read the contents of /etc/passwd to determine which shell bandit26 is using, we encounter the following result:

<figure><img src="https://miro.medium.com/v2/resize:fit:611/1*fAPY4ecLBauYkl1TY2mOdQ.jpeg" alt="" height="140" width="489"><figcaption></figcaption></figure>

```
#!/bin/bash

export TERM=linux
exec more ~/text.txt
exit 0
```

* `#!/bin/bash`: Specifies that the script should be interpreted using the Bash shell.
* `export TERM=linux`: Sets the environment variable `TERM` to `linux`, indicating the terminal type supports basic ANSI escape sequences.
* `exec more ~/text.txt`: Executes the `more` command to display the contents of `~/text.txt`. The `exec` command replaces the shell process with `more`, making the script terminate after `more` finishes.
* `exit 0`: Explicitly exits the script with a status code of `0`, indicating successful completion.

We connect via SSH using the key file ‘bandit26.sshkey’ on port 2220 with the username ‘bandit26’ to ‘bandit.labs.overthewire.org’ and aim to minimize the terminal to the maximum extent possible.

<figure><img src="https://miro.medium.com/v2/resize:fit:611/1*X056Pmxgugwj8gozjSmeJg.jpeg" alt="" height="156" width="489"><figcaption></figcaption></figure>

After connecting with SSH, we press the ‘v’ key to open the Vim editor, and then we enter the command “: set shell=/bin/bash” to set the shell to /bin/bash.

<figure><img src="https://miro.medium.com/v2/resize:fit:608/1*-2CYNUOALLMC5CxJm5LPww.jpeg" alt="" height="151" width="486"><figcaption></figcaption></figure>

Then we open the /bin/bash shell that we specified earlier by using the command “:shell” and get password for bandit26

<figure><img src="https://miro.medium.com/v2/resize:fit:416/1*lo-9qop_onOc16Lc0cUTuQ.jpeg" alt="" height="57" width="333"><figcaption></figcaption></figure>

## Level 26 → Level 27 <a href="#id-6d6b" id="id-6d6b"></a>

After connecting to bandit26, we use the `ls` command to view the files. Here, we notice the `bandit27-do` file. Running the command `file bandit27-do` reveals that the file is executable. When we execute it with `whoami`, we see that the owner is bandit27 (SUİD).

<figure><img src="https://miro.medium.com/v2/resize:fit:875/1*6V1shsROkb6D6U4X-6kyew.jpeg" alt="" height="59" width="700"><figcaption></figcaption></figure>

After that, by executing the file with its owner’s permissions (SUİD), we can obtain the password.

<figure><img src="https://miro.medium.com/v2/resize:fit:541/1*3uaoqcoM7CtZ3iB_bwBUig.jpeg" alt="" height="74" width="433"><figcaption></figcaption></figure>

## Level 27 → Level 28 <a href="#id-42ae" id="id-42ae"></a>

There is a git repository at `ssh://bandit27-git@localhost/home/bandit27-git/repo` via the port `2220`. The password for the user `bandit27-git` is the same as for the user `bandit27`. Clone the repository and find the password for the next level. Here, we need to use the `git clone` command and specify the port after localhost:

<figure><img src="https://miro.medium.com/v2/resize:fit:773/1*FVf2pLaQi6e2lCd3DRSS_A.jpeg" alt="" height="458" width="618"><figcaption></figcaption></figure>

## Level 28 → Level 29 <a href="#id-3f1f" id="id-3f1f"></a>

We download the GitHub repository here just like in the previous level. Later, we see that the password is in the form of \*\*\*\*\*\*\*\*\*\* in the README.md file.

<figure><img src="https://miro.medium.com/v2/resize:fit:830/1*_vCPZm0_dOGPYp8xlt3Vjw.jpeg" alt="" height="569" width="664"><figcaption></figcaption></figure>

In the Git system, we see the commit history in the repository through the `git log` command. This command shows all commits from the latest to the earliest. Those highlighted in yellow are commit IDs. Detailed [**link**](https://git-scm.com/docs/git-log).

<figure><img src="https://miro.medium.com/v2/resize:fit:786/1*7Sw6_7Am5yZbDdFXpbeB3Q.jpeg" alt="" height="268" width="629"><figcaption></figcaption></figure>

Using `git checkout <commit_id>`command, we can switch to a previous commit. To retrieve the password, it is sufficient to revert back to 2 commit IDs. Detailed [**link**](https://git-scm.com/docs/git-checkout).

<figure><img src="https://miro.medium.com/v2/resize:fit:781/1*dE66769PvTVZ-Pb0Rjf_IA.jpeg" alt="" height="394" width="625"><figcaption></figcaption></figure>

<figure><img src="https://miro.medium.com/v2/resize:fit:768/1*t8jCqZbpXdwgmyh101BGQw.jpeg" alt="" height="190" width="614"><figcaption></figcaption></figure>

## Level 29 → Level 30 <a href="#id-0b68" id="id-0b68"></a>

We download the GitHub repository here just like in the previous level. Later, we see that the password as ***\<no password in production!>*** in the README.md file.

<figure><img src="https://miro.medium.com/v2/resize:fit:844/1*lpfSUShyhzIgPRD7CCAgwQ.jpeg" alt="" height="516" width="675"><figcaption></figcaption></figure>

This didn’t work…

<figure><img src="https://miro.medium.com/v2/resize:fit:783/1*cAboar0miQmxESRL2SfIxA.jpeg" alt="" height="565" width="626"><figcaption></figcaption></figure>

Later on, we use the [`git branch`](https://git-scm.com/docs/git-branch)command to see other branches. Then we switch branches using the [`git checkout`](https://git-scm.com/docs/git-checkout) `master`command. [`git status`](https://git-scm.com/docs/git-status)shows the current branch. `git branch -a` shows local and remote branches.

<figure><img src="https://miro.medium.com/v2/resize:fit:740/1*jwkUEqOiXEo0mIxFJeHO4g.jpeg" alt="" height="691" width="592"><figcaption></figcaption></figure>

After changing our branch, we can read password:

<figure><img src="https://miro.medium.com/v2/resize:fit:531/1*lQLZ5CDryyqL9qobgGr6CA.jpeg" alt="" height="117" width="425"><figcaption></figcaption></figure>

## Level 30 → Level 31 <a href="#id-26aa" id="id-26aa"></a>

We download the GitHub repository here just like in the previous level. Later, we see that the password as “just an empty file…muahah&#x61;***”*** in the README.md file.

<figure><img src="https://miro.medium.com/v2/resize:fit:849/1*xu41flczfjtjTX5G7oKSgA.jpeg" alt="" height="383" width="679"><figcaption></figcaption></figure>

First, we check the previous methods, but we can’t find any logs or remote branches. Then we search for tags with[`git tag`](https://git-scm.com/book/en/v2/Git-Basics-Tagging) command, it shows us there is secret tag attached to our commit. We read it with the help of [`git show`](https://git-scm.com/docs/git-show) :

<figure><img src="https://miro.medium.com/v2/resize:fit:461/1*wo5bf7SkwfwKHh0xFv25hA.jpeg" alt="" height="153" width="369"><figcaption></figcaption></figure>

## Level 31 → Level 32 <a href="#id-2a59" id="id-2a59"></a>

We download the GitHub repository here just like in the previous level. In README.md fiel we see that there is key.txt file and its content:

<figure><img src="https://miro.medium.com/v2/resize:fit:850/1*98W9mU4klGiwqkfkCpLr_w.jpeg" alt="" height="469" width="680"><figcaption></figcaption></figure>

We add key.txt file manually. Then add this with `git add`command, but it gives us error that ***.gitignore*** file blocks this txt file. Then we read ***.gitignore*** file and see that it blocks all txt files. We remove ***.gitignore*** and again add key.txt:

<figure><img src="https://miro.medium.com/v2/resize:fit:755/1*2XOSko6kjvfoxxZE4W0hSA.jpeg" alt="" height="408" width="604"><figcaption></figcaption></figure>

After all we send it with `git push`command and get our flag:

<figure><img src="https://miro.medium.com/v2/resize:fit:724/1*hclzXXmCc7idYVUuFw0IBw.jpeg" alt="" height="497" width="579"><figcaption></figcaption></figure>

## Level 32 → Level 33 <a href="#d9b7" id="d9b7"></a>

In this level, we are greeted by UPPERCASE SHELL. Initially, I executed several commands here, but all of them were blocked. Later on, the shell was opened through the $0 command. You can obtain detailed information about $0 from the [**link**](https://unix.stackexchange.com/questions/280454/what-is-the-meaning-of-0-in-the-bash-shell).

<figure><img src="https://miro.medium.com/v2/resize:fit:293/1*bEpVBVsZZ5W6J9uCouK_Sg.jpeg" alt="" height="276" width="234"><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://foothold.gitbook.io/blog/overthewire-bandit/walkthrough-level-0-to-34.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
