Loly
Summary
This machine start by identifying a wordpress endpoint, enumerating users and bruteforcing the password, from there attacker can achieve shell access exploiting file upload feature. With access to the target the attacker can move to other system user and then get root access by identifying and exploiting kernel vulnerability.
Nmap Scan
Enumeration
Nmap only shows a HTTP service on port 80 and looking at it It does not show much just the index page for nginx server
If anything else is present it should be rendered on a separate path or vhost so I will start by a directory/file fuzzing to try and find that
This leads to wordpress endpoint that does a redirect so let’s check that.
No I have some content wot work with but the rendering is still broken, this usually happens when the referred files(CSS, javascript etc) are not properly loaded, the most common reason for that is that the page refer these files with a host name that our system does not know, and we can see that in the page source
To fix that I just need to add loly.lc to my /etc/hosts file so the system can resolve the hostname to the target IP
Once that is done the wordpress website should render properly on the browser and any other tools for crowling should be able to do their job properly since the host is known now
From the screenshot above I can identify user loly already the user who published the “Hello World!” post
I run wpscan to see if any thing interesting is identified but the only interesting path were authenticated attacks.
Foothold
Since interesting paths are authenticated I will try to bruteforce the identified user’s password, for wordpress I can use wpscan tool instead of hydra as it should be more adapted for wordpress.
so now I have access to this user and I can understand from the message indicated bellow that the user is wordpress administrator
Initial Access
As wordpress administrator the usual path is injeccting php either as web shell or reverse shell depending on what is available so let’s see what we can do here.
Get dj4m’s stories in your inbox
Join Medium for free to get updates from this writer.
I was able to find a file upload feature under adrotate
This does not allow to upload php files but since it allows zip files it probably handle unzipping the uploaded zip so I can use that to upload a zipped PHP then access it as raw PHP file. Trying that I uploaded my web shell file after creating the zip archeive
then I tried accessing under /banners which did not work at first but a quick search solved the problem the path was /wp-content/banners
Now I have a web shell where I can run commands on the system
I leverage that to a rev shell, I like having a web shell as first step because I can always use it to trigger as many rev shells as I need
through the rev shell I upgrade through python to have a better shell then I just get local.txt flag
Privilege Escalation
Looking through wordpress file I was able to find credentials in config file
and checking /etc/passwd I could identify the user on the system
Using that I was able to move to usr loly which was part of different groups
At this point manual enumeration did not lead anywhere so I fall back to linpeas which showed a bunch of paths
I was able to use the first listed exploit to get root access and drop the proof.txt flag









