Skip to content
Access control Disclosed report Intermediate

Delete a registered runner as unauthorised user

A project maintainer in one project could delete a runner registered in a different project by reading the runner's authentication token from an API response. This allowed an unauthorised user to delete a registered runner they did not own.

GitLab

Originally disclosed on GitLab

  • Fixed in 3 months
  • Disclosed after 3 months

HackerOne report #767493 by ashish_r_padelkar on 2020-01-03, assigned to @jeremymatos:

Summary

Hello,

This #685239 is fixed as per latest security release here https://about.gitlab.com/blog/2020/01/02/security-release-gitlab-12-6-2-released/ which is basically updating and removing runners as maintainers but this issue is different.

In this case, you as a project maintainer is able to delete registered runner in different project when you don't have rights to do it. This happens when runner is registered by user in separate project and is enabled in project where you have maintainers rights. You then as a project maintainer just have permissions to pause or enable/disable that runner within that project in UI. However, using below API, you can delete this registered runner from different project where you dont have rights.

curl --request DELETE "https://gitlab.example.com/api/v4/runners" --form "token=<authentication_token>"  

Steps to reproduce

  1. Create a group and 2 projects within it Project1 & Project2.
  2. As a project maintainer, register a runner in Project1.
  3. When you navigate to Project2, you have the option to enable it ( as you created in project1).
  4. Enable this runner in Project2.
  5. Add one more user as project maintainer in Project2
  6. Login as above user now i.e maintainer in Project2.
  7. Go to https://gitlab.com/<GroupName>/<ProjectName>/-/settings/ci_cd#js-runners-settings. You will see that you can either pause or disable the runner. You will not see Remove Runner option here because this runner is just registered in different project (Project1)where you don't have access.
  8. Now just visit the API https://gitlab.com/api/v4/runners/<ID> . You should see the ID in page itself.
  9. In response, you should see the value of token for this runner . Just copy it and use it in below API to delete this registered runner
curl --request DELETE "https://gitlab.com/api/v4/runners" --form "token=<Token_from_above_response>"  

What is the current bug behavior?

Allows unauthorised users to delete registered runner

What is the expected correct behavior?

In my opinion, token value should not be exposed to users in above situations.

Output of checks

This bug happens on GitLab.com and might be on omnibus installations too!

Regards,
Ashish

Impact

Allows unauthorised delete of registered token

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 exposed the runner's authentication token to any user who could view the runner in a project, without checking that the user had permission to manage the runner in its owning project.

Impact

An unauthorised user could delete a registered runner they do not have rights over.

What the attacker needed

A GitLab account; maintainer role in a project; runner enabled in that project

The fix

The token value should not be exposed to users who do not have permission to manage the runner in its owning project.

How it was found

  1. Create a group with two projects, Project1 and Project2.
  2. As a project maintainer, register a runner in Project1.
  3. Enable that runner in Project2.
  4. Add a second user as a maintainer of Project2 and log in as that user.
  5. Visit the API endpoint for the runner ID to obtain its token.
  6. Use the token to send a DELETE request to the runners API and delete the runner.

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.

A runner is a small program that runs jobs for a project. The report shows that a user with limited rights in one project could see a secret token for a runner that belonged to another project, and then use that token to delete the runner.

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.