Client-side resource exhausting by exploiting GitLab graph rendering
GitLab's Mermaid graph rendering had length and block limits that could be bypassed using a new chaining syntax, allowing a crafted graph to consume excessive client-side resources. An attacker could create a README or issue that, when viewed, would hang the viewer's browser.
GitLab
Originally disclosed on GitLab
- Fixed in 40 days
- Disclosed after 40 days
HackerOne report #1130035 by cocxanh on 2021-03-18:
Report | Attachments | How To Reproduce
Report
Summary
GitLab markdown supports graph rendering using Mermaid. Furthermore, to prevent this kind of vulnerability, GitLab tried to prevent them with length & block limiting (see here) but it can be bypass with a new syntax of Mermaid (see here).
Steps to reproduce
- In any project in GitLab, create a README.md or an issue contains this payload:
```mermaid
graph TD;
A & B & C & D & E & F & G & H & I & J & K & L & M & N & O & P & Q & R & S & T & U & V & W & X & Y & a & b & c & d & e & f & g & h & i & j & k & l & m & n & o & p & q & r & s & t & u & v & w & x & y & z & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9-->A & B & C & D & E & F & G & H & I & J & K & L & M & N & O & P & Q & R & S & T & U & V & W & X & Y & a & b & c & d & e & f & g & h & i & j & k & l & m & n & o & p & q & r & s & t & u & v & w & x & y & z & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9
- Anyone try to view this README.md / issue will get hang since this generate tons of resources.
Impact
Project members/everyone view the issue / README.md is got hang because the GitLab trying to render a complex graph.
Examples
What is the current bug behavior?
I was able to bypass the length & block limit and GitLab will render a complex graph that hang most normal computer.
What is the expected correct behavior?
GitLab should display a warning and not render that graph unless having user approval like this:

Relevant logs and/or screenshots

Output of checks
This bug happens on GitLab.com. See the above examples.
Impact
Project members/everyone view the issue / README.md is got hang because the GitLab trying to render a complex graph.
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 length and block limits were applied to the old Mermaid syntax but not to the new chaining-of-links syntax, allowing a graph with many nodes and edges to bypass the restrictions.
Impact
Viewing a crafted README or issue could cause the viewer's browser to hang, affecting project members and anyone who views the content.
What the attacker needed
Ability to create a README or issue in a GitLab project; victim views the README or issue
The fix
GitLab should display a warning and not render the graph unless the user approves.
How it was found
- Create a README.md or an issue in any GitLab project.
- Insert a Mermaid code block using the chaining-of-links syntax with many nodes and edges.
- Anyone who views the README.md or issue will experience their browser hanging due to the complex graph rendering.
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.
GitLab lets you draw diagrams in markdown using a tool called Mermaid. The site tried to stop huge diagrams from freezing your browser by limiting their size, but a new way of writing links in Mermaid got around that limit. So a malicious diagram could make your computer work very hard and freeze when you open a page.
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.