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

OverTheWire Bandit Level 22 → 23 tutorial!!

Login

Log in as bandit22 using the password you obtained from Level 21 → 22.

ssh bandit22@bandit.labs.overthewire.org -p 2220
# password: tRae0UfB9v0UzbCdn9cY0gQnds9GF58Q

Why? Each Bandit level is a separate UNIX user. To solve 22 → 23, you must be the bandit22 user.

Task

Task placeholder

A cron job runs as user bandit23. Inspect what it does and use it to obtain the password for bandit23.

A little bit of Theory

  • Cron job definitions live in /etc/cron.d/ on Bandit levels. Each entry calls a script/binary.
  • The script for this level computes a hash-based filename using md5sum and writes the next user’s password there.
  • Do not guess the path; read the script and follow the exact output filename in /tmp.

Further reading:

Solution

  1. List cron definitions

    ls -l /etc/cron.d
    

    Why? Locate the job for this level (e.g., cronjob_bandit23).

    cron dir placeholder

  2. Read the cron entry

    cat /etc/cron.d/cronjob_bandit23
    

    Why? See which script runs and as which user (bandit23), plus the schedule (every minute).

    cron file placeholder

  3. Open the referenced script and understand it

    cat /usr/bin/cronjob_bandit23.sh
    

    On Bandit it looks like:

    #!/bin/bash
    myname=$(whoami)
    mytarget=$(echo I am user $myname | md5sum | cut -d ' ' -f 1)
    echo "Copying passwordfile /etc/bandit_pass/$myname to /tmp/$mytarget"
    cat /etc/bandit_pass/$myname > /tmp/$mytarget
    

    Why? Since it runs as bandit23, it writes /etc/bandit_pass/bandit23 to /tmp/<md5("I am user bandit23")>.

    script placeholder

  4. Compute the exact target and read it

    T=$(echo I am user bandit23 | md5sum | cut -d' ' -f1)
    echo "Target: /tmp/$T"
    cat "/tmp/$T"
    

    Why? This reveals the bandit23 password.

    read tmp placeholder

  5. Copy the password (no trailing spaces/newlines).

  6. Log into the next level (bandit23)

    exit
    ssh bandit23@bandit.labs.overthewire.org -p 2220
    # paste the password you just retrieved
    

Password

This is the password from my run; if yours differs, use the one your terminal printed.

0Zf11ioIjMVN551jX3CmStKLYqjk54Ga

Troubleshooting

  • File not found yet → Cron runs every minute; wait ≤60s and try again.
  • Different path → Your /usr/bin/cronjob_bandit23.sh is the source of truth. It always prints/uses the MD5 target name.
  • Permission denied → Rare here; the file is plain text created by the script. If it disappears, wait for the next minute cycle.

Copy-paste quick run (one shot)

cat /etc/cron.d/cronjob_bandit23
cat /usr/bin/cronjob_bandit23.sh
T=$(echo I am user bandit23 | md5sum | cut -d' ' -f1)
cat "/tmp/$T"

Congrats 🎉 You followed another cron job and harvested the next password — welcome to bandit23!


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