> For the complete documentation index, see [llms.txt](https://hacktricks.xsx.tw/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hacktricks.xsx.tw/network-services-pentesting/8086-pentesting-influxdb.md).

# 8086 - Pentesting InfluxDB

<figure><img src="/files/se5N2OCbiHd0PbneketN" alt=""><figcaption></figcaption></figure>

\
使用 [**Trickest**](https://trickest.com/?utm_campaign=hacktrics\&utm_medium=banner\&utm_source=hacktricks) 来轻松构建和**自动化工作流程**，利用世界上**最先进**的社区工具。\
立即获取访问权限：

{% embed url="<https://trickest.com/?utm_campaign=hacktrics&utm_medium=banner&utm_source=hacktricks>" %}

<details>

<summary><strong>从零开始学习 AWS 黑客技术，成为专家</strong> <a href="https://training.hacktricks.xyz/courses/arte"><strong>htARTE（HackTricks AWS 红队专家）</strong></a><strong>！</strong></summary>

支持 HackTricks 的其他方式：

* 如果您想看到您的**公司在 HackTricks 中做广告**或**下载 PDF 版本的 HackTricks**，请查看[**订阅计划**](https://github.com/sponsors/carlospolop)!
* 获取[**官方 PEASS & HackTricks 商品**](https://peass.creator-spring.com)
* 探索[**PEASS 家族**](https://opensea.io/collection/the-peass-family)，我们的独家[**NFT**](https://opensea.io/collection/the-peass-family)收藏品
* **加入** 💬 [**Discord 群组**](https://discord.gg/hRep4RUj7f) 或 [**电报群组**](https://t.me/peass) 或在 **Twitter** 🐦 [**@carlospolopm**](https://twitter.com/hacktricks_live)\*\* 上关注我们\*\*。
* 通过向 [**HackTricks**](https://github.com/carlospolop/hacktricks) 和 [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github 仓库提交 PR 来分享您的黑客技巧。

</details>

## 基本信息

**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
```

存在一个漏洞，允许绕过身份验证：[**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
```

#### 显示表/测量

[**InfluxDB文档**](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
```

#### 显示列/字段键

字段键类似于数据库的**列**

```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
```

{% hint style="warning" %}
在进行身份验证绕过测试时，注意到表名需要用双引号括起来，例如：`select * from "cpu"`
{% endhint %}

### 自动化身份验证

```bash
msf6 > use auxiliary/scanner/http/influxdb_enum
```

<details>

<summary><strong>从零开始学习AWS黑客技术，成为专家</strong> <a href="https://training.hacktricks.xyz/courses/arte"><strong>htARTE（HackTricks AWS红队专家）</strong></a><strong>！</strong></summary>

支持HackTricks的其他方式：

* 如果您想看到您的**公司在HackTricks中做广告**或**下载PDF格式的HackTricks**，请查看[**订阅计划**](https://github.com/sponsors/carlospolop)!
* 获取[**官方PEASS & HackTricks周边产品**](https://peass.creator-spring.com)
* 探索[**PEASS家族**](https://opensea.io/collection/the-peass-family)，我们的独家[**NFTs**](https://opensea.io/collection/the-peass-family)
* **加入** 💬 [**Discord群**](https://discord.gg/hRep4RUj7f) 或 [**电报群**](https://t.me/peass) 或 **关注**我们的**Twitter** 🐦 [**@carlospolopm**](https://twitter.com/hacktricks_live)**。**
* 通过向[**HackTricks**](https://github.com/carlospolop/hacktricks)和[**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github仓库提交PR来分享您的黑客技巧。

</details>

<figure><img src="/files/se5N2OCbiHd0PbneketN" alt=""><figcaption></figcaption></figure>

\
使用[**Trickest**](https://trickest.com/?utm_campaign=hacktrics\&utm_medium=banner\&utm_source=hacktricks)轻松构建和**自动化工作流程**，利用世界上**最先进**的社区工具。\
立即获取访问权限：

{% embed url="<https://trickest.com/?utm_campaign=hacktrics&utm_medium=banner&utm_source=hacktricks>" %}
