CVE-2024-39688
📋 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
- Bert-VITS2
📦 What is this software?
Bert Vits2 by Fish.audio
⚠️ 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.
🎯 Exploit Status
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
allAdd 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
linuxRun 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
- https://github.com/fishaudio/Bert-VITS2/blob/76653b5b6d657143721df2ed6c5c246b4b1d9277/webui_preprocess.py#L130-L133
- https://github.com/fishaudio/Bert-VITS2/blob/76653b5b6d657143721df2ed6c5c246b4b1d9277/webui_preprocess.py#L34
- https://securitylab.github.com/advisories/GHSL-2024-045_GHSL-2024-047_fishaudio_Bert-VITS2/
- https://github.com/fishaudio/Bert-VITS2/blob/76653b5b6d657143721df2ed6c5c246b4b1d9277/webui_preprocess.py#L130-L133
- https://github.com/fishaudio/Bert-VITS2/blob/76653b5b6d657143721df2ed6c5c246b4b1d9277/webui_preprocess.py#L34
- https://securitylab.github.com/advisories/GHSL-2024-045_GHSL-2024-047_fishaudio_Bert-VITS2/