Lack of authorization for integrated error tracking
The integrated error tracking endpoints in GitLab did not require authentication, allowing anyone to read, update, or delete error data for any project. An attacker could bypass role-based access controls and access sensitive error information.
GitLab
Originally disclosed on GitLab
- Fixed in 18 days
- Disclosed after 18 days
HackerOne report #1748522 by 0xn3va on 2022-10-24, assigned to GitLab Team:
Report | How To Reproduce
Report
Summary
In the latest release Gitlab provided integrated error tracking that implements a lightweight alternative to Sentry backend. It allows developers to use Gitlab backend as a collector for errors. You can find the docs here. In gitlab.com DSN URL looks like:
https://glet_<token>[@]observe.gitlab.com:443/errortracking/api/v1/projects/<project_id>
So, you can use this URL for working with a Sentry-like API that allows you to perform at least the following actions:
GET /projects/{projectId}/errors/{fingerprint}Get information about the errorGET /projects/{projectId}/errorsList of errorsGET /projects/{projectId}/errors/{fingerprint}/eventsGet information about the events related to the errorPUT /projects/{projectId}/errors/{fingerprint}Update the status of the errorGET /projects/{projectId}/errors/{fingerprint}/eventsGet information about the events related to the errorPOST /projects/api/{projectId}/envelopeIngestion endpoint for error events sent from client SDKsPOST /projects/api/{projectId}/storeIngestion endpoint for error events sent from client SDKsDELETE /projects/{id}Deletes all project related data. Mostly for testing purposes and later for production to clean updeleted projects.
The problem is that these endpoints do not require authentication. As a result, it is possible to gain unauthorized access to the errors and even update/delete them.
Steps to reproduce
-
Clone the following files on your laptop
https://gitlab.com/gitlab-org/opstrace/opstrace/-/tree/main/docs/guides/user/error_tracking_examples/python -
Create a virtualenv:
Bash virtualenv -p python3 venv source venv/bin/activate -
Install dependencies:
Bash pip install -r requirements.txt -
Create a private repo
-
Go to
Settings > Monitor > Error tracking -
Enable error tracking and set Gitlab as error tracking backend
-
Save changes and reload the page
-
Catch the DSN token
-
Export the DSN token to environment variables:
Bash export SENTRY_DSN="https://glet_<token>[@]observe.gitlab.com:443/errortracking/api/v1/projects/<project_id>" -
Run the python script:
Bash python send_exception.py -
The script uploads an error to the backend; you can find this error on the
Monitor > Error Trackingpage -
Send the following request to retrieve errors for the your project:
Bash curl "https://observe.gitlab.com:443/errortracking/api/v1/projects/<PROJECT_ID>/errors" -
Send the following request to delete all errors in the your project:
Bash curl -XDELETE "https://observe.gitlab.com:443/errortracking/api/v1/projects/<PROJECT_ID>"
Impact
According to the docs user must have at least Reporter role to access errors and Maintainer to manage them. This vulnerability allows an attacker to bypass these restrictions and gain unauthorized access to errors.
What is the current bug behavior?
Integrated error tracking does not implement authorization for accessing and managing errors.
What is the expected correct behavior?
Integrated error tracking requires a token for making requests and provides access to errors according to the permission policy.
Output of checks
This bug happens on GitLab.com
Impact
According to the docs user must have at least Reporter role to access errors and Maintainer to manage them. This vulnerability allows an attacker to bypass these restrictions and gain unauthorized access to errors.
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
The error tracking API endpoints lacked authentication and authorization checks.
Impact
An attacker could bypass role-based access controls to read, update, or delete error data for any project, potentially exposing sensitive information.
What the attacker needed
Knowledge of the project ID; No authentication required
The fix
The endpoints should require authentication and enforce the permission policy.
How it was found
- Clone the example error tracking files from GitLab's repository.
- Set up a Python virtual environment and install dependencies.
- Create a private GitLab repository and enable error tracking with GitLab as the backend.
- Capture the DSN token from the error tracking settings.
- Run the provided Python script to send an error to the backend.
- Send a request to the errors endpoint without authentication to retrieve or delete errors.
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.
Error tracking is a feature that collects and displays errors from applications. In GitLab, this data should only be visible to project members with certain roles. However, the endpoints that handle this data were not protected, so anyone who knew the project ID could access or modify the errors without logging in.
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.