Bandit Level 26
- bandit26’s default shell (set in
/etc/passwd) is not/bin/bash, but a custom script that just runsmoreon a text file and then exits.- So even if we SSH in with a valid key, we get kicked out immediately after
morefinishes.
- So even if we SSH in with a valid key, we get kicked out immediately after
- The key to escaping
moreis to make the terminal window small enough that the text doesn’t fit on screen andmoreis forced into interactive/pager mode instead of just printing and quitting.- Zoomed in a lot in the terminal to reduce the visible lines, then SSHed in
morepaused waiting for input.
- Zoomed in a lot in the terminal to reduce the visible lines, then SSHed in

- Once stuck in
more, pressedvto open the current file in vim.- From vim, used
:set shell=/bin/bashto change the shell vim would use, then:shellto drop into a real bash session.
- From vim, used
- From there explored the home directory, found a
to dofile with the SUID bit set, rancaton it and got the flag.
Password
5czgV9L3Xx8JPOyRbXh6lQbmIOWvPT6Z