Unauthorized Access to Container Registry of other groups / CVE-2019-12825
A user could access another group's container registry images after the original group was renamed and a new group with the old name was created. This allowed unauthorised access to Docker images belonging to other groups.
GitLab
Originally disclosed on GitLab
- Fixed in 6 months
- Disclosed after 6 months
HackerOne report #615168 by atomic111 on 2019-06-14, assigned to gitlab_cmaxim:
Unauthorized Access to Container Registry of other groups
created two users
pentest1
username = pentest1
mail = [email protected]
pw = Pentest1]
pentest2
username = pentest2
mail = [email protected]
pw = Pentest2]
Login as pentest1
- Go to https://gitlab.com/dashboard/groups?nav_source=navbar
- Create a new group with user pentest1 https://gitlab.com/groups/new called
grouppentest1with private as default selection - Create a new private project with name
trial1in groupgrouppentest1 - Go to https://gitlab.com/grouppentest1/trial1
- Create a new file
.gitlab-ci.ymlhttps://gitlab.com/grouppentest1/trial1/new/master with the content located in this repo
build:docker:
stage: build
image: docker:18
services:
- docker:dind
before_script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
script:
# fetches a image, this could also be built here
- docker pull centos:7
- docker pull centos:6
- docker pull oraclelinux:7
# instead of docker build, we are using docker tag here, but it does not really
# - >
# DOCKER_BUILDKIT=1
# docker build
# --tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA
# --tag $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
# -f Dockerfile
# .
- docker tag docker.io/centos:7 $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA
- docker tag docker.io/centos:7 $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
- docker tag docker.io/centos:6 $CI_REGISTRY_IMAGE:2.12.1
- docker tag docker.io/oraclelinux:7 $CI_REGISTRY_IMAGE:2.13.1
# push image to gitlab registry
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
- docker push $CI_REGISTRY_IMAGE:2.12.1
- docker push $CI_REGISTRY_IMAGE:2.13.1
- Wait until CI is done and go to https://gitlab.com/grouppentest1/trial1/container_registry
- you should see the published repos
- Go to group management https://gitlab.com/groups/grouppentest1/-/edit and change groupname to 'grouppentest2' and path to
grouppentest2
- Project registry does not show any container https://gitlab.com/grouppentest1/trial1/container_registry
- Logout as pentest1
Login as pentest2
- Login with user pentest2
- Create a new group called
grouppentest1
- Create a new project called
trial1
- See docker images from previous user
Impact
- get access to docker registries of other groups without having the rights
Attachments
Warning: Attachments received through HackerOne, please exercise caution!
- complete_trail1_repo_withgitlab-ci_yml.png
- created_grouppentest1_group_with_user_pentest2.png
- create_project_trial1_as_pentest2.png
- gitlab_docker_registry_for_trial1.png
- gitlab_version.png
- registry_after_rename_to_grouppentest2.png
- rename_to_grouppentest2.png
- success_pipeline_trial1_repo.png
- see_docker_images_from_user_pentest1.png
- Advisory_CVE-2019-12825.txt
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 container registry did not properly check permissions after a group was renamed, so a new group with the same name inherited access to the old group's images.
Impact
An attacker could gain access to Docker registries of other groups without having the rights.
What the attacker needed
Two user accounts; ability to create groups and projects; CI pipeline to push images
How it was found
- Create two users, pentest1 and pentest2.
- As pentest1, create a private group and a private project, then add a CI configuration that builds and pushes Docker images to the container registry.
- Run the CI pipeline to publish images to the registry.
- Rename the group from grouppentest1 to grouppentest2.
- As pentest2, create a new group named grouppentest1 and a project named trial1.
- View the container registry and see the images from pentest1's original group.
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 container registry is a place where Docker images are stored. When a group was renamed, its old name became free, and another user could create a new group with that name and see the old group's images. This means private images were exposed to someone who should not have access.
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.