Post

OverTheWire Wargames bandit => 1

OverTheWire is a platform that provides a collection of wargames designed to help individuals enhance their knowledge of cybersecurity. It’s ideal for both beginners and experienced security enthusiasts looking to expand their skill set in a practical and engaging way.

The platform’s wargames are structured to help users progress step-by-step, starting with basic tasks and advancing to more complex challenges. This makes it an excellent tool for learning concepts such as:

  • Linux/Unix Basics: It introduces beginners to command-line tasks, file manipulation, and system navigation, providing a solid foundation in operating systems.
  • Networking and Protocols: Challenges related to TCP/IP, HTTP, and other networking protocols teach how to analyze and interact with network traffic, offering insight into penetration testing techniques.
  • Cryptography: OverTheWire covers fundamental cryptographic concepts, teaching users how to exploit weaknesses in encryption systems and improve their understanding of security protocols.
  • Web Security: The platform includes practical lessons on common web vulnerabilities such as SQL Injection, Cross-Site Scripting (XSS), and other issues that are crucial for web application security.
  • Reverse Engineering: Users can dive into reverse engineering challenges to understand how to disassemble and manipulate programs, gaining valuable insight into software vulnerabilities.
  • Forensics: OverTheWire also helps users build skills in digital forensics by analyzing compromised data, investigating file systems, and extracting hidden information.

Bandit, the most popular wargame on OverTheWire, is a great starting point for beginners. It introduces users to basic security concepts and Linux commands, offering a fun, interactive way to start learning. As players progress through the game, they tackle increasingly challenging puzzles that simulate real-world hacking scenarios.

In essence, OverTheWire offers a unique, hands-on learning experience where users can practice ethical hacking in a safe, controlled environment. Whether you’re looking to break into the world of cybersecurity or deepen your existing knowledge, OverTheWire provides a wealth of challenges to help you sharpen your skills.

Let’s get started!

Bandit Level 0

Level Goal

The goal of this level is for you to log into the game using SSH. The host to which you need to connect is bandit.labs.overthewire.org, on port 2220. The username is bandit0 and the password is bandit0. Once logged in, go to the Level 1 page to find out how to beat Level 1.

1
ssh bandit0@bandit.labs.overthewire.org -p 2220

Bandit Level 0 → Level 1

Level Goal

The password for the next level is stored in a file called readme located in the home directory. Use this password to log into bandit1 using SSH. Whenever you find a password for a level, use SSH (on port 2220) to log into that level and continue the game.

1
2
3
4
5
6
7
8
9
10
bandit0@bandit:~$ cat readme
Congratulations on your first steps into the bandit game!!
Please make sure you have read the rules at https://overthewire.org/rules/
If you are following a course, workshop, walkthrough or other educational activity,
please inform the instructor about the rules as well and encourage them to
contribute to the OverTheWire community so we can keep these games free!

The password you are looking for is: ZjLjTmM6FvvyRnrb2rfNWOZOTa6ip5If

bandit0@bandit:~$

Bandit Level 1 → Level 2

Level Goal

The password for the next level is stored in a file called - located in the home directory

1
2
3
bandit1@bandit:~$ cat ./-
263JGJPfgU6LtdEvgfWU1XP5yac29mFx
bandit1@bandit:~$

Bandit Level 2 → Level 3

Level Goal

The password for the next level is stored in a file called spaces in this filename located in the home directory

1
2
3
bandit2@bandit:~$ cat spaces\ in\ this\ filename
MNk8KNH3Usiio41PRUEoDFPqfxLPlSmx
bandit2@bandit:~$

Bandit Level 3 → Level 4

Level Goal

The password for the next level is stored in a hidden file in the inhere directory.

1
2
3
4
5
6
7
8
9
10
bandit3@bandit:~$ ls
inhere
bandit3@bandit:~$ find $pwd -type f
./inhere/...Hiding-From-You
./.profile
./.bashrc
./.bash_logout
bandit3@bandit:~$ cat ./inhere/...Hiding-From-You
2WmrDFRmJIq3IPxneAaMGhap0pFhF3NJ
bandit3@bandit:~$

Bandit Level 4 → Level 5

Level Goal

The password for the next level is stored in the only human-readable file in the inhere directory. Tip: if your terminal is messed up, try the “reset” command.

1
2
3
4
5
6
7
8
9
bandit4@bandit:~$ find $pwd -type f | grep -v "profile\|bashrc\|bash_logout" | xargs cat
�nS�
�<��]�
W��e�˥m�����O��D��3�    �)Ʈ�#Y��-6c��IR-�$����:��2g��?�����`>5HYA�u���8�g�`0�$`��i�R�,�Λ�:Y���?�%�A����B��ͩȄp��&�y�,�(jo�.at�:uf�^���@}���ߓ��ߤ��W>��#lk�d�ܮ��yE��4oQYVPkxZOOEOO5pTW81FB8j8lxXGUQw
���/�
     ������qGi��,�2�Yb�
d6�0]�\�$�1�%�������o@��b/��ۙ�rOx����h0~ey
��c�~�h�n��G1bandit4@bandit:~$
bandit4@bandit:~$

Bandit Level 5 → Level 6

Level Goal

The password for the next level is stored in a file somewhere under the inhere directory and has all of the following properties:

  • human-readable
  • 1033 bytes in size
  • not executable
1
2
3
bandit5@bandit:~$ find $pwd -type f | xargs ls -l --block-size=1 2>/dev/null | grep 1033 | awk '{print $9}' | xargs cat
HWasnPhtq9AVKe0dmk45nxy20cvUa6EG
bandit5@bandit:~$

Bandit Level 6 → Level 7

Level Goal

The password for the next level is stored somewhere on the server and has all of the following properties:

  • owned by user bandit7
  • owned by group bandit6
  • 33 bytes in size
1
2
3
bandit6@bandit:~$ find / -type f -user bandit7 -group bandit6 -size 33c 2>/dev/null | xargs cat
morbNTDkSW6jIlUc0ymOdMaLnOlFVAaj
bandit6@bandit:~$

Bandit Level 7 → Level 8

Level Goal

The password for the next level is stored in the file data.txt next to the word millionth

1
2
3
bandit7@bandit:~$ cat data.txt | grep -i millionth
millionth       dfwvzFQi4mU0wfNbFOe9RoWskMLg7eEc
bandit7@bandit:~$ 

Bandit Level 8 → Level 9

Level Goal

The password for the next level is stored in the file data.txt and is the only line of text that occurs only once

1
2
3
4
5
6
7
8
bandit8@bandit:~$ sort data.txt | uniq -u
4CKMh1JI91bUIZZPXDqGanal4xvAg0JM

---------------------------------------------------------

bandit8@bandit:~$ tr ' ' '\n' < data.txt | sort | uniq -u
4CKMh1JI91bUIZZPXDqGanal4xvAg0JM
bandit8@bandit:~$

Explanation:

tr ‘ ‘ ‘\n’: Translates spaces to newlines so that each word becomes a separate line (this can be adjusted based on the format of the file). sort data.txt: Sorts the lines in data.txt to prepare for the uniq command. uniq -u: This filters out duplicate lines and only prints the lines that appear exactly once.

Bandit Level 9 → Level 10

Level Goal

The password for the next level is stored in the file data.txt in one of the few human-readable strings, preceded by several ‘=’ characters.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
bandit9@bandit:~$ file data.txt
data.txt: data
bandit9@bandit:~$ cat data.txt | grep -a "=========="
�D��]���
        �������h#!��Q������J��s�V�zl7����POl%Y]�H��a�^�U␦vTo�D�|�@T����^�N����8?g��}��b�}��?
Q#�g��m1x��}========== the�Ѧ+��i�d�W��^�)F1��>)٘S�K�3�PZ���t�&xs肉WB/�2��ÜB��   �Ź/�Bjɢ��␦���<���э�7��<������u�/��d|
                                                                                                                    �-������n
#��i�u=
       ���7�֣�n�)�Uջ��ش��5bBK��K���}x�>}:��4Rl_7gH��D:�27��4����C�F��y
��6��!��&���z�B��$�l�_G␦��p�hqI.X���0�2����H����$�Tw��m��⧫���o3�m�t0��p��~�L�3JprD========== passwordi���       �L� ~ˏ��<@��Ȅh�$���%Q5���D��k� �|�3
~�T���f�;�o9�s�P#t�+Pe��΢쵟�
OqDf��.�8���Czmnf&v���l:��F�X���K���b�M�
                               �C���I���Bi�>��Y�
�Еk���  $�nX��T=~�}*4�a2�?���TO"'�&�J�~fDV3========== is�d�5z(��#�&s�T!1�0�&p���oq��
�n�R� ���␦F
           ��z�|!�(�i�f��+��A6�4�+'��F���T=��b5�A�}�
�ٱ�éT:�k���������A����U�2�Qc�ɐ�%#�g+;YA_e�kr�����X53|�f8+e#9���㵴��b�R�+�̊�~&��Oiu���?Vh��M��}^��Qp^�G���==�6��!�s���T:�        ��ʨ�"u�V�a��-t\f�g
   ]󈍅(�.�ۍg�:7���n�������n�p��������� �������CD�`v�oS�Q�-<␦]�`�@�#H Uum����BiA��j堵��!O�&�����D9========== FGUW5ilLVJrxX9kMYMmlN4MgbpfMiqey
bandit9@bandit:~$

Explanation:

The -a (or –text) option in grep forces it to treat binary files as text. By default, grep will print a message like “binary file matches” when it encounters binary data, and it won’t show matching lines. The -a option overrides this behavior, allowing grep to search through binary files as if they were text and display matching lines.

Key Points:

  • Default behavior: grep skips binary files and shows “binary file matches” without displaying the match.
  • With -a: grep processes binary files as text and shows matching lines.
  • Use case: Useful when you want to search for text in files containing binary data.

Bandit Level 10 → Level 11

Level Goal

The password for the next level is stored in the file data.txt, which contains base64 encoded data

1
2
3
4
5
6
7
8
9
bandit10@bandit:~$ ls
data.txt

bandit10@bandit:~$ cat data.txt | grep -a [a-zA-Z0-9]
VGhlIHBhc3N3b3JkIGlzIGR0UjE3M2ZaS2IwUlJzREZTR3NnMlJXbnBOVmozcVJyCg==

bandit10@bandit:~$ cat data.txt | grep -a [a-zA-Z0-9] | base64 -d
The password is dtR173fZKb0RRsDFSGsg2RWnpNVj3qRr
bandit10@bandit:~$

Explanation:

  • cat data.txt: Reads the content of data.txt.
  • grep -a [a-zA-Z0-9]: Filters lines that contain alphanumeric characters (letters and numbers), ignoring others. The -a option ensures binary data is treated as text.
  • base64 -d: Decodes the alphanumeric text, assuming it is Base64-encoded, back to its original form.

If data.txt contains mixed content where some lines are Base64-encoded, this command extracts the encoded lines, decodes them, and shows the original data.

These first 10 challenges provide a strong starting point for tackling bandit but there’s more to explore!

In the next blog We’ll dive into challenges 11 to 20 and share more practical solutions to help you move forward. Stay tuned!

This post is licensed under CC BY 4.0 by the author.