Non-member user is capable of creating Model experiment and updating existing run's status in other user's public project
The MLflow experiment tracking API did not check project membership, only token scopes. A non-member with an API token could create and read machine learning experiment records in any public project.
GitLab
Originally disclosed on GitLab
- Fixed in 31 days
- Disclosed after 31 days
⚠️ Please read the process on how to fix security issues before starting to work on the issue. Vulnerabilities must be fixed in a security mirror.
HackerOne report #2083440 by ricardobrito on 2023-07-25, assigned to @cmaxim:
Report | How To Reproduce
Report
Hi team!
Summary
Gitlab 16.2 recently introduced the ability to Track your machine learning model experiments. This feature contains some API calls that allows Machine Learning engineers to use Gitlab to track the parameters, results, etc of their Machine Learning experiments. However, I found that the API does not verify whether the user is a member of the project in which he creates/lists machine learning experiments.
Pre-requisites
This feature seems to be behind a feature flag, which can be enabled using:
Feature.enable(:ml_experiment_tracking)
in the console.
Steps to reproduce
- As the admin, create a public project and keep track of the project ID
- Next, as a non-member of the project created in step 1, say with User A account, create an API token
- Next, make the POST following request, and make sure to set the
:idvariable to theidof step 1:
https://YOUR-GITLAB-INSTANCE/v4/projects/:id/ml/mlflow/api/2.0/mlflow/experiments/create
payload:
{"name":"experiment by user A"}
- Now as the admin go to
https://YOUR-GITLAB-INSTANCE/root/:project-path/-/ml/experiments
You will see the experiment created by user A, even though he is not a member of the project.
Technical details
I am not 100% sure of the reason why this happens but it seems that this section of code located in the file lib/api/ml/mlflow/entrypoint.rb (lines 13-21), only check if the user has a token with the proper access scopes (not whether the user is a member of the project):
helpers ::API::Ml::Mlflow::ApiHelpers
allow_access_with_scope :api
allow_access_with_scope :read_api, if: ->(request) { request.get? || request.head? }
feature_category :mlops
content_type :json, 'application/json'
default_format :json
Impact
A non-member of a project is capable of creating and reading Machine Learning experiments records inside the project.
How To Reproduce
Please add reproducibility information to this section:
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the API endpoint only enforced token scope checks and omitted a project membership authorisation check.
Impact
A non-member could create and read machine learning experiment records inside a public project.
What the attacker needed
Feature flag ml_experiment_tracking enabled; a public project; an API token for a non-member account
How it was found
- As admin, create a public project and note its ID.
- As a non-member user, create an API token.
- Send a POST request to the MLflow experiments create endpoint with the project ID and a JSON body containing an experiment name.
- As admin, visit the project's ML experiments page and observe the experiment created by the non-member.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
An API is a way for programs to talk to a service. This service let users create machine learning experiment records, but it only checked that the user had a valid API token, not that they belonged to the project. So anyone with a token could add or view experiment data in someone else's public project.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.