Skip to content
DoS Disclosed report Beginner

Uncontrolled Resource Consumption in any Markdown field using Mermaid

The 5000-character limit on Mermaid code blocks could be bypassed by splitting a long payload into many small blocks, causing the browser to freeze and consume 100% CPU when rendering the page. An attacker could make any page using Markdown with Mermaid unresponsive for all users.

GitLab

Originally disclosed on GitLab

  • Fixed in 2 months
  • Disclosed after 2 months

HackerOne report #990461 by misha98857 on 2020-09-24, assigned to @kaunghtet:

Report | Attachments

Report

Summary

I found a bypass for the mitigation of DoS via Mermaid (CVE-2019-9220) and DoS via Mermaid (CVE-2019-15584)
As the mitigation for CVE-2019-9220, the input limit of 5000 characters is currently applied to a Mermaid code block, but it can be bypassed by simply splitting the longer payload to many little code blocks.

Steps to reproduce
  1. Sign in to GitLab.
  2. Open any page where you can input Markdown text using Mermaid into the form.
  3. Copy and paste the contents of the attached file ("poc.txt") to the input form.
  4. Save the Markdown text on the page you opened. (For example, click "Comment" on "Issue" page or save "Readme.md" file)
  5. Page freeze and no working, chrome task manager demonstrate 100% cpu usage for long time.
What is the current bug behavior?

When rendering of the Mermaid graphs starts, the browser tab displaying the page freezes.
This behavior prevents browsing and editing the page that have been added the Mermaid graphs.
Also, the resources used by the browser tab will increase as rendering continues. In the worst case, the entire browser also freezes or crashes. My browser can load first graphs, but after first view get infinity load other graphs.

What is the expected correct behavior?

We need a mechanism to stop rendering in advance by detecting if the user's input contains a large number of Mermaid code blocks.

Output of checks

Bug tested on readme.md file markdown and issue comments
Browser for testing Version 85.0.4183.102 (Official Build) Arch Linux (64-bit)

Impact

This vulnerability is effective not only on Issue or Readme.md pages but also on all pages using Markdown with Mermaid.

The following impacts exist on the attacked page:

  • All users can not view the attacked page. (In some situations, the users may see incomplete rendering of the attacked page, but the user's viewing is still significantly blocked.)
  • All users can not take any action on the attacked page.
  • Depending on the user's environment, crashing or freezing the entire browser may cause user data being edited to be lost.

Attachments

Warning: Attachments received through HackerOne, please exercise caution!

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

What the attacker needed

A GitLab account; ability to post Markdown with Mermaid

How it was found

  1. Sign in to GitLab.
  2. Open any page where you can input Markdown text using Mermaid into the form.
  3. Copy and paste the contents of the attached file to the input form.
  4. Save the Markdown text on the page you opened.
  5. The page freezes and the browser tab uses 100% CPU for a long time.

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.

Mermaid is a tool that turns text into diagrams inside Markdown. GitLab limited each diagram's code to 5000 characters to prevent slowdowns, but an attacker could paste many small diagrams instead of one big one. When the page tries to draw all of them, the browser gets stuck and stops responding.

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.

More from GitLab

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Denial of service

The lesson behind this report.

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.