Skip to content
Info disclosure Disclosed report Intermediate

Leaking emails of newly created users

An error message when inviting an unverified user to a group that restricts membership by email domain reveals the user's email address. An attacker could automatically fetch newly created users and invite them to collect emails from the error responses.

GitLab

Originally disclosed on GitLab

  • Fixed in 5 months
  • Disclosed after 5 months

⚠️ Please read the process on how to fix security issues before starting to work on the issue. Vulnerabilities must be fixed in a security mirror.

HackerOne report #1884672 by shells3c on 2023-02-23, assigned to @fvpotvin:

Report | How To Reproduce

Report

Summary

A Gitlab error message leaks user's email address in ee/app/models/ee/member.rb:

Ruby
    def email_not_verified  
      _("email '%{email}' is not a verified email." % { email: user.email })  
    end  

The error message only appears when you invite an unverified user to the group that restricts membership by email domain, which means only users who haven't verified their email are affected by this vulnerability, very unlikely to happen as users have to verify their email addresses to can log in. However, a possible attack scenario here is that the attack happens in between the sign-up and the confirmation, which I think usually only lasts some minutes. But it's exploitable because GitLab allows you to fetch latest users (by creation time), just a simple API query is enough to do this: GET /api/v4/users. So the script here is that the attacker automatically and continuously fetches new users from the API, feeds it to the Invite member API and collects the emails from error messages.

Steps to reproduce

Note: You will need a Gitlab Enterprise server or a Premium Plan on gitlab.com (you can sign-up for a trial)

  1. Create a new user and don't confirm the email yet, remember the username
  2. Create a group, go to Settings > General > Restrict membership by email domain and add a random domain that doesn't exist
  3. Now go to Group information > Members, click Invite members and enter the username from step 1
  4. After clicking Invite, an error message will be returned with the email address

Steps to reproduce the real-life attack scenario (on gitlab.com):

  1. After creating a Premium group, go to Group information > Members, click Invite members
  2. Click the input box under Username or email address, after a few seconds of loading, a list of suggested users will appear, choose the user on top of them
  3. Click Invite and you will have a chance of revealing that user's email
  4. If The member's email address is not allowed for this group is the only error message you get, try again and after several failed attempts, you will get at least one successful attempt
Output of checks

This bug happens on GitLab.com

Impact

Collecting email addresses from Gitlab

How To Reproduce

Please add reproducibility information to this section:

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

The error message includes the user's email address in its text, which is returned to the inviter.

Impact

An attacker could collect email addresses of newly created users who have not yet verified their email, but only if the group restricts membership by email domain and the user is unverified.

What the attacker needed

GitLab Enterprise or Premium plan; Group with email domain restriction; Target user has unverified email

How it was found

  1. Create a new user and do not confirm the email yet, remember the username
  2. Create a group, go to Settings > General > Restrict membership by email domain and add a random domain that doesn't exist
  3. Go to Group information > Members, click Invite members and enter the username from step 1
  4. After clicking Invite, an error message will be returned with the email address

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.

When you invite someone to a GitLab group, the system checks if their email domain is allowed. If the user hasn't confirmed their email yet, the error message shows the full email address. An attacker can repeatedly invite new users to see these emails.

What is Info disclosure?

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

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.