A progressive CTF-style wargame designed to teach practical Linux security fundamentals through hands-on exploitation of common vulnerabilities. Each level presents a unique security challenge, requiring enumeration, analysis, and privilege escalation to progress.
- Linux Security Fundamentals — Deep understanding of permissions, SUID/SGID, users, groups, and process management
- Reconnaissance & Enumeration — Systematic discovery of attack surfaces through file inspection, binary analysis, and environment exploration
- Privilege Escalation Patterns — Exploiting misconfigurations, race conditions, injection flaws, and unsafe program behaviors
- Binary Analysis & Reverse Engineering — Reading assembly, understanding program flow, identifying vulnerabilities in compiled code
- Secure Coding Awareness — Learning dangerous patterns (command injection, buffer overflows, regex evaluation, TOCTOU) and how to prevent them
- Cryptographic Analysis — Breaking weak encryption schemes, hash cracking, understanding cipher weaknesses
- Defensive Mindset — Understanding attacker methodology to build secure systems
| Category | Tools |
|---|---|
| Enumeration | find, ls, file, strings, id, ps, env, netstat, ss |
| Binary Analysis | objdump, readelf, nm, gdb, ltrace, strace |
| Network Analysis | tcpdump, wireshark, nc (netcat), curl |
| Password Cracking | john (John the Ripper), hashcat, Python crypt module |
| Scripting | bash, python, perl |
| Editors | vim, nano, echo, cat |
Each level follows a systematic security assessment approach:
- Initial Reconnaissance — Identify current user context, available files, permissions, SUID binaries
- File Enumeration — Search for files owned by target users (
find / -user flagXX 2>/dev/null) - Binary/Script Analysis — Examine executables with
file,strings,objdump,ltrace,strace - Vulnerability Identification — Classify the weakness (injection, race condition, crypto flaw, etc.)
- Safe Exploitation — Validate the vulnerability without causing system damage
- Learning Extraction — Document the root cause and mitigation strategies
- Token Retrieval — Execute
getflagto obtain the next level password
VM Network Configuration:
- Settings → Network → Attached to: Host-only Adapter
- Launch VM and connect via SSH:
ssh level00@192.168.56.101 -p 4242Alternative: Port forwarding (see image.png and image-1.png in repo)
Stored in /etc/passwd (legacy) or /etc/shadow (modern). Format:
$<id>$<salt>$<hash>
| Algorithm | Prefix | Example |
|---|---|---|
| DES (crypt) | (none) | 42hDRfypTqqnw |
| MD5 | $1$ |
$1$salt$wCghuVY8B0Y3Vxup6hbnK0 |
| SHA-256 | $5$ |
$5$salt$1qXGc3HhCIV8R8YUI8v3A1jN2Fq6C.Z9QW |
| SHA-512 | $6$ |
$6$salt$jbL5r9GrsUOScNwD6mAeuU5D4a7XnsvX7. |
Cracking Tools:
- DES crypt:
john --format=descrypt, Pythoncryptmodule - MD5:
john --format=md5crypt,hashcat -m 500 - SHA-256:
john --format=sha256crypt,hashcat -m 7400 - SHA-512:
john --format=sha512crypt,hashcat -m 1800
Goal: Find a hidden file and decrypt a simple substitution cipher
Vulnerability type: Weak obfuscation (Caesar/ROT cipher)
Tools you can use:
find— Locate files by ownershipcat/strings— Read file contents- Online cipher tools or custom scripts
Step-by-step approach:
- Enumerate files owned by
flag00usingfind / -user flag00 2>/dev/null - Identify accessible files in unusual locations (e.g.,
/usr/sbin/john) - Read file contents to discover encoded string
- Recognize pattern as a rotation cipher (ROT-N)
- Test all ROT variations (ROT1-ROT25) manually or via automated tool
- Identify plaintext password when it appears as readable English
- Use discovered password to authenticate as
flag00and rungetflag
What you learn:
- Basic Linux file enumeration by user ownership
- Recognition of simple substitution ciphers
- Importance of not storing sensitive data in predictable locations
- Security through obscurity is not security
Mitigation:
- Never rely on encoding/obfuscation for password protection
- Use proper access controls and encryption for sensitive data
- Avoid storing credentials in files accessible to multiple users
- Implement proper secret management systems
Goal: Extract and crack a legacy password hash from /etc/passwd
Vulnerability type: Weak hashing algorithm (DES crypt), exposed password hash
Tools you can use:
cat— Read/etc/passwd- Python
cryptmodule john(John the Ripper)- Wordlist (e.g.,
rockyou.txt)
Step-by-step approach:
- Inspect
/etc/passwdfor unusual entries - Identify
flag01entry with visible password hash (noxplaceholder) - Extract hash format:
42hDRfypTqqnw(DES crypt, 2-char salt) - Recognize salt: first 2 characters (
42) - Prepare password cracking setup with wordlist
- Write Python script using
crypt.crypt(word, salt)or usejohn --format=descrypt - Iterate through wordlist, comparing computed hashes to target
- Identify matching password and authenticate
What you learn:
- Legacy Unix password storage vulnerabilities
- How salt works in password hashing (prevents rainbow tables but doesn't stop dictionary attacks)
- DES crypt is computationally weak by modern standards
- Dictionary attacks are effective against weak passwords
Mitigation:
- Use modern hashing algorithms (bcrypt, scrypt, argon2)
- Store hashes in protected
/etc/shadow, not world-readable/etc/passwd - Enforce strong password policies
- Implement rate limiting and account lockout mechanisms
Goal: Extract credentials from captured network traffic
Vulnerability type: Cleartext credential transmission, insecure protocols
Tools you can use:
wireshark— GUI packet analyzertcpdump— Command-line packet capturescp— Copy PCAP file to analysis machine- Hex dump analysis
Step-by-step approach:
- Discover
level02.pcapfile in home directory - Transfer PCAP to host machine using
scp -P 4242 level02@IP:~/level02.pcap /local/path - Open in Wireshark for visual analysis
- Navigate to Statistics → Conversations → TCP → Follow Stream
- Observe login attempt with visible password characters
- Notice
0x7f(DEL/Backspace) characters in hex dump - Reconstruct actual password by removing deleted characters
- Authenticate using reconstructed credentials
What you learn:
- Network traffic can expose credentials in cleartext protocols
- PCAP files retain full session data including keystrokes
- Terminal control characters (backspace/delete) visible in packet captures
- Passive network sniffing risks
Mitigation:
- Always use encrypted protocols (SSH, TLS, HTTPS)
- Never transmit credentials over unencrypted channels
- Implement network segmentation and encryption
- Use VPNs for sensitive network access
Goal: Exploit unsafe system command execution in a SUID binary
Vulnerability type: Command injection, insecure PATH, system() misuse
Tools you can use:
file— Identify binary typestrings— Extract readable stringsobjdump— Disassemble binaryltrace/strace— Trace library/system callsexport— Modify environment variables
Step-by-step approach:
- Identify SUID binary
level03owned byflag03 - Run
stringsto identify suspicious command execution patterns - Use
ltrace ./level03to trace library calls at runtime - Observe call to
system()with relative command (e.g.,echo) - Recognize PATH exploitation opportunity
- Create malicious executable named
echocontaininggetflag - Prepend current directory to PATH:
export PATH=/tmp:$PATH - Execute binary to trigger malicious
echoinstead of/bin/echo
What you learn:
- SUID binaries run with owner privileges (privilege escalation vector)
system()uses shell interpretation (injection risk)- Relative paths in
system()calls are dangerous - PATH environment variable controls command resolution
Mitigation:
- Always use absolute paths in
system()calls (/bin/echonotecho) - Avoid
system()entirely; useexecve()with controlled arguments - Sanitize all user input and environment variables
- Drop privileges immediately after SUID escalation if not needed
Goal: Exploit command injection in a Perl CGI web application
Vulnerability type: Shell command injection via web parameter
Tools you can use:
curl— Send HTTP requestsnetstat/ss— Verify listening ports- URL encoding
Step-by-step approach:
- Discover
level04.plPerl script running as CGI - Identify it listens on
localhost:4747 - Analyze code:
print \echo $y 2>&1`;` — backticks execute shell commands - Recognize parameter
xis directly interpolated without sanitization - Craft injection payload using shell metacharacter
;to chain commands - URL-encode payload:
curl 'http://localhost:4747/?x=test;getflag' - Observe command execution and flag retrieval in response
What you learn:
- CGI applications can execute with elevated privileges
- Backticks and
system()in Perl execute shell commands - Shell metacharacters (
;,|,&&,`) enable command chaining - Web parameters are untrusted input vectors
Mitigation:
- Never pass user input directly to shell execution functions
- Use parameterized commands or safe APIs (avoid shell entirely)
- Whitelist valid input patterns with strict regex validation
- Run web applications with minimal necessary privileges
Goal: Exploit a scheduled cron job running as privileged user
Vulnerability type: Writable cron script, insecure cron configuration
Tools you can use:
crontab— View scheduled jobscat— Read mail/cron files (/var/mail,/var/spool/cron)find— Locate writable scriptschmod— Modify permissionsln— Create symbolic links
Step-by-step approach:
- Check
/var/mail/level05or/var/spool/cron/crontabs/for scheduled tasks - Identify cron entry running as
flag05:*/2 * * * * su -c "sh /usr/sbin/openarenaserver" - flag05 - Examine
/usr/sbin/openarenaserverscript behavior - Determine if script executes commands from writable directories
- Identify writable path or script that will be sourced/executed
- Place malicious script (e.g.,
getflag > /tmp/output) in exploitable location - Wait for cron execution (every 2 minutes) or trigger if possible
- Retrieve flag from output file
What you learn:
- Cron jobs often run with elevated privileges
- Scripts executed by cron must have secure permissions
- Writable paths in cron-executed scripts = privilege escalation
- Cron runs in minimal environment (PATH considerations)
Mitigation:
- Ensure cron scripts are writable only by root/owner
- Use absolute paths in cron jobs
- Validate all executed scripts and their parent directories are secure
- Implement audit logging for cron job execution
Goal: Exploit dangerous PHP regex /e modifier for arbitrary code execution
Vulnerability type: PHP preg_replace() with /e modifier (code evaluation)
Tools you can use:
cat— Read PHP source (level06.php)objdump— Analyze SUID wrapper binaryecho— Create test input files- PHP documentation
Step-by-step approach:
- Examine
level06.phpsource code - Identify
preg_replace("/(\[x (.*)\])/e", "y(\"\\2\")", $a)— the/emodifier - Recognize
/ecauses replacement string to be evaluated as PHP code - Design payload to inject executable PHP:
[x {${system(getflag)}}] - Create test file:
echo '[x {${system(getflag)}}]' > /tmp/exploit - Execute wrapper binary:
./level06 /tmp/exploit - Observe
system()execution and flag retrieval
What you learn:
- PHP's
/emodifier inpreg_replace()evaluates code (deprecated in PHP 5.5+, removed in PHP 7+) - Regex replacement strings become code execution vectors
- SUID wrappers elevate PHP script privileges
- Legacy code often contains known-dangerous features
Mitigation:
- Never use
/emodifier inpreg_replace()(usepreg_replace_callback()) - Sanitize all user-controlled input before regex processing
- Keep PHP updated to versions without deprecated dangerous features
- Code review for eval-like constructs (
eval(),create_function(),/e)
Goal: Exploit unsafe environment variable usage in SUID binary
Vulnerability type: Unvalidated environment variable in system() call
Tools you can use:
objdump— Disassemble binarystrings— Identify environment variable namesexport— Set malicious environment variablesenv— View current environment
Step-by-step approach:
- Identify SUID binary
level07owned byflag07 - Disassemble with
objdump -d level07or analyze.rodatasection - Trace calls to
getenv()andsystem()in disassembly - Extract environment variable name from
.rodata:LOGNAME - Recognize pattern:
system(sprintf(cmd, getenv("LOGNAME"))) - Craft injection payload:
export LOGNAME='; /bin/getflag #' - Execute binary; injected command runs with elevated privileges
What you learn:
- Environment variables are attacker-controlled input
- Using env vars in
system()without validation = command injection - Shell command concatenation with untrusted data is dangerous
- SUID binaries inherit caller's environment
Mitigation:
- Never trust environment variables in privileged contexts
- Sanitize or whitelist environment variable contents
- Use
execve()with controlled argument arrays instead ofsystem() - Clear/reset environment before executing privileged operations
Goal: Bypass filename-based access control using symbolic links
Vulnerability type: Insecure path validation (checks filename not resolved path)
Tools you can use:
objdump— Analyze binary logicstrings— Extract forbidden filename stringsln— Create symbolic linkscat— Read files via program
Step-by-step approach:
- Discover binary
level08and protected filetoken - Attempt to read
tokendirectly — access denied - Analyze binary with
objdump -s -j .rodatato extract error messages - Identify blacklist check: program refuses files containing string
"token" - Recognize vulnerability: checks argument string, not resolved file path
- Create symlink with different name:
ln -s ~/token /tmp/nottoken - Execute:
./level08 /tmp/nottoken— bypass succeeds - Token contents displayed
What you learn:
- Blacklist filtering on filenames is easily bypassed
- Symlinks decouple filenames from actual file paths
- Path validation must resolve symbolic links before access control
- TOCTOU-related: checking name vs. checking actual resource
Mitigation:
- Resolve symbolic links before access checks (
realpath(),readlink()) - Use whitelist approach (allow specific paths) not blacklist
- Validate canonical paths after full resolution
- Implement OS-level access controls (file permissions) as primary defense
Goal: Reverse-engineer and decrypt a progressive Caesar cipher
Vulnerability type: Weak custom encryption (security through obscurity)
Tools you can use:
objdump— Disassemble encryption binarystrings— Read encrypted token file- Python — Write decryption script
xxd/hexdump— Analyze binary data
Step-by-step approach:
- Discover
level09binary andtokenfile - Analyze binary with
objdumpto understand encryption algorithm - Recognize pattern: each character shifted by
n + index(progressive Caesar) - Example: character at position 0 → +0, position 1 → +1, position 2 → +2
- Read encrypted token file contents
- Write Python decryption script reversing the algorithm
- Decrypt token to reveal flag password
What you learn:
- Custom/proprietary encryption is rarely secure
- Reverse engineering can expose algorithm weaknesses
- Caesar ciphers (even progressive variants) are trivial to break
- Obscurity ≠ security
Mitigation:
- Use proven cryptographic standards (AES, ChaCha20)
- Never implement custom encryption algorithms
- Follow Kerckhoffs's principle (security lies in the key, not algorithm secrecy)
- Use established libraries (OpenSSL, libsodium)
Goal: Exploit Time-Of-Check-Time-Of-Use (TOCTOU) race condition
Vulnerability type: Race condition between access() and open() system calls
Tools you can use:
nc(netcat) — Listen for network connectionsln— Create/manipulate symbolic links rapidly- Bash loops — Automate race condition exploitation
netstat/ss— Verify listener
Step-by-step approach:
- Analyze
level10binary behavior: checks file access withaccess(), then opens withopen() - Identify network component: sends file contents to specified host:port (6969)
- Recognize TOCTOU vulnerability: time window between check and use
- Set up listener:
nc -lk 6969 >> /tmp/capture - Create benign accessible file:
echo OK > /tmp/benign - Launch symlink race loop: rapidly switch
/tmp/targetbetweenbenignandtoken - Spam program execution:
while true; do ./level10 /tmp/target 127.0.0.1; done - Wait for race condition success:
access()checks benign,open()reads token - Extract token from
/tmp/capture
What you learn:
- TOCTOU is a classic race condition vulnerability
access()followed byopen()is a dangerous pattern- Attackers can manipulate filesystem state between checks and operations
- Race conditions are probabilistic but often winnable with automation
Mitigation:
- Never use
access()beforeopen()(justopen()and check result) - Use
openat()with file descriptors for atomic operations - Avoid filesystem-based security checks
- Design systems to be race-condition-resistant (use locks, atomic ops)
Goal: Bypass input filtering to achieve command injection
Vulnerability type: Insufficient input sanitization, regex bypass
Tools you can use:
curl— Send crafted HTTP requests- Perl regex analysis
- URL encoding
Step-by-step approach:
- Analyze Perl CGI script at
localhost:4646 - Identify input processing:
tr/a-z/A-Z/(uppercase),s/\s.*//(removes spaces and after) - Recognize command execution:
egrep "^$xx" /tmp/xd 2>&1with user input$xx - Determine space filtering can be bypassed with shell escapes or alternate metacharacters
- Craft payload without spaces: use semicolons, backticks, or command substitution
- Example:
x=$(getflag)or chaining with;without spaces - URL-encode and send via curl
- Extract flag from response
What you learn:
- Blacklist/filter bypass techniques (spaces, quotes, escaping)
- Shell metacharacters provide multiple injection vectors
- Input transformation (uppercase, trim) doesn't prevent injection
- Defense in depth: filtering alone is insufficient
Mitigation:
- Never interpolate user input into shell commands
- Use parameterized/safe APIs (avoid
system(), backticks,qx//) - Whitelist validation with strict patterns
- Escape all special characters or avoid shell entirely
Goal: Bypass hardcoded UID validation in binary
Vulnerability type: Client-side authentication, hardcoded security checks
Tools you can use:
objdump— Disassemble and analyze checksgdb— Debug and modify execution flowstrings— Extract encrypted token- Binary patching or runtime manipulation
Step-by-step approach:
- Run
level13binary — observe UID check failure - Disassemble to find
getuid()call and comparison logic - Identify hardcoded UID check (e.g.,
if (getuid() != 4242)) - Use
gdbto break at UID check, modify register to pass check - Alternatively, patch binary to skip check or NOP out comparison
- Extract encrypted token string from
.rodata - Analyze decryption routine or XOR key
- Decrypt token to reveal password
What you learn:
- Client-side checks (UID, license validation) can be bypassed
- Binary patching and debugging override hardcoded logic
- Security cannot rely on client-side enforcement
- Obfuscation and hardcoded secrets are ineffective
Mitigation:
- Perform authentication/authorization server-side only
- Never hardcode secrets or checks in client binaries
- Use cryptographic signatures for code integrity
- Assume client environment is hostile/compromised
Goal: Understand and exploit the getflag mechanism itself
Vulnerability type: Likely category — kernel exploitation, binary reverse engineering, privilege escalation via system call manipulation
Tools you can use:
objdump— Disassemble/bin/getflaggdb— Debug getflag behaviorstrace/ltrace— Trace system/library callsstrings— Extract hardcoded data- Kernel debugging tools (if applicable)
Step-by-step approach:
- No files owned by
flag14found — focus shifts to/bin/getflagitself - Disassemble
/bin/getflagwithobjdump -d /bin/getflag > /tmp/analysis - Analyze UID/GID checks and token retrieval mechanisms
- Identify encryption/obfuscation of flag tokens
- Trace system calls to understand how getflag validates privilege
- Look for exploitable conditions (buffer overflow, format string, logic error)
- Exploit vulnerability or reconstruct token decryption
- Retrieve final flag
What you learn:
- Security tools themselves can have vulnerabilities
- Deep binary analysis reveals implementation details
- Privilege escalation can target the privilege-checking mechanism itself
- Understanding system internals (UID/EUID, system calls) is critical
Mitigation:
- Thoroughly audit security-critical binaries
- Use static analysis and fuzzing on privileged programs
- Minimize attack surface of SUID/privileged executables
- Implement defense in depth (don't rely on single security check)
This README intentionally avoids including flags, passwords, or complete exploit code to preserve the educational value of the Snow Crash project. The focus is on methodology, vulnerability classification, and defensive lessons rather than solutions.
Each level teaches a specific security concept applicable to real-world systems. The goal is to understand why vulnerabilities exist and how to prevent them in production code.
This project is for educational purposes only. All techniques demonstrated should be practiced exclusively in controlled lab environments like the Snow Crash VM.
Do not use these techniques against systems you do not own or do not have explicit written permission to test. Unauthorized access to computer systems is illegal and unethical.
The knowledge gained here should be applied to defensive security: building more secure systems, conducting authorized penetration tests, and understanding attacker methodology to better protect infrastructure.