Ambassador
Gaining Access
Nmap scan:
$ nmap -p- --min-rate 5000 10.129.228.56
Starting Nmap 7.93 ( https://nmap.org ) at 2023-05-07 05:49 EDT
Nmap scan report for 10.129.228.56
Host is up (0.015s latency).
Not shown: 65531 closed tcp ports (conn-refused)
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
3000/tcp open ppp
3306/tcp open mysqlPort 80
The only interesting thing here is the mentioning of the user developer:

Other than that, there was not much here.
Grafana LFI -> Creds
Port 3000 was hosting a Grafana instance.

This version of Grafana is vulnerable to public exploits:
We can confirm that this works:

Grafana stores a configuration file at /etc/grafana/grafana.ini, so let's start there. We can find some passwords within that:
With this, we can login to the admin panel:

Within the configuration files, we can find a mysql.yaml file.

We can't edit it, and there wasn't any credentials in it:

However, maybe we can use the LFI to read this file on the machine itself.
Based on this documentation, it is located in/etc/grafana/provisioning/datasources.

Using these creds, we can login to the MySQL database on the machine:
Then, we can use the whackywidget database to find the password for developer.
We can then login as developer via ssh using this password.
Privilege Escalation
Consul Token -> RCE
I was wondering where that whackywidget dataabse came from and why it had the password for the user instead of the grafana database. Within the /opt directory, we can find some additional folders:
consul is an application used to configure and spin up applications with databases:
The application on the machine starts on port 8500, and we can also find out the version running:
There are some exploits for this:
However, we first need to find the token within the files. Within the /opt/my-app directory, there's a .git repository.
If we check the logs, we can find the token:
Afterwards, just run the PoC above on the machine itself.
This would give us a reverse shell as root.

Last updated
