CVE-2023-50731
MindsDB has arbitrary file write in file.py
Also known as GHSA-j8w6-2r9h-cxhj, PYSEC-2023-279
Mitigation
- Upgrade mindsdb to 23.11.4.1 or later.
Who should check
- Projects that depend on PyPI package mindsdb (< 23.11.4.1)
- Anyone running mindsdb < 23.11.4.1
Vulnerability facts
- Affected
- mindsdb < 23.11.4.1
- Fixed in
- 23.11.4.1
- Exploited in the wild
- Not in CISA KEV
- Public exploit / PoC
- Yes: see the exploit references below
- Remote exploitation
- Remote, no login needed
- CVSS
- 9.1 (v3.1, CNA)CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:HOpen in CVSS calculator
Show all 8 CVSS metrics
- Attack vector: Network
- Attack complexity: Low
- Privileges required: None
- User interaction: None
- Scope: Unchanged
- Confidentiality impact: None
- Integrity impact: High
- Availability impact: High
- EPSS
- 1.22% chance of exploitation in 30 days (percentile 68, 2026-11-26)
- CWE
- CWE-918
- Modified
Description
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.
Affected and fixed versions
Check your systems with an agent
Paste this into Claude Code, Cursor or another coding agent. It only reads; it changes nothing.
Check whether anything I run is affected by CVE-2023-50731. Work read-only: do not install, upgrade, delete or change anything. Details: https://flawdb.com/CVE-2023-50731.md Affected: mindsdb < 23.11.4.1 Fixed in: 23.11.4.1 Steps: 1. Search this machine and project for mindsdb (PyPI), mindsdb: dependency manifests and lockfiles, installed packages, container images and running services. 2. For each match, note the installed version and whether it is inside the affected range. 3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
References
Vendor advisories
Exploits and PoCs
Other
- 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
FAQ
Is CVE-2023-50731 being exploited?
There is no confirmed exploitation: CVE-2023-50731 is not in the CISA Known Exploited Vulnerabilities catalog. Public exploit code or a proof of concept is available. EPSS estimates a 1.22% chance of exploitation in the next 30 days (as of 2026-11-26).
How serious is CVE-2023-50731?
Critical: CVSS 9.1 (v3.1, scored by CNA). Remote, no login needed.
Which versions are affected by CVE-2023-50731?
mindsdb < 23.11.4.1.
Is there a fix for CVE-2023-50731?
Yes. Fixed in 23.11.4.1. Upgrade mindsdb to 23.11.4.1 or later.
How do I check if I'm affected by CVE-2023-50731?
Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.