Skip to content
Access control Disclosed report Intermediate

Protected Tags Bypass Using Deploy Keys

Deploy keys with write access can bypass protected tag rules, allowing a maintainer to create tags that should be restricted. Even after the key owner is removed from the project, the key still allows pushing protected tags.

GitLab

Originally disclosed on GitLab

  • Fixed in 4 months
  • Disclosed after 4 months

HackerOne report #1788273 by vaib25vicky on 2022-11-29, assigned to @rshambhuni:

Report | Attachments | How To Reproduce

Report

Summary

Deploy keys with write access are not restricted and they can bypass protected tags rules. This works even if the owner of the key is removed from the project.

Steps to reproduce

Lets there be two maintainers foo and bar

  1. foo maintainer add a protected tag rules with wildcard v* and allow NO ONE to create that tags
  2. bar maintainer creates a deploy key with write access to the project
  3. bar maintainer clone the project and push the protected tag
Shell
git clone [email protected]:<namespace>/<project>.git
cd <project>
git tag v123
git push origin v123
  1. v123 will be created on Gitlab.com with protected label
  2. Also remove bar maintainer while leaving his key then again he will be able to push protected tags

Impact

There are attack scenarios where this can be harmful

  1. Accidental creation of tags or releases by the development teams using deploy keys can harm and push unchecked code to the deployment server
  2. Suppose a project has used all the security restriction such as protected branch rules, push rules , protected tags rules. etc. Then in the event of deploy keys compromised, attacker can't used it for much except bypassing protected tags rules.

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

Impact

An attacker with a compromised deploy key could bypass protected tag rules to push unchecked code to deployment servers, though other security restrictions may limit further damage.

What the attacker needed

A deploy key with write access; protected tag rules configured

How it was found

  1. A maintainer adds a protected tag rule with wildcard v* and allows no one to create such tags.
  2. Another maintainer creates a deploy key with write access to the project.
  3. The second maintainer clones the project and pushes a tag that matches the protected pattern.
  4. The tag is created with a protected label.
  5. The second maintainer is removed from the project, but the deploy key remains and can still push protected tags.

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 system access a Git repository. Protected tags are rules that prevent certain tags from being created or modified. This report shows that deploy keys ignore those rules, so someone with a deploy key can create tags that should be blocked.

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.