DOS: taking down a 1k users Gitlab EE instance or multiple Sidekiq instances by importing a malicious repo from a Github EE self-hosted server
GitLab's GitHub importer used Octokit and Sawyer to parse API responses, and a malicious repository could cause excessive memory allocation, leading to an out-of-memory condition that killed the Puma main process and took down GitLab web services.
- Triaged in 33 days
- Fixed in 4 months
- Paid in 33 days
- Disclosed after 5 months
Summary by the program
This report described a vulnerability in GitLab where an attacker could cause a server side denial of service by importing a malicious payload via the GitHub importer functionality.
More details can be found https://gitlab.com/gitlab-org/gitlab/-/issues/463092
Summary by the researcher
When importing a project from Github (dotcom or GHES) server, Gitlab uses Octokit to fetch necessary infos (repo, contributors, pull requests, notes,...).
Under the hood, Octokit uses Sawyer as its hypermedia agent. Github API requests will return Sawyer::Resource objects. A Sawyer::Resource object is placeholder of around 10 nested Ruby objects (most of them are Ruby Hash objects). Parsing a 1MB data (response) into Sawyer::Resource objects results in allocating 250MB memory. Parsing some responses concurrently would cause OOM-killed to the Puma main process --> knocking down Gitlab web services. It takes around 2 minutes for the Puma main process and all workers to restart.
This is my first H1 report. I'd like to express my sincere gratitude to @h1_analyst_indy and @gmyers for your patience while dealing with me and my (many) wrong assumptions :v
Also thanks @ammar2 for below blog post about an issue that "allowed anyone to send certain malformed packets and crash a MineCraft server by running it out of memory". https://blog.ammaraskar.com/minecraft-vulnerability-advisory/
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 GitHub importer's use of Octokit/Sawyer, which expands each API response into many nested Ruby objects, causing disproportionate memory allocation.
Impact
An attacker could cause a denial of service, taking down GitLab web services for about two minutes while the Puma main process and workers restart.
What the attacker needed
Access to a GitHub server (dotcom or GHES); ability to import a repository into GitLab
How it was found
- Create a malicious repository on a GitHub server (dotcom or GHES).
- Import that repository into GitLab using the GitHub importer.
- GitLab fetches data via Octokit, which parses responses into Sawyer::Resource objects, causing high memory usage.
- Concurrent parsing of responses leads to OOM-killing of the Puma main process, taking down GitLab web services.
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.
When you import a project from GitHub, GitLab fetches data from GitHub's API. The library it uses to process that data can use a huge amount of memory for even a small response. An attacker could craft a repository that makes GitLab use too much memory, causing the main web server process to crash and the site to go down.
What is DoS?
A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.