The vulnerability in MLflow allows unauthorized access to multipart upload (MPU) endpoints due to a flaw in the authorization logic. The analysis of the provided patch in commit d7290811d8f3c95366d80109424edc1fb1ad966f points to two specific functions whose incomplete implementation is the root cause of the issue.
-
mlflow.server.auth._is_proxy_artifact_path: This function is intended to check if a request path corresponds to an artifact operation that requires an authorization check. The vulnerable version of this function did not recognize the paths for MPU endpoints (/mlflow-artifacts/mpu/*). Consequently, any requests to these endpoints were not flagged for authorization, creating a security hole.
-
mlflow.server.auth._get_proxy_artifact_validator: This function is responsible for selecting the appropriate authorization validator based on the HTTP method of the request. The vulnerable version did not have a mapping for the POST method, which is the method used by the MPU endpoints. This omission meant that even if the path was identified as an artifact path, no authorization would be performed for POST requests.
An attacker could exploit this vulnerability by sending a POST request to an MPU endpoint for an experiment they are not authorized to access. The flawed logic in _is_proxy_artifact_path and _get_proxy_artifact_validator would cause the authorization check to be skipped, allowing the attacker to overwrite artifacts. This could lead to serious security implications such as model supply chain poisoning or arbitrary code execution when a compromised model is loaded and used.
The patch rectifies these issues by updating _is_proxy_artifact_path to include the MPU paths and by adding a POST method handler to _get_proxy_artifact_validator. These changes ensure that MPU operations are subjected to the same authorization checks as other artifact-related operations.