Linux Restricted Shell Bypass Guide
Linux Restricted Shell Bypass Guide
in/matrix-1-vulnhub-walkthrough/
$PATH
echo /home/guest/prog/*
echo $SHELL
!/bin/bash
export SHELL=/bin/bash:$SHELL
export PATH=/usr/bin:$PATH
sudo -l
sudo su
export PATH=/bin:$PATH
sudo su
[ 5 ] Advanced Techniques
[ 6 ] Time to Practice
Introduction
Hello, so first of all let’s explain what is a restricted shell ? A restricted shell is a shell
that block/restricts some of the commands like cd,ls,echo etc or
"block" the environment variables like SHELL,PATH,USER. Sometimes a restricted shell
can block the commands with / or the redirecting outputs like >,>>. The types of a
restricted shell can be : rbash,rksh,rsh. But now why someone want to create a
restricted shell ? Let’s say some examples :
1)To improve Security
2)To block hackers/pentesters.
3)Sometimes system administrators create a restricted shell to protect theirselves from
dangerous commands.
4)For a CTF Challenge. (Root-me/hackthebox/vulnhub).
Enumeration Linux Environment
Enumeration is the most important part. We need to enumeration the
Linux environmental to check what we can do to bypass the rbash.
We need to enumerate :
C SETUID SHELL :
Time For Practise
Root-me have a INSANE rbash bypass challenge!
https://www.root-me.org/en/Challenges/App-Script/Restricted-shells
https://www.hackthebox.eu/