Skip to content
Info disclosure Disclosed report Beginner

Ability to access all user authentication tokens, leads to RCE

The project export feature included each team member's authentication token in the exported JSON file. An attacker could invite an admin to a project, export it, and obtain the admin's token, potentially leading to admin panel access and remote code execution.

jobert Follow

Originally disclosed on HackerOne

Critical 9.9 View original
  • Triaged in 2 hours
  • Fixed in 3 months
  • Disclosed after 3 months

Vulnerability details

The project export feature serializes the user objects of team members and stores it in the project.json file. This object contains the authentication_token for every user, meaning that an attacker can simply go ahead and create a project on GitLab.com, add one of the admins of GitLab.com, create an export, and obtain the authentication token for that user.

Proof of concept

Follow these steps to reproduce the issue:

  • create a test account on a GitLab instance and create a temporary repository
  • invite an admin of the GitLab instance as a team member to the repository
  • go to the repository settings and create an export
  • wait a few minutes until you received the export email
  • now go to http://gitlab-instance/account/repo/download_export
  • unzip the downloaded file and examine projects.json - the project_members will contain the user object that contains the authentication_token

Here's the first few bytes of rspeicher (sorry Robert) his authentication token on GitLab.com: ZyhqJr4XJZ.... Someone could get access to GitLab's admin panel by extracting the token of an admin and go to https://gitlab.com/admin/users?authentication_token=<token>. From what I've seen on my own GitLab instance, this leads to RCE and gives me access to all code in private repositories. Let me know if you need more information!

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

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 4 min read.

Context

GitLab's project export feature packages a project into an archive that can be downloaded and later re-imported. To make the archive self-contained, the exporter serialises the project's data, including its team members, into JSON files inside the archive. One of those files is project.json, and it holds the serialised user objects of the team members.

The report is about what those serialised user objects contain: the authentication_token of every user on the team. Because an attacker can control who is on the team of a project they own, they can cause another user's token to be written into an archive they can download.

Setup

The researcher used a test account on a GitLab instance and a temporary repository. The researcher used a test account and a temporary repository, and invited an admin as a team member. The target of the attack is any user who can be added as a team member, including an administrator of the instance. The report does not name a specific GitLab version.

Finding it

The researcher noticed that the project export serialises team member user objects into project.json, and that this object contains the authentication_token for every user. Since the contents of an export are determined by the project owner, and the owner can add arbitrary users to the team, the token of any user who accepts team membership ends up in a file the owner can download. That is the whole of the finding: a data exposure in the export serialisation, reachable by an ordinary user.

Exploitation

The reproduction is a short sequence of ordinary UI actions.

Step 1: create a test account and repository

Create a test account on a GitLab instance and create a temporary repository. This account is the attacker: it only needs the normal ability to own a project.

Step 2: invite an admin as a team member

Invite an admin of the GitLab instance as a team member to the repository. The report does not describe any restriction that prevents this, so the invitation is the only interaction the victim needs to perform.

Step 3: create an export

Go to the repository settings and create an export.

Step 4: wait for the export email

Wait a few minutes until the export email arrives. The export is delivered asynchronously by email rather than immediately.

Step 5: download the export

This endpoint serves the generated archive to the authenticated project owner.

Step 6: inspect the archive

Unzip the downloaded file and examine projects.json. The project_members array contains the user object, and that object contains the authentication_token.

The researcher demonstrated the result on GitLab.com itself, showing the first few bytes of the authentication token belonging to rspeicher: ZyhqJr4XJZ.... The token is truncated in the report, but the point is that a real administrator's token was present in an archive the researcher could download.

Step 7: use the token

With an administrator's token extracted this way, the attacker can reach the admin panel:

The report suggests the token could be used as an authentication parameter on the admin users page. From what the researcher observed on their own GitLab instance, this leads to RCE and gives access to all code in private repositories. That last part is hedged in the report: the RCE observation comes from the researcher's own instance, not from a demonstrated compromise of GitLab.com.

Root cause

The export serialiser includes the full user object for each team member, and that object carries the authentication_token attribute. Nothing in the export path strips or replaces the token before writing project.json.

The report also points out that the token could be passed as a query parameter to the admin users page.

Impact

Any user who can create a project and invite members can obtain the authentication token of any user who joins that project, including an instance administrator. With an administrator's token the attacker can reach the admin panel and, per the researcher's own-instance observation, potentially achieve RCE and read all code in private repositories. The demonstrated part on GitLab.com is the extraction of an administrator's token; the RCE claim is explicitly limited to what the researcher saw on their own instance.

Fix

What the finding calls for is to stop serialising authentication_token (and comparable credentials) into export archives, so that a project owner can never obtain another user's token through an export they control.

Variants to test

  1. Other export and import formats: trigger a full project, group or account export and grep the archive for token-like fields. A positive result is any credential belonging to another user appearing in a file you can download.
  2. Other serialised relations: check whether members, assignees, authors, awarders or mentioners are serialised with their full user objects. A positive result is a nested user object containing fields that are not shown in the UI.
  3. API representations: request project members through the API and compare fields with the web response. A positive result is a token or secret present in one representation but not the other.
  4. Token acceptance in odd places: try the token as a query parameter on authenticated pages, as in the report. A positive result is a session established or an authorised page rendered from the parameter alone.

Hunting notes

This class of bug hides in features that copy data between contexts: exports, imports, backups, templates, audit logs and notification payloads. The signal during recon is a feature that serialises related objects wholesale, especially when the serialiser is shared with API responses. The researcher ran the flow against GitLab.com and showed the first few bytes of an administrator's token. That concrete, reproducible chain, rather than a theoretical leak, is what makes the severity clear.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 11 min read.

What happened, in plain words

GitLab is a website where teams keep their code and work on it together. Every project on GitLab has a team: the people who are allowed to see and change that project. GitLab also has an export feature, which packs a whole project into a single downloadable file so it can be moved somewhere else or kept as a backup. Think of it like zipping up a folder before you send it to a colleague.

To make that packed file complete, GitLab writes the project's details into text files inside the archive. One of those files is called project.json. A .json file is just a text file that stores information in a structured way, a bit like a very tidy form with labels and values.

The problem is what GitLab put into that form. For every team member, it wrote down the person's authentication_token. A token is a string that identifies a user to the website. So the export file contained the authentication token of every team member.

Because anyone can create a project and invite other people to it, an attacker could create a project, invite an administrator of GitLab, export the project, and read the administrator's key out of the file. The report suggests the attacker could reach the admin panel with that token. The researcher showed this worked on GitLab.com itself, and reported that on their own GitLab instance it went further, all the way to running their own code on the server (RCE, short for remote code execution) and reading every private repository.

Context

GitLab's project export feature packages a project into an archive that can be downloaded and later re-imported. An archive here means a single file, like a zip file, that holds many files inside it. The point of the feature is portability: you take your project out of one place and put it into another.

To make the archive self-contained, the exporter serialises the project's data, including its team members, into JSON files inside the archive. Serialising means turning live data, such as a user account, into a flat text representation that can be stored in a file. One of those files is project.json, and it holds the serialised user objects of the team members. A user object is simply the bundle of information the site keeps about one person: their name, their settings, and in this case their token.

The report is about what those serialised user objects contain: the authentication_token of every user on the team. Because an attacker can control who is on the team of a project they own, they can cause another user's token to be written into an archive they can download. In everyday terms: you cannot read someone's diary, but you can invite them to a club you run, and the club's membership list, which you are allowed to print, happens to include a copy of their house key.

Setup

The researcher used a test account on a GitLab instance and a temporary repository. A repository is the storage space for a project's code and files. A GitLab instance is one installation of the GitLab software; GitLab.com is the public one, but organisations can also run their own private copies.

The only precondition is the ability to create a project and invite other users to it, which any ordinary user can do. No special rights are needed to start the attack. The target of the attack is any user who can be added as a team member, including an administrator of the instance. The report does not name a specific GitLab version.

Finding it

The researcher noticed that the project export serialises team member user objects into project.json, and that this object contains the authentication_token for every user. Since the contents of an export are determined by the project owner, and the owner can add arbitrary users to the team, the token of any user who accepts team membership ends up in a file the owner can download.

That is the whole of the finding: a data exposure in the export serialisation, reachable by an ordinary user. Data exposure means private information is written somewhere it should not be, in this case into a file that someone outside the team can obtain. The attacker does not break any lock; they simply use a feature as designed and find more inside the output than they should.

Exploitation

The reproduction is a short sequence of ordinary UI actions. UI means the normal web pages you click through in a browser, as opposed to commands or special tools.

Step 1: create a test account and repository

Create a test account on a GitLab instance and create a temporary repository. This account is the attacker: it only needs the normal ability to own a project. The word temporary matters only in that the researcher did not need a lasting setup; a throwaway project is enough.

Step 2: invite an admin as a team member

Invite an admin of the GitLab instance as a team member to the repository. An admin is a user with the highest level of control over the whole installation, including other people's accounts and settings. The report does not describe any restriction that prevents this, so the invitation is the only interaction the victim needs to perform. In other words, the administrator does not have to click anything dangerous or install anything; accepting a normal team invitation is enough.

Step 3: create an export

Go to the repository settings and create an export. This is the same button any project owner would press to back up or move their project. The attacker is not misusing the button; they are using it exactly as intended, and the problem is in what the button produces.

Step 4: wait for the export email

Wait a few minutes until the export email arrives. The export is delivered asynchronously by email rather than immediately. Asynchronous means the work happens in the background: you ask for the archive, the server builds it on its own time, and then it notifies you. This is why a few minutes pass before anything is ready.

Step 5: download the export

This is an HTTP request, the same kind your browser sends whenever you open a page. GET is the method that means "give me this". The address points at the download endpoint on the GitLab instance, under the account and repository path, and ends in download_export, which is the part that tells the server to hand over the generated archive. The server checks who is asking, sees the project owner, and serves the file. This endpoint serves the generated archive to the authenticated project owner.

Step 6: inspect the archive

Unzip the downloaded file and examine projects.json. The project_members array contains the user object, and that object contains the authentication_token. An array is simply a list inside the JSON file; project_members is the list of team members, and each entry in it is one person's user object with their token inside.

The researcher demonstrated the result on GitLab.com itself, showing the first few bytes of the authentication token belonging to rspeicher: ZyhqJr4XJZ.... The token is truncated in the report, but the point is that a real administrator's token was present in an archive the researcher could download. Truncated means only the beginning is shown, enough to prove the value is real without publishing the whole key.

Step 7: use the token

With an administrator's token extracted this way, the attacker can reach the admin panel:

This is another HTTP request. GET again means "give me this page". The path /admin/users is the administration page that lists users, which only an administrator should be able to open. Everything after the ? is the query string: extra information passed along with the address. Here the query string is authentication_token=<token>, where <token> stands in for the stolen value. The report suggests passing the token as an authentication parameter on the admin users page.

From what the researcher observed on their own GitLab instance, this leads to RCE and gives access to all code in private repositories. RCE, remote code execution, means the attacker can make the server run commands of their choosing, which is about as much control as an outsider can get. That last part is hedged in the report: the RCE observation comes from the researcher's own instance, not from a demonstrated compromise of GitLab.com.

Root cause

The export serialiser includes the full user object for each team member, and that object carries the authentication_token attribute. An attribute is one labelled field inside an object, like one line on a form. Nothing in the export path strips or replaces the token before writing project.json. Stripping would mean deleting the field; replacing would mean swapping the real value for something useless. Neither happened.

A credential is anything that proves who you are, such as a password or a token. The export was meant to carry project material; it also carried other people's keys.

The report also points out that the token could be passed as a query parameter to the admin users page. A query parameter is the part of a web address after the ?. Accepting a credential in the address itself is risky, because addresses get logged, shared and saved in browser history far more casually than passwords. Rotation would mean changing the token regularly so a stolen copy goes stale; scoping would mean limiting what a token is allowed to do.

Impact

Any user who can create a project and invite members can obtain the authentication token of any user who joins that project, including an instance administrator. With an administrator's token the attacker can reach the admin panel and, per the researcher's own-instance observation, potentially achieve RCE and read all code in private repositories. The demonstrated part on GitLab.com is the extraction of an administrator's token; the RCE claim is explicitly limited to what the researcher saw on their own instance.

Fix

What the finding calls for is to stop serialising authentication_token (and comparable credentials) into export archives, so that a project owner can never obtain another user's token through an export they control. In plain terms: when packing the project into a file, leave the keys out of the box.

Variants to test

  1. Other export and import formats: trigger a full project, group or account export and grep the archive for token-like fields. Grep means searching text for a pattern. A positive result is any credential belonging to another user appearing in a file you can download.
  2. Other serialised relations: check whether members, assignees, authors, awarders or mentioners are serialised with their full user objects. These are all different roles a person can have on a project. A positive result is a nested user object containing fields that are not shown in the UI. Nested means an object sitting inside another object, like a box within a box.
  3. API representations: request project members through the API and compare fields with the web response. An API is a way for programs to talk to a service directly, returning the same data in a machine-friendly form rather than as a web page. A positive result is a token or secret present in one representation but not the other.
  4. Token acceptance in odd places: try the token as a query parameter on authenticated pages, as in the report. A positive result is a session established or an authorised page rendered from the parameter alone. A session is the state of being logged in; if a page renders for you just because the token was in the address, the token alone was enough.

Hunting notes

This class of bug hides in features that copy data between contexts: exports, imports, backups, templates, audit logs and notification payloads. A context is simply a place where data ends up, such as a file, an email or a log. The signal during recon is a feature that serialises related objects wholesale, especially when the serialiser is shared with API responses. Recon, short for reconnaissance, is the early looking-around phase before attacking anything. Wholesale means everything at once, with no filtering.

The researcher ran the flow against GitLab.com and showed the first few bytes of an administrator's token. A prefix is the start of a value. That concrete, reproducible chain, rather than a theoretical leak, is what makes the severity clear. Reproducible means someone else can follow the same steps and see the same result.

Glossary

  • Admin: a user with the highest level of control over a whole GitLab installation.
  • API: a way for programs to talk to a service directly and receive data in a machine-friendly form.
  • Archive: a single file, such as a zip, that contains many files inside it.
  • Array: a list of items inside a JSON file.
  • Asynchronous: work that happens in the background, with the result delivered later.
  • Attribute: one labelled field inside an object, like one line on a form.
  • Authentication token: a long random string that acts like a password, proving who you are to a website.
  • Credential: anything that proves your identity, such as a password or a token.
  • Data exposure: private information being written somewhere it should not be, where someone else can reach it.
  • Endpoint: a specific address on a server that performs a particular action.
  • Export: a feature that packs a project into a downloadable file.
  • GET: the HTTP method meaning "give me this page or file".
  • Grep: searching text for a pattern.
  • HTTP: the language browsers and servers use to exchange pages and files.
  • JSON: a plain-text format for storing structured information as labelled fields and lists.
  • Nested: an object sitting inside another object, like a box within a box.
  • Object: a bundle of labelled information about one thing, such as one user.
  • Prefix: the beginning of a value.
  • Query parameter: extra information attached to a web address after the ?.
  • Query string: the whole part of a web address after the ?.
  • RCE (remote code execution): the ability for an attacker to make a server run commands of their choosing.
  • Recon: the early looking-around phase before attacking anything.
  • Repository: the storage space for a project's code and files.
  • Reproducible: something another person can repeat and get the same result.
  • Rotation: regularly changing a credential so a stolen copy goes stale.
  • Scoping: limiting what a credential is allowed to do.
  • Serialise: turn live data into a flat text form that can be stored in a file.
  • Session: the state of being logged in to a website.
  • Stripping: deleting a field before data is written out.
  • Truncated: cut short, with only the beginning shown.
  • UI: the normal web pages you click through in a browser.
  • User object: the bundle of information a site keeps about one person.
  • Wholesale: everything at once, with no filtering.

More by jobert

View all

67 more disclosed reports, best first.

More from GitLab

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Information disclosure

The lesson behind this report.

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.