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
foomaintainer add a protected tag rules with wildcard v* and allow NO ONE to create that tagsbarmaintainer creates a deploy key with write access to the projectbarmaintainer clone the project and push the protected tag
git clone [email protected]:<namespace>/<project>.git
cd <project>
git tag v123
git push origin v123
v123will be created on Gitlab.com with protected label- Also remove
barmaintainer while leaving his key then again he will be able to push protected tags
Impact
There are attack scenarios where this can be harmful
- Accidental creation of tags or releases by the development teams using deploy keys can harm and push unchecked code to the deployment server
- 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:
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
- A maintainer adds a protected tag rule with wildcard v* and allows no one to create such tags.
- Another maintainer creates a deploy key with write access to the project.
- The second maintainer clones the project and pushes a tag that matches the protected pattern.
- The tag is created with a protected label.
- 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.