Skip to content
Access control Disclosed report Beginner

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:

Ruby
Feature.enable(:ml_experiment_tracking)  

in the console.

Steps to reproduce

  1. As the admin, create a public project and keep track of the project ID
  2. Next, as a non-member of the project created in step 1, say with User A account, create an API token
  3. Next, make the POST following request, and make sure to set the :id variable to the id of step 1:

https://YOUR-GITLAB-INSTANCE/v4/projects/:id/ml/mlflow/api/2.0/mlflow/experiments/create
payload:

JSON
{"name":"experiment by user A"}  
  1. 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):

Ruby
        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:

The original report as published on GitLab. Images and videos are our own copies; raw HTML is shown as text. View it on GitLab.

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

  1. As admin, create a public project and note its ID.
  2. As a non-member user, create an API token.
  3. Send a POST request to the MLflow experiments create endpoint with the project ID and a JSON body containing an experiment name.
  4. 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.

More from GitLab

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

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.