Skip to content

Beginner friendly writeup for bandit level 1 to 20.

Notifications You must be signed in to change notification settings

Chris35t/Bandit-writeup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 

Repository files navigation

Bandit OverTheWire Writeup (Levels 1-20) πŸš€

Introduction πŸ“–

The Bandit wargame from OverTheWire is a great way to learn Linux commands and basic cybersecurity concepts. This writeup provides solutions for levels for beginners.

Connecting to Bandit πŸ”—

Each level requires an SSH connection using the provided credentials.

kali@kali:~$ ssh banditX@bandit.labs.overthewire.org -p 2220

Replace X with the current level number and enter the retrieved password when prompted.


Solutions βœ…

Level 0 β†’ Level 1

Task: πŸ“œ

Retrieve the password stored in the file readme in the home directory.

Solution: πŸ†

cat readme

Copy the displayed password and use it to log in to Level 1.


Level 1 β†’ Level 2

Task: πŸ”Ž

Find the password stored in the - file.

Solution: 🎯

cat ./-

Level 2 β†’ Level 3

Task: πŸ”

Find the password inside the spaces in this filename file.

Solution: πŸ“

cat "spaces in this filename"

Level 3 β†’ Level 4

Task: πŸ•΅οΈβ€β™‚οΈ

Find the password inside a hidden file located in the inhere directory.

Solution: πŸ”¦

ls -a inhere
cat inhere/.hidden

Level 4 β†’ Level 5

Task: 🧐

Find the password inside a file with human-readable content in inhere.

Solution: πŸ“‚

file inhere/*
cat inhere/-file07

Level 5 β†’ Level 6

Task: 🎭

Find the password in a file owned by bandit6, with a size of 1033 bytes.

Solution: πŸ”‘

find / -user bandit6 -size 1033c 2>/dev/null
cat /var/lib/dpkg/info/bandit6.password

Level 6 β†’ Level 7

Task: πŸ”

Find the password stored in a file somewhere in / with the word "millionth".

Solution: πŸ’‘

find / -type f -exec grep -l "millionth" {} 2>/dev/null \;
cat /var/lib/dpkg/info/bandit7.password

Level 7 β†’ Level 8

Task: πŸ“

Find the password in a file containing only ASCII text and stored in data.txt.

Solution: πŸ”’

grep "millionth" data.txt

Level 8 β†’ Level 9

Task: 🧐

Find the password in data.txt that appears only once.

Solution: 🎯

sort data.txt | uniq -u

Level 9 β†’ Level 10

Task: πŸ” 

Find the password in data.txt, which is base64 encoded.

Solution: πŸ”“

base64 -d data.txt

Level 10 β†’ Level 11

Task: πŸ”

Find the password in data.txt, which is encoded with ROT13.

Solution: πŸ”„

cat data.txt | tr 'A-Za-z' 'N-ZA-Mn-za-m'

Level 11 β†’ Level 12

Task: πŸ“¦

Find the password in data.txt, which is a compressed file.

Solution: πŸ—‚οΈ

mkdir /tmp/bandit
cp data.txt /tmp/bandit/
cd /tmp/bandit
xxd -r data.txt > output.gz
gzip -d output.gz
tar -xvf output
tar -xvf output2
tar -xvf output3
tar -xvf output4
cat final_file

Level 12 β†’ Level 13

Task: πŸ”

Find the password inside a hexdump file.

Solution: πŸ’»

xxd -r data.txt > output
cat output

Level 13 β†’ Level 14

Task: πŸ“‘

Send the password via nc to retrieve the next password.

Solution: πŸ“‘

nc localhost 30000
Enter password

Level 14 β†’ Level 15

Task: πŸ”

Same as before, but use SSL.

Solution: πŸ”’

openssl s_client -connect localhost:30001
Enter password

Level 15 β†’ Level 16

Task: πŸ—οΈ

Find the private SSH key and log in to Level 16.

Solution: 🎟️

cat sshkey.private > ~/.ssh/bandit16
chmod 600 ~/.ssh/bandit16
ssh -i ~/.ssh/bandit16 bandit16@localhost -p 2220

Level 16 β†’ Level 17

Task: πŸ“‘

Find the reachable port and retrieve the password.

Solution: 🌐

nmap -p- localhost
nc localhost PORT_NUMBER

Level 17 β†’ Level 18

Task: πŸ•΅οΈ

Find a file owned by bandit18 and execute it.

Solution: πŸ†

ls -l /home/bandit17/
./passwordfile

Level 18 β†’ Level 19

Task: πŸ΄β€β˜ οΈ

Switch user without knowing the password.

Solution: 🎭

./bandit18/bin/setuid

Level 19 β†’ Level 20

Task: 🎬

Find the password in a script that prints the password when executed.

Solution: πŸš€

./bandit19/script

Conclusion 🏁

By completing these levels, you gain a solid understanding of Linux commands, file handling, and security principles. Keep practicing and continue to explore cybersecurity challenges! πŸ”₯

About

Beginner friendly writeup for bandit level 1 to 20.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published