Oopsie
Personal Rating: Easy
Enumeration
A first nmap scan reveals some open ports:
sudo nmap -sC <IP>
At the webserver the directory /cdn-cgi
was listable. The directory itself could be found by fuzzing for it with ffuf. I found /cdn-cgi/scripts/5c5dd728/cloudflare-static/email-decode.min.js
, which contained some credentials:
Web Access and Insecure Cookie Abuse
Logging in at the webserver at http://<TARGETIP>/cdn_cgi/login with the credentials I found, there was a file upload feature, that seemed to require higher permissions of some "super admin".
Since the page was PHP based and there was no session information in the URL, maybe there was a session cookie... I found the cookie, which was not a proper sessionID, but a custom string. In the public code of the /login/admin.php I found this:
So I got privileged access to http://<TARGETIP>/cdn_cgi/login/admin.php?content=uploads&action=upload
by loading that page with the cookie set to "34322".
Shell Access and Pillaging
At the upload page I could upload a PHP reverse shell and activate it with curl:
The shell was as the user www-data. Running cat /var/www/html/cdn-cgi/login/db.php
yielded the following credentials:
As that user robert I could establish an ssh connection.
Insecure Relative Path
Checking the groups of the user I saw that robert had the group "bugtracker". With this group you can execute /usr/bin/bugtracker as root. A simple strings bugtracker
shew me this:
I created the file /home/robert/soos/cat which is a script that starts /bin/bash. Then I exported the directory to the PATH, so that my version of cat is used when calling cat without an absolute path:
Executing the bugtracker binary now, I could start a root shell.
Last updated