Leviathan Level 5
Leviathan Level 5 — a setuid program reads a file from a fixed path; learn how symbolic links redirect it.
Table of Contents
Source: This content is aggregated from overthewire (MIT). Visit the original repository for the latest version.
There is no information for this level, intentionally.
Study guide
Level map: logged in as leviathan5, find the password for leviathan6.
What this level teaches
How symbolic links (“symlinks”) can trick a privileged program that trusts a predictable path.
Key ideas
- Symlinks. A symlink is a small file that points at another path;
ln -s TARGET LINKNAMEcreates one. - Following links. When a privileged program opens a file, the operating system follows a symlink transparently, using the program’s privileges, not yours.
- Predictable paths. Programs that use fixed names in shared directories like
/tmpare open to this. - Trace to learn.
ltracereveals the path the program opens.
How to approach it
- Run the program and under
ltraceto find which file it tries to open. - Think about what that name could point at instead.
Why it matters
Insecure use of temporary files is a classic source of local privilege escalation, which is why mktemp and unpredictable names exist.