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

OverTheWire Bandit Level 26 → 27 tutorial!!

Login

Log in as bandit26 (use the key from Level 25 → 26, or the password if you have it).

ssh -i bandit26.sshkey -p 2220 bandit26@localhost
# or
ssh bandit26@bandit.labs.overthewire.org -p 2220
# password: s0773xxkk0MXfdqOfPRVr9L3jJBUOgCZ

Why? Each Bandit level is a separate UNIX user. To solve 26 → 27, you must be the bandit26 user first.

Task

Task placeholder

“Good job getting a shell! Now hurry and grab the password for bandit27.” You’ll find a helper binary in bandit26’s home that can run commands as bandit27.

A little bit of Theory

  • In Level 25 → 26, we escaped the restricted shell (/usr/bin/showtext) via more → v → vim → :set shell=/bin/bash → :shell to get a real shell.
  • In this level, the file bandit27-do in bandit26’s home is a setuid-style helper that runs any command as bandit27.
  • So we can simply use it to read /etc/bandit_pass/bandit27.

Further reading:

Solution

  1. Ensure you really have an interactive shell as bandit26

    If you get kicked out right away (because of showtext), shrink your terminal so more shows --More--, press v to open Vim, then:

    :set shell=/bin/bash
    :shell
    

    Why? This is the same escape from Level 25 → 26 to obtain a usable shell.

  2. List the home directory and discover the helper

    ls -la
    

    You should see bandit27-do and text.txt.

    Why? The filename hints it runs commands as bandit27.

  3. Check what the helper does

    ./bandit27-do
    # or: strings ./bandit27-do
    

    You’ll see usage like:

    Run a command as another user.
      Example: ./bandit27-do id
    

    Why? Confirms it runs arbitrary commands with bandit27’s privileges.

  4. Verify effective user

    ./bandit27-do id
    

    Why? Sanity-check that commands run as bandit27.

  5. Read the password for bandit27 using the helper

    ./bandit27-do cat /etc/bandit_pass/bandit27
    

    Why? This prints the next level’s password with bandit27’s permissions.

    password read placeholder

Password

Paste here the exact line printed by the helper (of course from your own run).

upsNCc7vzaRDx6oZC6GiR6ERwe1MowGB

Troubleshooting

  • Still stuck in showtext? → Make the terminal short, press v to open Vim, then :set shell=/bin/bash and :shell.
  • Permission denied executing ./bandit27-do → Ensure you’re in /home/bandit26 and the file is executable. If needed, run it with the absolute path: /home/bandit26/bandit27-do cat /etc/bandit_pass/bandit27
  • Got the wrong password? → Double-check you ran the helper on /etc/bandit_pass/bandit27 (not bandit26).

Congrats 🎉 You leveraged the bandit27-do helper to execute as bandit27 and retrieved the next credentials!


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