OverTheWire Natas Level 13 → 14 tutorial!!
Published on 26 Dec 2023
Login
URL: http://natas14.natas.labs.overthewire.org
Credentials: natas14: z3UYcr4v4uBpeX8f7EZbMHlzK4UR2XtQ
# Using curl (optional):
curl -u natas14:z3UYcr4v4uBpeX8f7EZbMHlzK4UR2XtQ http://natas14.natas.labs.overthewire.org/
Task
This level provides a login form backed by a MySQL database. Looking at the source code reveals that user input is directly concatenated into a SQL query without sanitization.
A little bit of Theory
Source snippet:
$query = "SELECT * from users where username=\"".$_REQUEST["username"]."\" and password=\"".$_REQUEST["password"]."\"";
Problems here:
- Inputs are not sanitized or parameterized.
- This enables SQL Injection — malicious SQL in the
username
orpassword
fields can alter query logic.
Example:
SELECT * FROM users WHERE username="user" AND password="pass"
If we inject into username
with:
" OR 1=1#
The resulting query becomes:
SELECT * FROM users WHERE username="" OR 1=1# " AND password="pass"
OR 1=1
is always true.#
starts a comment, ignoring the rest.- The query now always returns rows, bypassing authentication.
Solution
-
Open the login form
-
Inject into the username field
" OR 1=1#
Password field can be anything (
abc
,test
, doesn’t matter). -
Submit
The query is forced true, and you get:
Successful login! The password for natas15 is SdqIqBsFcz3yotlNYErZSZwblkm0lrvx
Password
SdqIqBsFcz3yotlNYErZSZwblkm0lrvx
Troubleshooting
- Still getting “Access denied”? → Double-check you typed the injection correctly, including quotes, spaces, and
#
. - Query error? → Some shells auto-escape characters. Always inject directly in the web form (or URL encode if testing via curl).
- Blank page? → Try adding extra spaces after
#
so the comment consumes the remainder of the query.
Congrats 🎉 You just performed a classic SQL Injection to bypass login and dumped the password for natas15. Next up is a trickier blind SQLi challenge.
Thanks for reading!
Until next time — Otsumachi!! 💖☄️✨
all tags
GOT-overwrite aboutme aead ai alphanumeric-shellcode apt argc0 argon2 aslr assembly asymmetric atoi automation backbox bandit base64 bash beginner behemoth binary binary-exploitation binary-to-ascii blackarch blind blind-sqli blogging blue-team bruteforce buffer-overflow buffer-overwrite c caesar canary capabilities checksec command-injection commonmark cookie cron crypto cryptography ctf cutter cyberchef cybersecurity defenders detection dev directory-traversal dnf docs drifter ecc education elf env envp exploitation finale forensics format-string formulaone frequency frequency-analysis gcc gdb getchar gfm ghidra github-pages governance gpg guide hashing hkdf http jekyll jmpbuf kali kasiski kdf kernel keylength kramdown krypton lab ld_preload leviathan lfi lfsr linux linux-syscall llmops log-poisoning ltrace manpage markdown maze memcpy mitigations mitmproxy mlops narnia natas networking newline-injection nonce nop-sled nx object-injection obsidian openssl osint overflow overthewire package-manager pacman parrot path path-hijacking pathname php pie pkc pki pointer-trick pqc priv-esc privilege-escalation provable-security pwn pwntools pyshark python race-condition radare2 rag randomness recon red-team redirect relro requests ret2env ret2libc reverse-engineering reversing ricing roadmap rop rot13 rsa scapy security seed seo serialization session setjmp-longjmp setuid shell shellcode smoke soc sockets sprintf sql-injection srop stack-canary stack-overflow strace strcmp strcpy streamcipher strings strncpy strtoul substitution suid suisei symlink symmetric terminal test threat-intel time-based tls troubleshooting tshark type-juggling ubuntu udp utumno vigenere virtualbox virtualization vmware vortex walkthrough web windows wireshark writing wsl x86