Skip to content
Account takeover Write-up Intermediate

How Password Reset Flows Lead to Full Account Takeover: Lessons From a Disclosed GitLab Critical

GitLab's password reset flow accepted a request containing both the victim's email and an attacker-controlled secondary email, sending a valid reset link to the unverified attacker address. An unauthenticated attacker could then set a new password and take over any account without victim interaction.

Muhammad Asim Shahzad Follow

Published on masimshahzad.medium.com

Every account has a door for the day its owner forgets the password. That door is the password reset flow, and attackers study it more closely than the login page itself.

Muhammad Asim Shahzad, on masimshahzad.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.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the server trusted an email address supplied in the reset request and sent a reset link to it without verifying that the address belonged to the account.

Impact

An unauthenticated attacker could take over any account on a vulnerable GitLab instance, including administrator accounts, though accounts with two-factor authentication still required the second factor to log in.

What the attacker needed

No authentication needed; victim has an account on the instance; attacker controls an email address

The fix

GitLab fixed the issue in versions 16.7.2, 16.6.4 and 16.5.6, with backports to earlier branches.

How it was found

  1. Create two accounts you own, each with its own email inbox.
  2. Trigger password resets normally and record the request and response contents.
  3. Study the reset request shape and note fields naming a user, email address, or redirect.
  4. Try sending a field with two values, an unexpected value, or the second account's address.
  5. Watch responses and inboxes for tokens in response bodies or links sent to the wrong inbox.
  6. Test token life cycle: expiry, invalidation on new request, survival after password change.

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 write-up has not been written yet. The Original tab links to the source.

A password reset flow is meant to send a reset link only to the email address already verified for the account. Here, the server also sent the link to a second email address supplied by the attacker, so the attacker could open the link and set a new password. This let anyone take over another person's account without needing the old password or any action from the victim.

What is Account takeover?

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

More by Muhammad Asim Shahzad

View all

21 more disclosed reports, best first.

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.