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

OverTheWire Bandit Level 8 → 9 tutorial!!

Login

Log in as bandit8 using the password you just obtained from Level 7 → 8.

ssh bandit8@bandit.labs.overthewire.org -p 2220
# password: dfwvzFQi4mU0wfNbFOe9RoWskMLg7eEc

Why? Each Bandit level is a separate UNIX user. To solve 8 → 9, you must be the bandit8 user.

Task

Task

The password for the next level is stored in data.txt and is the only line that occurs exactly once.

A little bit of Theory

  • sort groups identical lines together (lexicographical order).
  • uniq examines adjacent equal lines, so it works properly after sort.

    • uniq -u prints only lines that appear once.
    • uniq -c prints counts; can be combined with another sort to view frequencies.
  • For speed and predictable ordering, you can use LC_ALL=C sort.

Further reading:

Solution

  1. Confirm the file exists

    ls -l
    

    Why? Sanity check before running heavy commands.

ls data.txt

  1. Find the line that appears exactly once

    sort data.txt | uniq -u
    # or (locale-agnostic & often faster)
    LC_ALL=C sort data.txt | uniq -u
    

    Why? sort groups duplicates; uniq -u keeps strictly-unique lines.

sort

  1. (Optional) Inspect counts to be sure

    LC_ALL=C sort data.txt | uniq -c | sort -n
    # then pick the one with count 1 (print only the line):
    LC_ALL=C sort data.txt | uniq -c | awk '$1==1{$1=""; sub(/^ /,""); print}'
    

    Why? Good when you want to verify there’s exactly one unique line.

  2. Copy the password (no extra spaces/newlines).

  3. Log into the next level (bandit9)

    exit
    ssh bandit9@bandit.labs.overthewire.org -p 2220
    # paste the password you just found when prompted
    

Password

This is the password shown in my run; if yours differs, copy the one from your own terminal output.

4CKMh1JI91bUIZZPXDqGanal4xvAg0JM

Troubleshooting

  • Using sort -u? → That removes duplicates but still keeps one copy of repeated lines; you want lines that occur only once → use uniq -u.
  • Slow sort? → Use LC_ALL=C sort to avoid locale collation overhead.
  • Garbled output? → Check for weird control characters with cat -A data.txt | head.

Congrats 🎉 You sifted through a massive file and found the unique line — on to bandit9!


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