
MLflow <=3.17.1 path traversal allows trace file writes outside the intended directory.
<= 3.17.1 StartTraceV3 Path TraversalSeverity: High, CVSS 3.1 8.2
Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:L
Affected: MLflow versions <= 3.17.1 when using the FileStore tracking backend
Component: MLflow Tracing API, StartTraceV3 / FileStore.start_trace()
CWE: CWE-22 (Improper Limitation of a Pathname to a Restricted Directory), CWE-23 (Relative Path Traversal), CWE-73 (External Control of File Name or Path)
Discovered and reported by: Sai Teja Erukude
MLflow accepts a client-controlled trace_info.trace_id through the
StartTraceV3 tracing API. When the tracking backend is FileStore, this ID is
used in filesystem path construction without rejecting traversal segments such
as ../.
An attacker can submit a trace ID such as ../../../escaped-trace-dir to
escape the intended experiment trace directory. MLflow then creates
trace-related files in the resolved directory outside the trace storage tree.
When the tracing endpoint is exposed without authentication or access restrictions, an unauthenticated client can influence the filesystem location of MLflow-controlled trace files on a FileStore-backed server, subject to the server process's filesystem permissions. The included PoC uses Flask's local test client; it does not test a deployment's network exposure or authentication configuration.
The PoC demonstrates writes outside the intended experiment trace directory:
trace_info.yaml, containing client-supplied trace information.request_metadata/poc_metadata, containing attacker-controlled metadata.tags/poc_tag, containing an attacker-controlled tag value.This affects integrity by allowing request data to control where trace-related files are written. Unexpected directories and files outside the trace storage tree may also cause limited availability impact. The demonstrated write uses MLflow's trace file formats and filenames; it does not establish arbitrary file contents, code execution, or a confidentiality impact.
The report assigns the following CVSS 3.1 metrics:
| Metric | Value |
|---|---|
| Attack Vector (AV) | Network (N) |
| Attack Complexity (AC) | Low (L) |
| Privileges Required (PR) | None (N) |
| User Interaction (UI) | None (N) |
| Scope (S) | Unchanged (U) |
| Confidentiality (C) | None (N) |
| Integrity (I) | High (H) |
| Availability (A) | Low (L) |
The vulnerable request path is:
POST /api/3.0/mlflow/traces
-> _start_trace_v3()
-> TraceInfo.from_proto(...)
-> FileStore.start_trace(trace_info)
-> filesystem path construction using trace_info.trace_id
-> directory creation and trace information, metadata, and tag writes
The request supplies the ID inside trace.trace_info:
{
"trace": {
"trace_info": {
"trace_id": "../../../escaped-trace-dir",
"trace_location": {
"type": "MLFLOW_EXPERIMENT",
"mlflow_experiment": {
"experiment_id": "0"
}
},
"trace_metadata": {
"poc_metadata": "attacker-controlled metadata"
},
"tags": {
"poc_tag": "attacker-controlled tag"
}
}
}
}
This excerpt shows the fields relevant to traversal. The runner builds the complete request, including the trace state, timestamp, and preview fields.
The client-controlled ID produces the following path resolution relative to the PoC directory:
Expected trace storage: mlruns/0/traces/
Supplied trace ID: ../../../escaped-trace-dir
Joined trace path: mlruns/0/traces/../../../escaped-trace-dir/
Resolved trace path: escaped-trace-dir/
The saved response returns HTTP 200 and preserves the malicious trace ID.
The resulting files sit beside mlruns/, outside the intended experiment trace
directory.
run_poc.py builds a malicious StartTraceV3 request, configures
a local FileStore, invokes the real MLflow HTTP route through Flask's test
client, and records the response and filesystem evidence. It exercises the
route without starting a listening network server.
python -m venv .venv
.\.venv\Scripts\Activate.ps1
python -m pip install -r requirements.txt
python -B run_poc.py
To print the machine-readable result:
python -B run_poc.py --json
The saved evidence contains these results, abbreviated here:
{
"package": {
"distribution": "mlflow",
"version": "3.17.1"
},
"endpoint": "/api/3.0/mlflow/traces",
"status_code": 200,
"malicious_trace_id": "../../../escaped-trace-dir",
"checks": {
"http_success": true,
"trace_info_written_outside_traces_dir": true,
"trace_metadata_file_written": true,
"tag_file_written": true
},
"success": true
}
The runner saves:
evidence/start-trace-request.json:
the complete request body.evidence/start-trace-response.json:
the server response.evidence/escaped-trace-info.yaml:
a copy of the trace information written outside the trace directory.evidence/summary.json:
the package version, resolved paths, status code, and verification results.success: true and exit code 0 mean the traversal was reproduced. A failed check
returns exit code 1; this alone does not prove that a version is fixed.
The payload writes demonstration trace data under escaped-trace-dir/ inside
the PoC directory. The runner also writes mlruns/ and evidence/; rerunning
it replaces the saved evidence. Use a fresh copy when collecting new results,
because the runner checks for files that may already exist from an earlier run.
Absolute paths in the saved evidence identify the original reproduction
environment and will differ in a new checkout.
A local demo video is included.
Validate trace IDs at the FileStore boundary before constructing paths or creating directories:
Enforce these checks before filesystem side effects. Invalid IDs should raise
INVALID_PARAMETER_VALUE, with the HTTP route returning 400. Valid trace
IDs should continue to work. Keep filesystem-specific restrictions in the
FileStore backend so other backends can retain their supported ID formats.
Until a tested patch is deployed, restrict access to the trace-creation endpoint or move trace tracking to a configured SQL backend after checking compatibility.
See fix.md for the suggested patch, compatibility considerations,
and regression checks. The lookup and deletion recommendations come from source
review; the included PoC demonstrates the StartTraceV3 creation path.