Skip to content
Access control Disclosed report Intermediate

Spoofing commit author for signed commits

GitLab's 'Verified' label for signed commits did not check that the email in the x509 certificate matched the commit author's email. An attacker could sign a commit with a certificate for any email and have it displayed as verified, impersonating another user.

GitLab

Originally disclosed on GitLab

  • Fixed in 5 months
  • Disclosed after 5 months

HackerOne report #1077019 by subbotin on 2021-01-12, assigned to @rchan-gitlab:

Report | Attachments | How To Reproduce

Report

Summary

Label "Verified" for signed commits not checks email for x509 signs.

Steps to reproduce

Instruction for linux, but it can be useful for reproducing on over OS.

  1. Create valid x509 certificate for some email (I use https://www.actalis.it/en/certificates-for-secure-electronic-mail.aspx because it's only one service which makes free mime certs).
  2. Import cert to storage gpgsm --import [email protected]
  3. Create .gitconfig like
[user]  
	email = [email protected]  
	name = target_account_on_gitlab_name  
	signingkey = 0xBFD04A72 # (you key id from previous step. can be find by `gpgsm -k`)  
[commit]  
	gpgsign = true  
[gpg]  
	program = gpgsm  
  1. make new commit and push it to gitlab.
  2. go to page https://gitlab.com/group_name/project_name/-/commits/master and looks on bages
  3. for better picture you can change avatar via gravatar.com
Impact

Someone with compromised ssh key but not compromised GPG key or x509 cert.

Examples

https://gitlab.com/mr_tron/test/-/commits/master
You can see on this page two commits:
Both made by me, both has label "Verified". They looks identically (only one difference - link under commit name. one follows on my gitlab account, and second is just "mailto:my@email"). Both commits signed by x509 MIME certificate. Initial commit I signed with my certificate issued to my email [email protected] which I use for registration on gitlab.org, but second commit is signed by certificate issued to random temporary email (not really random - that's my old email, but i never mentioned it on gitlab.org).
Github.com for example in this situation adds label "Unverified". Look on two last commits on this page - https://github.com/mr-tron/test-sign-x509/commits/master

What is the current bug behavior?

Gitlab display commits signed by x509 certificate for any email like Verified
Also it displays login for gitlab users detected based on login in same manner as "user.name" from commit info.

What is the expected correct behavior?

It should should display label "Signed" or "Unverified" and not green color.

Relevant logs and/or screenshots

In attachments.

Output of checks

This bug happens me on gitlab.org

Impact

Attacker can impersonate someone else in gitlab web interface.

Attachments

Warning: Attachments received through HackerOne, please exercise caution!

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

Likely the verification logic for x509-signed commits did not compare the certificate's email address with the commit author's email.

Impact

An attacker could impersonate another user in the GitLab web interface by signing commits with a certificate for an arbitrary email, as the 'Verified' label was shown without email validation.

What the attacker needed

A GitLab account; ability to create commits; an x509 certificate for any email

How it was found

  1. Create a valid x509 certificate for an email address.
  2. Import the certificate into the local GPG storage.
  3. Configure Git to use the certificate for signing commits.
  4. Make a new commit and push it to GitLab.
  5. View the commits page to see the 'Verified' badge.

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 sign a commit with a certificate, GitLab shows a 'Verified' badge. This report found that GitLab did not check whether the email in the certificate belonged to the person making the commit. So someone could use a certificate for a different email and still get the 'Verified' badge, making it look like someone else made the commit.

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.

More from GitLab

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

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.