Skip to content
Account takeover Write-up Intermediate

GitLab Account Takeover: One Reset Email, Two Inboxes

The password reset endpoint accepted an email field as a list instead of a single address, so when the victim's address was submitted alongside an attacker-controlled one, the reset link was sent to both. An attacker who knew a victim's email could take over their account, including administrators of self-managed GitLab instances.

medium.com

Published on medium.com

Bug Bounty

Muhammad Asim Shahzad, on medium.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

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. 5 min read.

Context

GitLab is a source code hosting and DevOps platform, available both as the hosted GitLab.com service and as self-managed installations. In GitLab 16.1, released in May 2023, a change let users reset their password through a secondary email address. That new convenience path is where the bug sat: in the email verification step of the secondary-email reset flow.

Normally the password reset form takes one email address from the request body, looks up the matching account, and mails a reset link to the address on that account. The security of the whole flow depends on where the recipient address comes from.

AI-generated illustration From the original on medium.com

The illustration above heads the write-up; it is described as AI-generated.

Setup

The write-up is an analytical case study of a public disclosure, not a first-hand reproduction, and it deliberately omits reproduction details. The facts come from two sources: HackerOne report #2293343 by the researcher known as asterion04, disclosed in February 2025, and GitLab's critical security release advisory of 11 January 2024.

The write-up describes the attack as needing only knowledge of the victim's email address.

  • The secondary-email reset path was introduced in GitLab 16.1, released in May 2023.
  • The attacker knows the email address associated with the victim's account.
  • No access to the victim's inbox, no click from the victim and no prior access to the instance are required.

Finding it

The researcher found that the reset endpoint took the email from the request body and would also accept that field as a list rather than a single value. A form that asks for one email address quietly accepted many. That mismatch between the expected type and the accepted type is what made the flow interesting: if the server both looks up the account and chooses the recipient from the same user-controlled field, the two decisions can be made to disagree.

Exploitation

Step 1: submit the victim's address together with a second one

The reset request carries the victim's email plus one more address, the one the attacker controls, in the same field. The write-up does not reproduce the raw request, so the exact parameter encoding is not shown; the essential shape is a single field holding a list of addresses.

Step 2: GitLab matches the victim's account

The server matches the victim's account from the victim's address in the list.

Step 3: the reset link goes to every address in the list

GitLab then mails the reset link to every address in the submitted list, including the unverified address the attacker supplied. The attacker receives the reset link for the victim's account.

No click from the victim, no phishing and no prior access were needed. Knowing an account's email was enough.

Root cause

The bug is password reset poisoning through parameter type confusion: an array was accepted where a single email was expected. The reset endpoint took the email from the request body, and the recipient of the reset mail was derived from that same request field rather than from the account record. The account lookup and the delivery decision therefore used different notions of "the email": the lookup matched the victim, while delivery honoured the whole list.

The write-up maps this analytically to CWE-640 (Weak Password Recovery Mechanism) and CWE-20 (Improper Input Validation), noting that the mapping is its own and not from the source. GitLab's advisory places the bug in the email verification step of the secondary-email reset path introduced in 16.1. The write-up's own analysis is that the field's type was not pinned before the lookup and the recipient was not constrained to a trusted address.

Impact

Anyone could take over any GitLab account whose email they knew, including administrators of self-managed instances. Those instances hold source code, CI secrets and deploy keys, so the blast radius of an administrator takeover is large.

GitLab rated the issue Critical with a CVSS 3.1 base score of 10.0, assigned CVE-2023-7028 and paid a $35,000 bounty. There is one real limit: with two-factor authentication enabled, the password could still be reset, but the attacker could not log in. GitLab reported no detected abuse on GitLab-managed platforms.

Fix

GitLab.com was already patched by the time of the 11 January 2024 advisory, and self-managed versions 16.1 through 16.7 received backported fixes.

The write-up also sets out its own defensive analysis for reset flows of this kind:

  1. Pin parameter types. If a field is one email, reject anything that is not exactly one string, before any lookup.
  2. Send only to addresses the server already trusts. The recipient comes from the account record, never from the request.
  3. Test the shape, not just the value. Arrays, nested objects and duplicate keys belong in every auth test suite.
  4. Treat reset as a login. Require 2FA after a reset and alert the user on every reset request.

Its illustrative handler and test note are reproduced here as published:

Python
def request_reset(params):    email = params.get("email")    if not isinstance(email, str):                   return generic_ok()                      user = find_user_by_verified_email(email.strip().lower())    if user is None:        return generic_ok()    token = issue_reset_token(user)              send_reset_mail(user.email_matching(email), token)      return generic_ok()
Text
# Test: email=["victim@x", "other@y"] must send zero mails to other@y

Variants to test

  • Array where a scalar is expected. Submit the email field as a list containing the victim's address and an attacker address. A positive result is a reset mail delivered to the attacker address while the token belongs to the victim's account.
  • A positive result is the server accepting the structure and choosing a recipient other than the account's verified address.
  • A positive result is a reset link reaching an unverified inbox.
  • Recipient source divergence. Compare which address the lookup uses with which address receives the mail. A positive result is any case where the two differ.
  • A positive result is a reset that completes without the second factor being required to finish the takeover.

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. 14 min read.

What happened, in plain words

GitLab is a website and a piece of software that teams use to store and share the code they write, and to run the automated steps that build and test that code. You can use it as a hosted service called GitLab.com, or you can install it on your own computers, which is called a self-managed installation. Think of it as a shared online filing cabinet for a company's most valuable documents: the source code, the passwords and keys that let the software talk to other systems, and the credentials that let it publish new versions.

Every account on GitLab is protected by a password. If you forget your password, the site offers a "forgot password" form: you type your email address, and GitLab sends a message to that address containing a special link. Clicking the link lets you choose a new password. This is called a password reset flow. The whole safety of that flow rests on one question: who does the reset link actually get sent to? If the answer is always "the inbox that belongs to the account owner", the flow is safe. If an attacker can make the answer be "the attacker's inbox", the attacker can take over the account.

In December 2023, a security researcher who goes by the name asterion04 found that GitLab's reset form could be tricked on exactly that question. The form asked for one email address, but it quietly accepted a list of addresses. When the researcher submitted the victim's address together with an address the researcher controlled, GitLab looked up the victim's account correctly, but then sent the reset link to every address in the list, including the researcher's. The researcher received a working reset link for someone else's account and could set a new password.

GitLab rated the problem Critical, with a CVSS score of 10.0, the highest possible. It assigned the identifier CVE-2023-7028 and paid a $35,000 bounty. A bounty is a reward a company pays to someone who reports a security flaw responsibly instead of abusing it. The bug was fixed in January 2024.

AI-generated illustration From the original on medium.com

The illustration above heads the write-up; it is described as AI-generated.

This article is an analytical case study of a public disclosure, not a first-hand reproduction of the attack, and it deliberately leaves out the exact steps needed to repeat it. The facts come from two sources: HackerOne report #2293343 by asterion04, disclosed in February 2025, and GitLab's critical security release advisory of 11 January 2024. HackerOne is a platform where companies run bounty programmes and researchers submit reports.

The background you need

Before the details make sense, a few ideas need to be clear.

What a request is. When you fill in a form on a website and press a button, your browser sends a message to the website's server. That message is called a request. It contains the values you typed, packaged in a structured format so the server can read them. The server reads the request, does something, and sends back a response, usually a web page or a short confirmation.

What an API is. An API is the part of a website that accepts these requests and answers them, without drawing a page for a human. Think of a restaurant: the dining room is the website you see, the kitchen is the server doing the work, and the API is the waiter who carries your order to the kitchen and brings the result back. When you press "send reset link", your browser is placing an order through the waiter.

What a parameter is. Each value in a request is called a parameter. In the reset form, the parameter is the email address you typed. A parameter has a name (here, email) and a value (the address).

What a type is. In computing, every value has a type. A single piece of text, like [redacted], is a string. A list of several values is an array. A form that expects one email expects a string. An array is a different shape, and a well-behaved server should reject it if it only wants one address.

What a token is. A token is a long random string that acts like a temporary key. When you request a password reset, the server creates a token, stores it next to your account, and puts it in the link it emails you. When you click the link, the server checks the token and, if it matches, lets you set a new password. Because the token is random and secret, only the person who received the email can use it. This is why stealing the email is equivalent to stealing the account.

What account takeover means. Account takeover is when someone else gains control of your account without your permission. In this case, the attacker does not need your old password: they use the reset flow to set a new one.

What CVSS and CVE mean. CVSS is a scoring system that rates how severe a security flaw is, from 0 to 10. A score of 10.0 means the worst case: easy to exploit and very damaging. A CVE is a public catalogue number given to a known vulnerability so people can refer to it unambiguously. CVE-2023-7028 is this bug's catalogue entry.

What two-factor authentication (2FA) is. 2FA is a second proof of identity on top of your password, usually a short code from a phone app. Even if someone knows your password, they cannot log in without the code. Keep this in mind, because it turns out to matter a lot here.

The setup

The conditions for the attack were simple, which is part of why the bug was so serious:

  • The secondary-email reset path was introduced in GitLab 16.1, released in May 2023. A version number is like a release label: 16.1 came out in May 2023.
  • The attacker knows the email address associated with the victim's account.
  • No access to the victim's inbox, no click from the victim and no prior access to the GitLab instance are required.

That last point is the striking one. The attacker does not need to trick the victim into clicking anything, which is what most people expect from an email-based attack. They only need to know which email address the victim uses.

Finding it

The researcher found that the reset endpoint took the email from the request body and would also accept that field as a list rather than a single value. In other words, a form that asks for one email address quietly accepted many.

Why does that matter? Because the server has to make two decisions: which account to reset, and where to send the email. If both decisions are made from the same field that the user controls, the two decisions can be made to disagree. The server can find the victim's account from the list, and then, when sending, treat the whole list as the set of recipients. That mismatch between the expected type (one string) and the accepted type (an array) is the heart of the bug. Security people call this parameter type confusion: the server is confused about what kind of value it received.

How the attack worked, step by step

Step 1: submit the victim's address together with a second one

The reset request carries the victim's email plus one more address, the one the attacker controls, in the same field. The write-up does not reproduce the raw request, so the exact parameter encoding is not shown; the essential shape is a single field holding a list of addresses.

Think of it like a form at a hotel reception that says "guest name" but accepts a list of names. You write the real guest's name first, so the receptionist finds the right booking, and then your own name second, so the key to the room is also copied to you.

Step 2: GitLab matches the victim's account

The server matches the victim's account from the victim's address in the list. At this point the server has done its job correctly: it found the right account and created the right key. The mistake comes next.

Step 3: the reset link goes to every address in the list

GitLab then mails the reset link to every address in the submitted list, including the unverified address the attacker supplied. The attacker receives the reset link for the victim's account.

No click from the victim, no phishing and no prior access were needed. Knowing an account's email was enough. Phishing is the usual trick of sending a fake email to make someone click a link; here, nothing was sent to the victim at all.

Why it worked

The bug is password reset poisoning through parameter type confusion: an array was accepted where a single email was expected. The reset endpoint took the email from the request body, and the recipient of the reset mail was derived from that same request field rather than from the account record. The account lookup and the delivery decision therefore used different notions of "the email": the lookup matched the victim, while delivery honoured the whole list.

The write-up maps this analytically to CWE-640 (Weak Password Recovery Mechanism) and CWE-20 (Improper Input Validation), noting that the mapping is its own and not from the source. CWE is a catalogue of weakness categories, similar in spirit to CVE but for classes of mistake rather than individual bugs. GitLab's advisory places the bug in the email verification step of the secondary-email reset path introduced in 16.1. A secondary email is an extra address a user can add to their account; the new convenience path let people reset their password through it.

The write-up's own analysis is that the field's type was not pinned before the lookup and the recipient was not constrained to a trusted address. In plain terms: the server never checked that the value was a single string, and it never checked that the address it was about to email was the one stored on the account.

How bad it was

Anyone could take over any GitLab account whose email they knew, including administrators of self-managed instances. Those instances hold source code, CI secrets and deploy keys, so the blast radius of an administrator takeover is large. CI secrets are the passwords and keys used by automated build systems, and deploy keys are the credentials that let a system publish code to servers. An administrator account is the master key to all of that.

GitLab rated the issue Critical with a CVSS 3.1 base score of 10.0, assigned CVE-2023-7028 and paid a $35,000 bounty. There is one real limit: with two-factor authentication enabled, the password could still be reset, but the attacker could not log in. In other words, 2FA did not stop the reset, but it did stop the final takeover, because the attacker still lacked the second code. GitLab reported no detected abuse on GitLab-managed platforms.

The fix

GitLab.com was already patched by the time of the 11 January 2024 advisory, and self-managed versions 16.1 through 16.7 received backported fixes. A backported fix is a repair written for an older version, so people who have not upgraded to the newest release still get protected.

The write-up also sets out its own defensive analysis for reset flows of this kind:

  1. Pin parameter types. If a field is one email, reject anything that is not exactly one string, before any lookup. In everyday terms: if the form says one name, refuse a list of names at the door.
  2. Send only to addresses the server already trusts. The recipient comes from the account record, never from the request. The server should look up the account, then read the address from its own stored record, not from what the visitor typed.
  3. Test the shape, not just the value. Arrays, nested objects and duplicate keys belong in every auth test suite. Testing the shape means trying odd structures, not just odd text.
  4. Treat reset as a login. Require 2FA after a reset and alert the user on every reset request. If a reset is as powerful as a login, it should be guarded like one.

Its illustrative handler and test note are reproduced here as published:

Python
def request_reset(params):    email = params.get("email")    if not isinstance(email, str):                   return generic_ok()                      user = find_user_by_verified_email(email.strip().lower())    if user is None:        return generic_ok()    token = issue_reset_token(user)              send_reset_mail(user.email_matching(email), token)      return generic_ok()

Line by line, in plain words:

  • def request_reset(params): defines a function called request_reset that receives the parameters from the request.
  • email = params.get("email") pulls out the value of the email field.
  • if not isinstance(email, str): checks whether that value is a single string. If it is a list, or anything else that is not a string, the condition is true.
  • return generic_ok() then stops and returns a generic success message. The point of a generic message is to avoid telling an attacker whether their input was rejected for a specific reason.
  • user = find_user_by_verified_email(email.strip().lower()) looks up the account using the email, after trimming spaces and lowercasing it so capitalisation does not matter.
  • if user is None: checks whether no account was found.
  • return generic_ok() again returns the same generic message, so an attacker cannot tell a real address from a fake one.
  • token = issue_reset_token(user) creates the reset token for the found account.
  • send_reset_mail(user.email_matching(email), token) sends the mail. The recipient is chosen from the account record, not from the raw request, which is the key defensive change.
  • return generic_ok() finishes with the same generic message.
Text
# Test: email=["victim@x", "other@y"] must send zero mails to other@y

This is a test note, not code that runs. It says: when the email field is a list containing the victim's address and another address, the system must send no mail at all to the other address. It is a reminder that the test should check the shape of the input, not only its text.

Variants to test

If you ever review a reset flow, these are the shapes worth trying. Each one is a variation on the same theme: make the server's idea of "the email" differ from the account's real email.

  • Array where a scalar is expected. Submit the email field as a list containing the victim's address and an attacker address. A positive result is a reset mail delivered to the attacker address while the token belongs to the victim's account. JSON is a common text format for structured data; an array is a list written inside square brackets.
  • A positive result is the server accepting the structure and choosing a recipient other than the account's verified address. A nested object is a value that itself contains named fields, like a box inside a box.
  • A positive result is a reset link reaching an unverified inbox. An unverified address is one the user typed but never proved they own.
  • Recipient source divergence. Compare which address the lookup uses with which address receives the mail. A positive result is any case where the two differ. This is the general principle behind the whole bug: the lookup and the delivery must agree.
  • A positive result is a reset that completes without the second factor being required to finish the takeover.

What to take away

A reset flow is only as safe as the place it takes the recipient from. If that place is the request, the visitor controls it. Frameworks happily parse arrays; validate type before meaning. In other words, check that the value is the right shape before you decide what it means. And new convenience paths, like secondary emails, need the same security review as the original flow, because a shortcut around the front door is still a way in.

Glossary

  • API: the part of a website that accepts requests and returns answers, without drawing a page for a human.
  • Account takeover: gaining control of someone else's account without their permission.
  • Array: a list of several values, as opposed to a single value.
  • Backport: a fix written for an older version of software so people who have not upgraded still get protected.
  • Bounty: a reward a company pays to someone who reports a security flaw responsibly.
  • CI secrets: the passwords and keys used by automated build and test systems.
  • CVE: a public catalogue number given to a known vulnerability.
  • CVSS: a scoring system that rates the severity of a security flaw from 0 to 10.
  • CWE: a catalogue of categories of software weakness.
  • Deploy keys: credentials that let a system publish code to servers.
  • Endpoint: the specific address on a server that accepts a particular kind of request.
  • Generic message: a reply that does not reveal why a request was rejected, so attackers cannot learn from it.
  • JSON: a common text format for structured data, using braces and square brackets.
  • Parameter: a named value sent in a request, such as the email address in a form.
  • Parameter type confusion: a bug where the server accepts a different kind of value than it expected, such as a list where it wanted one item.
  • Password reset flow: the process that lets a user set a new password after forgetting the old one, usually by emailing a link.
  • Phishing: sending a fake message to trick someone into clicking a link or giving away information.
  • Request: the message a browser sends to a server when you use a website.
  • Secondary email: an extra email address a user adds to their account.
  • Self-managed installation: GitLab installed and run on a company's own computers rather than used as the hosted service.
  • String: a single piece of text.
  • Token: a long random string that acts as a temporary key, used here to prove the reset link belongs to the account owner.
  • Two-factor authentication (2FA): a second proof of identity on top of a password, usually a code from a phone app.
  • Unverified address: an email address a user typed but never proved they own.
  • Version: a release label for a piece of software, such as 16.1.

Similar reports

View all

Same bug class and techniques, clearest first.

Account takeover

The lesson behind this report.

Getting into someone else's account through a flaw in sign-in, password reset, second factor, single sign-on or session handling.