Fix artifact path traversal vector#19260
Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses a critical security vulnerability (ZDI-CAN-26649) that allowed directory traversal attacks through malicious meta.yaml files placed in artifact folders. The fix validates run directory structure before treating a directory as a valid run, preventing attackers from accessing files outside intended directories.
- Adds run directory validation to check for required subdirectories (metrics/, params/, artifacts/)
- Implements validation in
_find_run_root()to reject invalid run directories - Includes comprehensive regression test demonstrating the blocked attack vector
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| mlflow/store/tracking/file_store.py | Adds _is_valid_run_directory() method and integrates validation into _find_run_root() to prevent path traversal via malicious meta.yaml files in artifact folders |
| tests/store/tracking/test_file_store.py | Adds regression test test_malicious_meta_yaml_in_artifact_folder_path_traversal() that verifies the attack scenario is properly blocked |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Documentation preview for 6fd7b94 is available at: More info
|
Signed-off-by: Ben Wilson <benjamin.wilson@databricks.com>
8b79bb3 to
c897739
Compare
Signed-off-by: Ben Wilson <benjamin.wilson@databricks.com>
| FileStore.PARAMS_FOLDER_NAME, | ||
| FileStore.ARTIFACTS_FOLDER_NAME, | ||
| ] | ||
| return all(is_directory(os.path.join(run_dir, subdir)) for subdir in required_subdirs) |
There was a problem hiding this comment.
What if the attacker creates arbitrary folders for these?
There was a problem hiding this comment.
This is a FANTASTIC point! Let me go ahead and add some hardening to this to prevent this other mechanism. Thank you, @serena-ruan !!
Signed-off-by: Ben Wilson <benjamin.wilson@databricks.com>
🛠 DevTools 🛠
Install mlflow from this PR
For Databricks, use the following command:
Related Issues/PRs
#xxxWhat changes are proposed in this pull request?
Prevent artifact path traversal attacks by validating paths when logging to a local filestore backend.
How is this PR tested?
Does this PR require documentation update?
Release Notes
Is this a user-facing change?
What component(s), interfaces, languages, and integrations does this PR affect?
Components
area/tracking: Tracking Service, tracking client APIs, autologgingarea/models: MLmodel format, model serialization/deserialization, flavorsarea/model-registry: Model Registry service, APIs, and the fluent client calls for Model Registryarea/scoring: MLflow Model server, model deployment tools, Spark UDFsarea/evaluation: MLflow model evaluation features, evaluation metrics, and evaluation workflowsarea/gateway: MLflow AI Gateway client APIs, server, and third-party integrationsarea/prompts: MLflow prompt engineering features, prompt templates, and prompt managementarea/tracing: MLflow Tracing features, tracing APIs, and LLM tracing functionalityarea/projects: MLproject format, project running backendsarea/uiux: Front-end, user experience, plotting, JavaScript, JavaScript dev serverarea/build: Build and test infrastructure for MLflowarea/docs: MLflow documentation pagesHow should the PR be classified in the release notes? Choose one:
rn/none- No description will be included. The PR will be mentioned only by the PR number in the "Small Bugfixes and Documentation Updates" sectionrn/breaking-change- The PR will be mentioned in the "Breaking Changes" sectionrn/feature- A new user-facing feature worth mentioning in the release notesrn/bug-fix- A user-facing bug fix worth mentioning in the release notesrn/documentation- A user-facing documentation change worth mentioning in the release notesShould this PR be included in the next patch release?
Yesshould be selected for bug fixes, documentation updates, and other small changes.Noshould be selected for new features and larger changes. If you're unsure about the release classification of this PR, leave this unchecked to let the maintainers decide.What is a minor/patch release?
Bug fixes, doc updates and new features usually go into minor releases.
Bug fixes and doc updates usually go into patch releases.