Reconnaissance
First, I added the new host to my known ones:
Then, I performed a Nmap scan:
So I took a look at the webpage:
Inspecting the source code I discovered the /signup
section, but itโs currently unavailable:
So I decided to check for virtual hosts enumeration with Wfuzz ๐:
So I added the new vhost and visited it:
Checking Wappalyzer, it seems that the server is using Node.js.
Exploitation
If we check Hacktricks, we can find a NUNJUCKS SSTI:
I got errors executing the upper payloads:
So I escaped the quotes:
I got a reverse shell :D and can read user flag
Privilege escalation
Enumerating the filesystem we see that perl
has setuid capabilities set:
So I checked GTFOBins:
If we now try to read the /etc/shadow
file we canโt even with the setuid
enabled:
So I checked the output of the whoami
command:
I tried to read the root.txt
flag but had no permissions:
This has to be an AppArmor Profile stablished for perl. If we perform some enumeration:
There is a profile for perl :/
Inspecting the root path, I found a script in /opt
:
We can see that the script has the setuid
set to 0, but we cannot make any changes to the script.
I checked the Apparmor version:
So I searched in Google for โApparmor bugsโ. I found the following shebang bug in Launchpad, so I created a script that executes a shell as root:
I executed it and became root. Got root flag!
Machine pwned!