8086 - Pentesting InfluxDB

Reading time: 5 minutes

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をサポートする

基本情報

InfluxDB は、InfluxData によって開発されたオープンソースの 時系列データベース (TSDB) です。TSDB は、タイムスタンプと値のペアからなる時系列データの保存と提供に最適化されています。一般的なデータベースと比較して、TSDB は時系列データセットの ストレージスペースパフォーマンス において大幅な改善を提供します。特化した圧縮アルゴリズムを使用し、古いデータを自動的に削除するように設定できます。特化したデータベースインデックスもクエリパフォーマンスを向上させます。

デフォルトポート: 8086

PORT     STATE SERVICE VERSION
8086/tcp open  http    InfluxDB http admin 1.7.5

列挙

ペンテスターの観点から見ると、これは機密情報を保存している可能性のある別のデータベースであるため、すべての情報をダンプする方法を知っておくことは興味深いです。

認証

InfluxDBは認証を必要とする場合としない場合があります。

bash
# Try unauthenticated
influx -host 'host name' -port 'port #'
> use _internal

このようなエラーが発生した場合: ERR: unable to parse authentication credentials認証情報を期待していることを意味します。

influx –username influx –password influx_pass

InfluxDBには認証をバイパスする脆弱性がありました: CVE-2019-20933

手動列挙

この例の情報はこちらから取得されました。

データベースの表示

見つかったデータベースはtelegrafinternalです(このデータベースはどこにでもあります)。

bash
> show databases
name: databases
name
----
telegraf
_internal

テーブル/測定値の表示

The InfluxDB documentation explains that measurements in InfluxDB can be paralleled with SQL tables. The nomenclature of these measurements is indicative of their respective content, each housing data relevant to a particular entity.

bash
> show measurements
name: measurements
name
----
cpu
disk
diskio
kernel
mem
processes
swap
system

Show columns/field keys

フィールドキーはデータベースのカラムのようなものです

bash
> 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 ...]

Dump Table

そして最後に、次のようにしてテーブルをダンプできます。

bash
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

warning

認証バイパスのテストでは、テーブル名はダブルクォーテーションで囲む必要があることが確認されました。例: select * from "cpu"

自動認証

bash
msf6 > use auxiliary/scanner/http/influxdb_enum

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をサポートする