{"cve":"CVE-2023-50731","nvd":{"published":"2023-12-22T21:15:08.150","modified":"2026-06-17T06:39:52.580","status":"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.","cvss_v4":null,"cvss_v3":{"version":"3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:H","score":9.1},"cwes":["CWE-22","CWE-918"],"references":["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/security/advisories/GHSA-j8w6-2r9h-cxhj","https://securitylab.github.com/advisories/GHSL-2023-182_GHSL-2023-184_mindsdb_mindsdb/","https://github.com/mindsdb/mindsdb/blob/1821da719f34c022890c9ff25810218e71c5abbc/mindsdb/api/http/namespaces/file.py#L122-L125"],"products":["mindsdb:mindsdb"],"source":"nvd","synced_at":"2026-10-19T21:43:38.875533635+00:00"},"epss":{"cve":"CVE-2023-50731","score":0.00983,"percentile":0.62323,"date":"2026-10-31"},"kev":null,"osv":[{"id":"GHSA-j8w6-2r9h-cxhj","url":"https://osv.dev/vulnerability/GHSA-j8w6-2r9h-cxhj","summary":"GitHub Security Lab (GHSL) Vulnerability Report: Arbitary write GHSL-2023-182 ","modified":"2024-11-22T18:27:34.025044Z","packages":[{"ecosystem":"PyPI","name":"mindsdb","purl":"pkg:pypi/mindsdb","ranges":["<23.11.4.1"],"fixed":["23.11.4.1"]}]},{"id":"PYSEC-2023-279","url":"https://osv.dev/vulnerability/PYSEC-2023-279","summary":"","modified":"2024-11-21T14:57:10.219827Z","packages":[{"ecosystem":"PyPI","name":"mindsdb","purl":"pkg:pypi/mindsdb","ranges":["<23.11.4.1"],"fixed":["23.11.4.1"]}]}],"attribution":["This product uses the NVD API but is not endorsed or certified by the NVD.","EPSS scores: FIRST Exploit Prediction Scoring System, https://www.first.org/epss","Known exploited vulnerabilities: CISA Known Exploited Vulnerabilities Catalog, https://www.cisa.gov/known-exploited-vulnerabilities-catalog","Package advisories: OSV (https://osv.dev), from the GitHub Advisory Database, PyPA, Go, RustSec and other ecosystem databases, under CC-BY 4.0 or CC0","CVE records: the CVE Program's CVE List (https://www.cve.org), under its terms of use (https://www.cve.org/Legal/TermsOfUse). CVE is a registered trademark of The MITRE Corporation; this product is not affiliated with the CVE Program."]}