CVE-2024-39688

6.5 MEDIUM

📋 TL;DR

This vulnerability in Bert-VITS2 allows attackers to write arbitrary files to the server by manipulating the data_dir parameter. It affects all users running Bert-VITS2 version 2.3 or earlier, potentially enabling directory traversal and information disclosure about server filesystem structure.

💻 Affected Systems

Products:
  • Bert-VITS2
Versions: 2.3 and earlier
Operating Systems: All
Default Config Vulnerable: ⚠️ Yes
Notes: All deployments using the vulnerable webui_preprocess.py file are affected regardless of configuration.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Attackers could overwrite critical system files, potentially leading to remote code execution, service disruption, or privilege escalation by manipulating configuration files.

🟠

Likely Case

Attackers write malicious configuration files to compromise the Bert-VITS2 application, potentially stealing data or disrupting service functionality.

🟢

If Mitigated

With proper input validation and file path restrictions, the impact is limited to error messages revealing directory existence without file writes.

🌐 Internet-Facing: HIGH
🏢 Internal Only: MEDIUM

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: LIKELY
Unauthenticated Exploit: ⚠️ Yes
Complexity: LOW

The vulnerability requires user input to the data_dir parameter, which is typically accessible via the web interface. Exploitation is straightforward with publicly available technical details.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 2.4 or later

Vendor Advisory: https://github.com/fishaudio/Bert-VITS2/security/advisories

Restart Required: Yes

Instructions:

1. Update Bert-VITS2 to version 2.4 or later. 2. Replace the vulnerable webui_preprocess.py file with the patched version. 3. Restart the Bert-VITS2 service.

🔧 Temporary Workarounds

Input Validation Filter

all

Add input validation to sanitize the data_dir parameter before processing

# Add path traversal checks in webui_preprocess.py
# Example: if '..' in data_dir or data_dir.startswith('/'): raise ValueError

File Permission Restriction

linux

Run Bert-VITS2 with minimal file system permissions

# Run as non-root user with restricted directory access
sudo chown -R bertvits:bertvits /path/to/bert-vits2
sudo chmod -R 750 /path/to/bert-vits2

🧯 If You Can't Patch

  • Implement strict input validation for the data_dir parameter to prevent directory traversal
  • Run the application in a containerized environment with read-only filesystem except for necessary directories

🔍 How to Verify

Check if Vulnerable:

Check if webui_preprocess.py contains the vulnerable code at lines 130-133 without proper path validation

Check Version:

python -c "import bert_vits2; print(bert_vits2.__version__)" or check package metadata

Verify Fix Applied:

Verify that webui_preprocess.py version 2.4 or later includes proper path sanitization and validation

📡 Detection & Monitoring

Log Indicators:

  • Unusual file write attempts to /config/config.json outside expected directories
  • Error messages containing directory traversal patterns (../)

Network Indicators:

  • HTTP requests with suspicious data_dir parameters containing path traversal sequences

SIEM Query:

source="bert-vits2" AND (data_dir="*../*" OR error="*directory*" OR action="*write*config.json*")

🔗 References

📤 Share & Export