Skip to content
Access control Disclosed report Intermediate

Improper Access Control on Deploy-Key

A deploy key created for one project could be used to access a different private project, allowing an attacker to read private repository files. The report demonstrates this by cloning a private repository using a deploy key from another project.

GitLab

Originally disclosed on GitLab

Critical View original
  • Fixed in 14 days
  • Disclosed after 14 days

HackerOne report #962231 by ledz1996 on 2020-08-19:

Report | Attachments | How To Reproduce

Report

Summary

Similar Issue to #957459, This time on Deploy-Key

Security Issue https://gitlab.com/gitlab-org/security/gitlab/-/issues/227

Steps to reproduce
  1. As User A, for me root, Create a project. Set to Public with Repository only to Member
  2. As User B, create any project then create a Deploy-Key for that project

Generate a SSH-Key to get the Public key

Bash
ssh-keygen -t rsa -b 2048 -C "[email protected]"  

Copy the content of id_rsa.pub for the Deploy-Key

Bash
git clone [email protected]:private-user/private-repo.git  

I prepare a video for this:

Results of GitLab environment info
System information  
System:  
Proxy:		no  
Current User:	git  
Using RVM:	no  
Ruby Version:	2.6.6p146  
Gem Version:	2.7.10  
Bundler Version:1.17.3  
Rake Version:	12.3.3  
Redis Version:	5.0.9  
Git Version:	2.27.0  
Sidekiq Version:5.2.9  
Go Version:	unknown

GitLab information  
Version:	13.2.6-ee  
Revision:	e231b6a0b09  
Directory:	/opt/gitlab/embedded/service/gitlab-rails  
DB Adapter:	PostgreSQL  
DB Version:	11.7  
URL:		http://gitlab.example.vm  
HTTP Clone URL:	http://gitlab.example.vm/some-group/some-project.git  
SSH Clone URL:	[email protected]:some-group/some-project.git  
Elasticsearch:	no  
Geo:		no  
Using LDAP:	no  
Using Omniauth:	yes  
Omniauth Providers:

GitLab Shell  
Version:	13.3.0  
Repository storage paths:  
- default: 	/var/opt/gitlab/git-data/repositories  
GitLab Shell path:		/opt/gitlab/embedded/service/gitlab-shell  
Git:		/opt/gitlab/embedded/bin/git  

Impact

Read private files in project

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 deploy key was not properly scoped to its intended project, allowing it to authenticate against other repositories.

Impact

An attacker could read private files in a project they should not have access to.

What the attacker needed

A GitLab account; ability to create a project and deploy key; knowledge of the target private project path

How it was found

  1. As User A, create a public project with repository access limited to members.
  2. As User B, create any project and add a deploy key to it.
  3. Generate an SSH key pair and use the public key as the deploy key.
  4. Clone the private repository using the deploy key.

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 key is a special SSH key that lets a server or tool access a single Git repository without using a password. The bug meant that a key made for one project could also open another private project, so someone with a key could read code they were not supposed to see.

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.