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

107 lines
4.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 8086 - Pentesting InfluxDB
{{#include ../banners/hacktricks-training.md}}
## 基本情報
**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**](https://github.com/LorenzoTullini/InfluxDB-Exploit-CVE-2019-20933)
### 手動列挙
この例の情報は[**こちら**](https://oznetnerd.com/2017/06/11/getting-know-influxdb/)から取得されました。
#### データベースの表示
見つかったデータベースは`telegraf``internal`です(このデータベースはどこにでもあります)。
```bash
> show databases
name: databases
name
----
telegraf
_internal
```
#### テーブル/測定値を表示
The [**InfluxDB documentation**](https://docs.influxdata.com/influxdb/v1.2/introduction/getting_started/) は、InfluxDBの**測定値**がSQLテーブルに相当することを説明しています。これらの**測定値**の命名法は、それぞれの内容を示しており、特定のエンティティに関連するデータを格納しています。
```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 ...]
```
#### テーブルのダンプ
最後に、次のようにして**テーブルをダンプ**できます。
```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
```
{{#include ../banners/hacktricks-training.md}}