Page cover

Week 2. Analytics

TL;DR

This is an Ubuntu 22.04 host running an HTTP server on port 80. The vulnerable web application running is Metabase, and using the appropriate exploit RCE can be gained. For escalation, a kernel vulnerability is abused.

KEYWORDS

Metabase, CVE-2023-38646, GameOver(lay), CVE-2023-2640, CVE-2023-32629.

REFERENCES

https://www.cvedetails.com/cve/CVE-2023-38646

https://www.cvedetails.com/cve/CVE-2023-2640

https://www.cvedetails.com/cve/CVE-2023-32629

https://blog.assetnote.io/2023/07/22/pre-auth-rce-metabase/

https://github.com/securezeron/CVE-2023-38646

https://github.com/g1vi/CVE-2023-2640-CVE-2023-32629

ENUMERATION

Port scan.

Fuzz for hidden subdomains.

Browsing the hidden subdomain at http://data.analitycal.htb we find a login portal for a Metabase service.

Searching for Metabase vulnerabilities we find out there is a vulnerability (https://www.cvedetails.com/cve/CVE-2023-38646) in the /api/setup/validate endpoint, which can lead to RCE.

USER

Search for a PoC in GitHub: https://github.com/securezeron/CVE-2023-38646. Analyzing it, we see first step is to obtain setup token, for this, just query the /api/session/properties endpoint and find setup-token field. Then, to obtain RCE, we query the api/setup/validate endpoint with the setup token and the appropriate payload.

We can do this ourselves with Burpsuite.

So the setup token is "setup-token" : "249fa03d-fd94-4d5b-b94f-b4ebf3df681f". For the payload, just use a base64 sh -i shell and query the endpoint building a post request with Burpsuite.

If this does not work, just use the PoC with the shell hardcoded in base64 within the source code.

After issuing the exploit, a sh shell is received on port 9001. Enumerate the system.

We are in some kind of limited Ubuntu system, maybe a container. Looking around we find a script /app/run_metabase.sh to start the database where some environmental variables are manipulated, so let's enumerate with env

Clear text credentials are found here. So we can just login using them.

This is a low-priv shell enough to retrieve user flag.

SYSTEM

Now we have a full shell out of the container, enumerate system again.

Notice the system is Ubuntu 22.04 and kernel is 6.2.0. This release is vulnerable to GameOver(lay) Ubuntu Privilege Escalation (CVE-2023-2640 and CVE-2023-32629).

To escalate privileges, just download and execute exploit available in GitHub (https://github.com/g1vi/CVE-2023-2640-CVE-2023-32629).

After running the exploit, a root shell spawns.

You are root.

Last updated