Skip to content
Access control Disclosed report Beginner

ESCALATED: Deploy tokens with read_repository scope are allowed to access the docker registry

A deploy token with only the read_repository scope could be used to log in to the Docker registry, even though it lacked the read_registry scope. An attacker holding such a token could access the registry without authorisation, and no audit trail would show the misuse.

GitLab

Originally disclosed on GitLab

  • Fixed in 6 months
  • Disclosed after 6 months

HackerOne report #687272 by xanbanx on 2019-09-03, assigned to jmatos_bgtvf:

Hi GitLab security team,

Summary

Deploy tokens can have read_repository and read_registry scopes. A token that only allows the read_repository and not the read_registry scope can be used to access the docker registry.

Steps to reproduce

  1. Create a project
  2. Create a deploy token with a username and only read_repository scope
  3. Using that token, login to the docker registry via `docker login registry.gitlab.example.com -u <deploy-token-user> -p <deploy-token>
Bash
▶ docker login registry.example.gitlab.com -u <deploy-token-user> -p <deploy-token>  
WARNING! Using --password via the CLI is insecure. Use --password-stdin.  
WARNING! Your password will be stored unencrypted in /home/rschilling/.docker/config.json.  
Configure a credential helper to remove this warning. See  
https://docs.docker.com/engine/reference/commandline/login/#credentials-store

Login Succeeded  

Impact

This gives unauthorized users access to the docker registry. Furthermore, there is no auditing. So you do not know that a unprivileged token was used to access the registry.

What is the current bug behavior?

Deploy tokens without read_registry scope can be used to access the docker registry.

What is the expected correct behavior?

Deploy tokens without read_registry scope *cannot be used to access the docker registry.

Relevant logs and/or screenshots

Output of checks

This bug happens on GitLab.com

Best regards,
Xanbanx

Impact

See above.

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 registry authentication path did not enforce the token's read_registry scope, accepting any valid deploy token.

Impact

An unprivileged token could access the Docker registry, and because there is no auditing, the misuse would go unnoticed.

What the attacker needed

A deploy token with only read_repository scope

How it was found

  1. Create a project.
  2. Create a deploy token with a username and only the read_repository scope.
  3. Use that token to log in to the Docker registry with the docker login command.

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.

A deploy token is a password-like credential for automated access to a project. It is supposed to be limited to specific actions, such as reading code or reading container images. Here, a token meant only for code could also be used to read container images, so the permission check was too loose.

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.