Skip to content
Info disclosure Disclosed report Beginner

GraphQL leaks numbers of vulnerabilities to unauthorized users

The GraphQL API's vulnerability severity count field lacked a permission check, so any user who could access a project, including unauthenticated users on public projects, could read the number of unfixed vulnerabilities by severity. An attacker could use this to learn that a project has unfixed vulnerabilities, including critical ones.

GitLab

Originally disclosed on GitLab

  • Fixed in 10 months
  • Disclosed after 10 months

HackerOne report #880944 by xanbanx on 2020-05-22, assigned to @vdesousa:

Hi GitLab Security Team,

Summary

GitLab recently implemented a new GraphQL API to list all vulnerabilities (SAST, DAST,...).
A smaller API just returns the counts of unfixed vulnerabilities.
This API, however, is missing permission checks. So anyone, who has access to the project, i.e., anyone to a public project, can read the numbers of unfixed vulnerabilities. I think this one is one of the rare cases where numbers leaking are in scope of the H1 policy, and I also provide a git patch fixing the issue :D

Steps to reproduce

  1. Create a public project, e.g., named test-vulnerabilities, and enable GitLab CI
  2. Add the attached gl-sast-report.json file to the root directory of the repository
  3. Add the following .gitlab-ci.yml file to the repository
YAML
test:  
  script:  
    - echo "Hello World"  
  artifacts:  
    reports:  
      sast: gl-sast-report.json

  1. As an unauthenticated user, visit https://gitlab.example.com/-/graphql-explorer and perform the following graphql query:
{
  project(fullPath:"root/test-vulnerabilities") {  
    name  
    vulnerabilitySeveritiesCount {  
      critical  
      high  
      medium  
      low  
      info  
      unknown  
    }  
  }  
}

This now returns the number of unfixed vulnerabilities for all severities.

JSON
{
  "data": {  
    "currentUser": null,  
    "project": {  
      "name": "test-vulnerabilities",  
      "vulnerabilitySeveritiesCount": {  
        "critical": 1,  
        "high": 1,  
        "medium": 10,  
        "low": 17,  
        "info": 0,  
        "unknown": 4  
      }  
    }  
  }  
}

In the example above, I used a public project and an unauthenticated user.
The vulnerability however exists also in other permission models, e.g., private project and guest user,...

The same query also works on the gitlab-org/gitlab repository, which returns the following vulnerability counts for an unauthenticated user:

JSON
{
  "data": {  
    "project": {  
      "name": "GitLab",  
      "vulnerabilitySeveritiesCount": {  
        "critical": 1,  
        "high": 2,  
        "medium": 3,  
        "low": 1,  
        "info": 0,  
        "unknown": 2302  
      }  
    }  
  }  
}

Impact

Graphql API leaks the number of unfixed vulnerabilities to unauthorized users. Since this is leaking that there are unfixed vulnerabilities, e.g., a critical one, I think this report about numbers is in scope of GitLab's H1 policy.

What is the current bug behavior?

Graphql API leaks the number of unfixed vulnerabilities to unauthorized.

What is the expected correct behavior?

Graphql only returns the number of unfixed vulnerabilities if the user has access to view vulnerabilities.

I think the fix for that is pretty simple. The GraphQL vulnerability count type is missing a permission check.
I think the following patch should fix that.

Diff
From e6258f63f252eb773d864964019573f41c174309 Mon Sep 17 00:00:00 2001  
From: Xanbanx <[email protected]>  
Date: Sun, 5 Apr 2020 21:34:18 +0200  
Subject: [PATCH 1/1] Add permission check to Graphql vulnerability counts

---  
 ee/app/graphql/types/vulnerability_severities_count_type.rb | 2 ++  
 1 file changed, 2 insertions(+)

diff --git a/ee/app/graphql/types/vulnerability_severities_count_type.rb b/ee/app/graphql/types/vulnerability_severities_count_type.rb  
index 75ee10fe69a..4b1ebc900f7 100644  
--- a/ee/app/graphql/types/vulnerability_severities_count_type.rb  
+++ b/ee/app/graphql/types/vulnerability_severities_count_type.rb  
@@ -6,6 +6,8 @@ module Types  
     graphql_name 'VulnerabilitySeveritiesCount'  
     description 'Represents vulnerability counts by severity'  
 
+    authorize :read_vulnerability  
+
     ::Vulnerabilities::Occurrence::SEVERITY_LEVELS.keys.each do |severity|  
       field severity, GraphQL::INT_TYPE, null: true,  
             description: "Number of vulnerabilities of #{severity.upcase} severity of the project"  
--   
2.25.1  

Output of checks

This bug happens on GitLab.com, running on GitLab Enterprise Edition 13.0.0-pre 9854ff0fa8d.

Best regards,
Xanbanx

Impact

See above.

Attachments

Warning: Attachments received through HackerOne, please exercise caution!

Potential solution

If the blocking issue gets merged

  1. ~backend Implement self.visible?(context) on Types::VulnerabilitySeveritiesCountType (ee/app/graphql/types/vulnerability_severities_count_type.rb) as per https://graphql-ruby.org/authorization/visibility

If the blocking issue doesn't get merged

  1. ~backend Apply workaround from https://gitlab.com/gitlab-org/gitlab/-/merge_requests/31678#note_350456537

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

The GraphQL type for vulnerability severity counts was missing an authorization check for the read_vulnerability permission.

Impact

The GraphQL API leaked the number of unfixed vulnerabilities, including critical ones, to unauthorised users; the same issue also affected other permission models such as private projects and guest users.

What the attacker needed

Access to a public project; no account needed for public projects

The fix

The GraphQL vulnerability severity count type should be fixed by adding an authorization check for the read_vulnerability permission.

How it was found

  1. Create a public project and enable GitLab CI.
  2. Add a SAST report file to the repository root.
  3. Add a CI configuration that publishes the SAST report as an artifact.
  4. As an unauthenticated user, open the GraphQL explorer and query the project's vulnerabilitySeveritiesCount field.
  5. Observe the returned counts of unfixed vulnerabilities by severity.

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 GraphQL API lets clients ask for specific pieces of data. Here, a field that returns counts of unfixed vulnerabilities did not check whether the caller was allowed to see vulnerability data. Anyone who could view a public project could therefore ask for those counts and learn how many unfixed vulnerabilities exist, including critical ones.

What is Info disclosure?

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.

More from GitLab

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Information disclosure

The lesson behind this report.

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.