Information
Room
- Name: Oh My WebServer
- Profile: tryhackme.com
- Difficulty: Medium
- Description: Can you root me?
Write-up
Overview
Install tools used in this WU on BlackArch Linux:
Network enumeration
Port and service scan with nmap:
Let's add a custom domain:
Web enumeration
There are no links to some interesting features:
Let's enumerate files and folders then:
There is no specific page to see.
Apache httpd 2.4.49 is vulnerable to CVE-2021-41773 and
CVE-2021-42013
Web exploitation
The RCE is available on metasploit:
We run with the user daemon:
Elevation of privilege (EoP): from daemon to root (docker)
We don't see any non-daemon user in /home
or /etc/passwd
.
There is a /.dockerenv
proving we are in a docker container.
Either with linpeas or getcap
we can find binaries with capabilities.
Let's see how to exploit that:
It's then easy to get root access:
Elevation of privilege (EoP): from root (docker) to root (host)
We can find the IP address of the container.
Let's assume that 172.17.0.1 is the docker host.
If you don't want to import a static binary on the machine you can still use
a basic alternative in bash.
Output:
On HackTricks we
can learn the 5986 port is hosting the OMI service:
OMI is an open-source remote configuration management tool developed by Microsoft. OMI agents are commonly found installed on Azure Linux servers.
There is a vulnerability CVE-2021-38647 aka OMIGOD
targeting this service.
So let's serve it on our host...
... and upload it on the target.
First, we can see it works and dump the flag.