The Leviathan wargame on OverTheWire is designed to introduce players to basic privilege escalation and binary exploitation. Unlike Bandit (Linux basics) or Krypton (cryptography), Leviathan focuses on understanding how misconfigured permissions, hidden files, and small vulnerable programs can be exploited to gain higher access.
In this walkthrough, I’ll guide you through all Leviathan levels with detailed explanations. Each section includes the commands, reasoning, and solutions I used, so you won’t just copy answers but also learn the techniques behind them.
Leviathan Level 0 → Level 1
(Updated: 11 August 2025)
Credentials
- Username:
leviathan0 - Password:
leviathan0
Connection
ssh leviathan0@leviathan.labs.overthewire.org -p 2223
Hints & Commands Learned
- ls -la
- cat
- grep
Steps to Solve
- Step 1 – Use
sshto get access to OverTheWire labs. - Step 2 – Use
ls -lato list file and you can see that we have a directory.backup. - Step 3 – Go to the
.backupdirectory we can see just abookmarks.html.
However, this is a really large file, so we can use grep to find something we want.
- Step 4 - Use
cat bookmarks.html | grep "leviathan"and we can see a linethe password for leviathan1 is xxxx. - Step 5 - Take the password to the next level.
Next Level Password
3QJ3TgzHDq
Leviathan Level 1 → Level 2
(Updated: 11 August 2025)
Credentials
- Username:
leviathan1 - Password:
3QJ3TgzHDq
Connection
ssh leviathan1@leviathan.labs.overthewire.org -p 2223
Hints & Commands Learned
- ltrace
Steps to Solve
- Step 1 – Use
sshto get access to OverTheWire labs. - Step 2 – Use
ls -lato list files and you can see that we have acheckbinary files (which owned byleviathan2). - Step 3 - Call
./checkand you can see it need a password. - Step 5 - Try
ltrace checkand type something to the password and we getstrcmp("a\na", "sex")really suspicious. - Step 6 - Call
./checkand typesexfor the password and we pass it as aleviathan2. - Step 7 - Use
cat /etc/leviathan_pass/leviathan2to get the password. - Step 8 - Take the password to the next level.
Next Level Password
NsN1HwFoyN
Leviathan Level 2 → Level 3
(Updated: 12 August 2025)
Credentials
- Username:
leviathan2 - Password:
NsN1HwFoyN
Connection
ssh leviathan2@leviathan.labs.overthewire.org -p 2223
Hints & Commands Learned
- ln -s
Steps to Solve
- Step 1 – Use
sshto get access to OverTheWire labs. - Step 2 – Use
ls -lato list files and you can see that we have aprintfilebinary files (which owned byleviathan3). - Step 3 - Call
./printfile /etc/leviathan_pass/leviathan3and you can see we can’t get the password. - Step 5 - Use previous knowledge
ltrace ./printfile bash_logoutwe can see thatprintfileusebin/catto print the content ofbash_logout. - Step 6 - Try with file with name has space
mktemp -dandtouch /tmp/tmp.xxxxxx/test file.txt, then./printfile /tmp/tmp.xxxxxx/test file.txtwe get the result:
/bin/cat: /tmp/tmp.xxxxxx/test: No such file or directory
/bin/cat: /tmp/tmp.xxxxxx/file.txt: No such file or directory
Step 7 - Let’s add
testandfile.txtfiles, but we have to log the password from/etc/leviathan_pass/leviathan3.Step 8 - Use
ln -s /etc/leviathan_pass/leviathan3 /tmp/tmp.xxxxxxx/testandln -s /etc/leviathan_pass/leviathan3 /tmp/tmp.xxxxxxx/file.txtto link two files to the password.Step 9 - Run
./printfile /tmp/tmp.xxxxxx/test file.txtand you can see the password in the first line. Note:chmod 777 /tmp/tmp.xxxxxxif you have permission denied.Step 10 - Take the password to the next level.
Next Level Password
f0n8h2iWLP
Leviathan Level 3 → Level 4
(Updated: 12 August 2025)
Credentials
- Username:
leviathan3 - Password:
f0n8h2iWLP
Connection
ssh leviathan3@leviathan.labs.overthewire.org -p 2223
Hints & Commands Learned
- ltrace
Steps to Solve
- Step 1 – Use
sshto get access to OverTheWire labs. - Step 2 – Use
ls -lato list files and you can see that we have alevel3binary files (which owned byleviathan4). - Step 3 - Call
./level3and it need you to have a passsword. - Step 4 - Like Level 2 call
ltrace ./level3you can see a linestrcmp("asdf\n", "snlprintf\n") - Step 5 - Now run
./level3and typesnlprintfas a password so you can get a shell ofleviathan4. - Step 6 - Run
cat /etc/leviathan_pass/leviathan4to get the password. - Step 7 - Take the password to the next level.
Next Level Password
WG1egElCvO
Leviathan Level 4 → Level 5
(Updated: 12 August 2025)
Credentials
- Username:
leviathan4 - Password:
WG1egElCvO
Connection
ssh leviathan4@leviathan.labs.overthewire.org -p 2223
Hints & Commands Learned
- ltrace
- Binary reader
Steps to Solve
- Step 1 – Use
sshto get access to OverTheWire labs. - Step 2 – Use
ls -lato list files and you can see that we have a.trashfolder. - Step 3 -
cd .trashthen runls -laand you can see abinbinary file. - Step 4 - Run
./binand you get back a binary string. - Step 5 - Run
ltrace ./binyou can see it opens theleviathan5password file so we can sure that the./binreturn the password for the next level. - Step 6 - Open Binary Reader and paste the binary without space.
- Step 7 - Take the password to the next level.
Next Level Password
0dyxT7F4QD
Leviathan Level 5 → Level 6
(Updated: 12 August 2025)
Credentials
- Username:
leviathan5 - Password:
0dyxT7F4QD
Connection
ssh leviathan5@leviathan.labs.overthewire.org -p 2223
Hints & Commands Learned
- ln -s
Steps to Solve
- Step 1 – Use
sshto get access to OverTheWire labs. - Step 2 – Use
ls -lato list files and you can see that we have aleviathan5binary file (which owned byleviathan6). - Step 3 - Run
./leviathan5you get a messageCannot find /tmp/file.log. - Step 4 - We can test
touch /tmp/file.logand run again./leviathan5we don’t get anything - Step 5 - Run
ln -s /etc/leviathan_pass/leviathan6 /tmp/file.logto link thefile.logto the password - Step 6 - Run again
./leviathan5to get the password. - Step 7 - Take the password to the next level.
Next Level Password
szo7HDB88w
Leviathan Level 6 → Level 7
(Updated: 12 August 2025)
Credentials
- Username:
leviathan6 - Password:
szo7HDB88w
Connection
ssh leviathan6@leviathan.labs.overthewire.org -p 2223
Hints & Commands Learned
- Brute-force
Steps to Solve
- Step 1 – Use
sshto get access to OverTheWire labs. - Step 2 – Use
ls -lato list files and you can see that we have aleviathan6binary file (which owned byleviathan7). - Step 3 - Run
./leviathan6and it need us to type a correct 4-digit code, so we have to brute-force it. - Step 4 -
mktemp -dto create a temp directory,vim brute-force.shwith the content:
for value in {1000..9999}
do
~/leviathan6 $value
done
- Step 5 - You will have access to the
leviathan7and runcat /etc/leviathan_pass/leviathan7to get the password. - Step 6 - Take the password to the next level.
Next Level Password
qEs5Io5yM8
Leviathan Level 7
(Updated: 12 August 2025)
Credentials
- Username:
leviathan7 - Password:
qEs5Io5yM8
Connection
ssh leviathan7@leviathan.labs.overthewire.org -p 2223
Hints & Commands Learned
NO MORE!
Steps to Solve
- Step 1 – Use
sshto get access to OverTheWire labs. - Step 2 – Use
ls -lato list files and you can see aCONGRATULATIONSfile. - Step 3 - Run
cat CONGRATULATIONSand get the congrats message.
Next Level Password
NO MORE!
