September 8, 2026
Leviathan β OverTheWire
The Leviathan wargame primarily focuses on basic reverse engineering, file permissions, exploiting SUID binaries, and understanding systemβ¦

By Muhammad Abdullah
3 min read
The Leviathan wargame primarily focuses on basic reverse engineering, file permissions, exploiting SUID binaries, and understanding system library calls.
Level 0 β Level 1
Goal: Find the hidden password for the next level.
Process:
- Log into the server using SSH as
leviathan0with the passwordleviathan0. - Use the
ls -lacommand to list all files, including hidden ones. - A hidden directory named
.backupis discovered. - Navigate into
.backupusingcd .backup. - Inside, there is a file named
bookmarks.html. - Since it is a large file, use the
grepcommand to search for the keyword "leviathan":grep leviathan bookmarks.html. - This outputs the line containing the password for
leviathan1.
Level 1 β Level 2
Goal: Exploit a SUID binary to spawn a shell as the next user.
Process:
- Log in as
leviathan1. - There is an executable file named
checkin the home directory. - Running
./checkprompts for a password. Guessing randomly fails. - Use the
ltracecommand (ltrace ./check) to trace the library calls made by the binary. - The output shows a
strcmp()(string compare) function checking the user input against a hardcoded string:"sex". - Run
./checkagain and typesexas the password. - The program spawns a new shell with
leviathan2privileges. - Retrieve the password by reading the protected file:
cat /etc/leviathan_pass/leviathan2.
Level 2 β Level 3
Goal: Bypass a file access check using a space-in-filename exploit.
Process:
- Log in as
leviathan2. - Find a SUID binary named
printfilewhich prints the contents of a file passed as an argument. - Running
ltrace ./printfilereveals how it works: it uses theaccess()function to check if the current user has permission to read the file, and then uses thesystem()function to run/bin/cat <filename>. - The vulnerability:
system()doesn't handle spaces in filenames securely. If a filename has a space,catinterprets it as two separate files. - Create a temporary workspace:
mkdir /tmp/workspaceandcd /tmp/workspace. - Create a symbolic link named
spacepointing to the password file:ln -s /etc/leviathan_pass/leviathan3 space. - Create a dummy file with a space in its name:
touch "space file". - Run the program:
~/printfile "space file". - The
access()check passes because "space file" belongs to the user. Butsystem("/bin/cat space file")executescat spaceandcat file. cat spacefollows the symlink and prints the password forleviathan3.
Level 3 β Level 4
Goal: Reverse engineer another binary to find a hidden password.
Process:
- Log in as
leviathan3. - There is a SUID binary named
level3that prompts for a password. - Run
ltrace ./level3and input a test password. - The trace reveals that the program compares the user input against the hardcoded string
"snlprintf"usingstrcmp(). - Run
./level3and entersnlprintf. - It drops you into a shell as
leviathan4. - Retrieve the password:
cat /etc/leviathan_pass/leviathan4.
Level 4 β Level 5
Goal: Find a hidden binary and decode its output.
Process:
- Log in as
leviathan4. - Running
ls -lareveals a hidden directory named.trash. - Inside
.trash, there is a SUID binary namedbin. - Running
./binoutputs a string of binary code (1s and 0s). - This binary data represents ASCII characters.
- Copy the binary output and use an online Binary-to-ASCII converter, or pipe it through a local script/tool to decode it.
- The decoded ASCII text is the password for
leviathan5.
Level 5 β Level 6
Goal: Exploit a hardcoded file path using a symbolic link.
Process:
- Log in as
leviathan5. - There is a SUID binary named
leviathan5. - Running
./leviathan5gives an error saying it cannot find/tmp/file.log. - Run
ltrace ./leviathan5to confirm that the program explicitly looks for a file at that exact path to print its contents. - To exploit this, create a symbolic link at that location pointing to the next password file:
ln -s /etc/leviathan_pass/leviathan6 /tmp/file.log. - Run
./leviathan5again. The program reads the symlink and outputs the password forleviathan6.
Level 6 β Level 7
Goal: Brute-force a 4-digit PIN.
Process:
- Log in as
leviathan6. - There is a SUID binary named
leviathan6that requires a 4-digit PIN as an argument. - Manual guessing would take too long, so a simple bash script loop is used to brute-force all combinations from 0000 to 9999.
- Run the following one-liner in the terminal:
for i in {0000..9999}; do ~/leviathan6 $i; done
- The loop will rapidly test numbers. Once it hits the correct PIN, it will spawn a shell as
leviathan7and pause the loop. - Retrieve the final password:
cat /etc/leviathan_pass/leviathan7.
Level 7 (Conclusion)
Goal: Log in and claim victory.
Process:
- Log in as
leviathan7using the retrieved password. - This level does not have a subsequent challenge; logging in successfully marks the completion of the Leviathan wargame.