Reconnaissance
First, I added the new host to my known ones:
Then I performed an Nmap scan:
So letโs inspect the webpage:
After inspecting the source code, I decided to perform a dirsearch ๐ scan. I didnโt find anything, so I decided to perform a Ffuf ๐ณ domain scan:
Note
The
-fc
option is to filter by status codes
I added the new subdomains to my known hosts and took a look at them:
A Free Software Learning Management system was found, Chamilo.
Weaponization
I found this script: CVE-2023-4220
Exploitation
Once cloned, I used the script like:
Weโve got a shell :D
Stabilize the shell with:
Unfortunately, weโve got no read permissions on userโs home. So now I uploaded linpeas to gather information. I found the userโs mtz
password:
So I connected through ssh and got the user flag :D
Privilege Escalation
If we run linpeas again, we found the following:
If we run sudo -l
:
Letโs inspect that script:
This script allows us to set specific permissions on a specific file for a given user, but:
- The file path must be under
/home/mtz/
- The file path cannot contain directory traversal symbols
..
So, what we can do here is to create a symbolic link to the /etc/passwd
file in the /home/mtz
directory. Then edit the file to add a privileged user:
- Generate a password hash (in your machine):
- Escalate:
- Check the passwd file to confirm that the new privileged user exists:
Now just login as the new user:
gitblanc:gitblanc
, and got the root flag
Machine pwned!