MindsDB has arbitrary file write in file.py
Key facts
- Attack vector
- Network
- Privileges required
- None
- User interaction
- None
- Attack complexity
- Low
- Impact type
- —
- Confidentiality · integrity · availability
- None · High · High
- Fix status
- Fixed
Attack profile from CVSS 3.1 · CNA. Fix status from CNA and GitHub.
Summary
MindsDB is a SQL Server for artificial intelligence. Prior to version 23.11.4.1, the `put` method in `mindsdb/mindsdb/api/http/namespaces/file.py` does not validate the user-controlled name value, which is used in a temporary file name, which is afterwards opened for writing on lines 122-125, which leads to path injection. Later in the method, the temporary directory is deleted on line 151, but since we can write outside of the directory using the path injection vulnerability, the potentially dangerous file is not deleted. Arbitrary file contents can be written due to `f.write(chunk)` on line 125. Mindsdb does check later on line 149 in the `save_file` method in `file-controller.py` which calls the `_handle_source` method in `file_handler.py` if a file is of one of the types `csv`, `json`, `parquet`, `xls`, or `xlsx`. However, since the check happens after the file has already been written, the files will still exist (and will not be removed due to the path injection described earlier), just the `_handle_source` method will return an error. The same user-controlled source source is used also in another path injection sink on line 138. This leads to another path injection, which allows an attacker to delete any `zip` or `tar.gz` files on the server.
Why it matters now
SSVC decision points
Not available: CISA has not published SSVC decision points for this record.
Affected products
| Vendor | Product | Affected versions | Fixed in | Status | Source |
|---|---|---|---|---|---|
| mindsdb | mindsdb | before 23.11.4.1 | 23.11.4.1 | Patch available | CNA |
| — | mindsdb (PyPI) | before 23.11.4.1 | 23.11.4.1 | Patch available | GHSA-j8w6-2r9h-cxhj |
- mindsdb Vendormindsdb Affected before 23.11.4.1 Fixed in 23.11.4.1 Patch available CNA
- mindsdb (PyPI) Vendor— Affected before 23.11.4.1 Fixed in 23.11.4.1 Patch available GHSA-j8w6-2r9h-cxhj
Remediation
- Fix · CNA mindsdb (mindsdb) Fixed in 23.11.4.1
- Fix · GHSA-j8w6-2r9h-cxhj mindsdb (PyPI) Fixed in 23.11.4.1 Advisory →
Timeline
- 2026-10-02 Threatist record created from CVE-2023-50731
- 2026-10-03 Alias added: GHSA-j8w6-2r9h-cxhj
References
Advisory 3
Other 4
- https://github.com/mindsdb/mindsdb/blob/1821da719f34c022890c9ff25810218e71c5abbc/mindsdb/api/http/namespaces/file.py#L122-L125
- https://github.com/mindsdb/mindsdb/blob/1821da719f34c022890c9ff25810218e71c5abbc/mindsdb/api/http/namespaces/file.py#L138
- https://github.com/mindsdb/mindsdb
- https://github.com/pypa/advisory-database/tree/main/vulns/mindsdb/PYSEC-2023-279.yaml
More Mindsdb vulnerabilities
- TI-2024-16276 MindsDB Vulnerable to Bypass of SSRF Protection with DNS Rebinding CVSS 3.1CRITICAL 9.3
- TI-2026-21890 MindsDB has Path Traversal in /api/files Leading to Remote Code Execution CVSS 3.1HIGH 8.8
- TI-2024-30805 Code injection in mindsdb CVSS 3.1HIGH 8.8
- TI-2024-30804 Code injection in mindsdb CVSS 3.1HIGH 8.8
- TI-2024-30803 Code injection in mindsdb CVSS 3.1HIGH 8.8
- TI-2024-30802 Code injection in mindsdb CVSS 3.1HIGH 8.8
Sources
- CVE-2023-50731 · CVE Program
- CVE-2023-50731 · NVD
- FIRST EPSS
- GHSA-j8w6-2r9h-cxhj · GitHub Advisory Database · CC BY 4.0
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences