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

OverTheWire Bandit Level 4 → 5 tutorial!!

Login

Log in as bandit4 using the password you just obtained from Level 3 → 4.

ssh bandit4@bandit.labs.overthewire.org -p 2220
# password: 2WmrDFRmJIq3IPxneAaMGhap0pFhF3NJ

Why? Each Bandit level is a different UNIX user; to solve 4 → 5 you must be bandit4.

Task

Task

The password for the next level is stored in the only human-readable file inside the directory inhere in bandit4’s home.

A little bit of Theory

  • The directory currently contains files named -file00-file09 (note the leading -).
  • Many commands treat a leading - as an option. Safest is to prefix with ./ or use --:

    file ./*          # OK: expands to ./-file00, ./-file01, ...
    cat ./-file07     # OK
    cat -- -file07    # also OK
    
  • Use file to identify which entry is ASCII text (human-readable). To avoid false positives, filter exactly : ASCII text (not “Non-ISO extended-ASCII”):

    file ./* | grep ': ASCII text'
    
  • Then cat that filename to print the password.

Further reading (open in new tab):

Solution (step-by-step, with reasons)

  1. Move into the directory with the files

    cd inhere
    

    Why? The challenge says all candidate files are here.

  2. Identify the only human-readable file

    file ./* | grep ': ASCII text'
    

    Why? file classifies each entry; the grep narrows to the single ASCII text file.

file + grep output

  1. Print the password Suppose the previous command showed ./-file07: ASCII text. Read it with:

    cat ./-file07
    # or: cat -- -file07
    

    Why? Prefixing with ./ (or using --) prevents the leading dash from being parsed as an option.

cat target file

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

  2. Log into the next level (bandit5)

    exit
    ssh bandit5@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.

4oQYVPkxZOOEOO5pTW81FB8j8lxXGUQw

Troubleshooting

  • cat: invalid option → Use cat ./-filename or cat -- -filename.
  • No such file or directory → Ensure you cd inhere and copy the filename exactly.
  • Terminal looks weird after cat → You probably viewed a binary; run reset, then use file ./* | grep ': ASCII text'.

Congrats 🎉 You found the only human-readable file and can now play as bandit5.


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