Skip to content
Info disclosure Disclosed report Beginner

API exposes comment field of user uploaded SSH keys

The GitLab API returned the comment field of users' public SSH keys, which the web interface does not disclose. An attacker could read these comments, which may contain sensitive information such as system usernames or internal hostnames.

GitLab

Originally disclosed on GitLab

  • Fixed in 18 months
  • Disclosed after 18 months

HackerOne report #473439 by dcsec on 2018-12-31:

Summary

The Gitlab API exposes the comment field of user's public SSH keys

Description

The specification seems to state that this should not happen. The commit that made the changes to the specification also seems to suggest this is not intentional.

Key comments are not disclosed when accessing a users keys via the web interface. Example below (cut for brevity):

$ curl https://gitlab.com/dsadnasdsandajn.keys
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAIQC8HSa4ekYekN0hAgxlEBHMcGvoKw0n22Qf+ZWAfVHfnw== dsadnasdsandajn (gitlab.com)

Apart from being unintentional, it's likely that in some cases this could leak sensitive information to an attacker (system usernames, internal host names, an accidentally pasted password if we are really unlucky/lucky).

Github doesn't publish the comment field.

Steps To Reproduce

  1. List a users public SSH keys via the API. Example below (output cut for brevity):
$ curl https://gitlab.com/api/v4/users/3137456/keys/
[{"id":2936115,"title":"example-comment-exposure","key":"ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEA4SU05weyscjB1OWy7GBGRIH7OpJycoJ/9jKo16TFfgL+mUe1+aTOddEaKj6+YrcW3g0ONNWGfL9j7nu4LvW0vNk2hD6ghb2B357fK3pe/AUdeOEUN3qH2nEj00UUhLUSQ5hXxVr6Spb9XTkpQOTO9q+U7vfJyHxS8FRredMeETU= example-comment-exposure","created_at":"2018-12-31T00:07:05.812Z"}]

The key comment field is listed directly inside the title property and also the at the end of the key property.

Impact

Apart from being unintentional, it's likely that in some cases this could leak sensitive information to an attacker (system usernames, internal host names, an accidentally pasted password if we are really unlucky/lucky).

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

Impact

This could leak sensitive information such as system usernames, internal hostnames, or accidentally pasted passwords.

What the attacker needed

A GitLab account with an SSH key; the key comment contains sensitive data

How it was found

  1. Request a user's public SSH keys through the API endpoint.
  2. Observe that the response includes the key comment in the title and key fields.

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 add an SSH key to a service like GitLab, you can attach a comment to it, often your name or computer name. The website hid this comment, but the API (a way for programs to talk to the service) returned it anyway. That means anyone could see information the user thought was private.

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.