Skip to content
XSS Disclosed report Intermediate

Gitlab XSS in markdown preview page

A DOM-based cross-site scripting flaw existed in GitLab's markdown preview because the mermaid diagram feature allowed a click handler to contain a javascript: URL. An attacker could craft a malicious issue that, when a victim clicked a diagram node, executed arbitrary JavaScript in the victim's browser.

GitLab

Originally disclosed on GitLab

  • Fixed in 2 months
  • Disclosed after 2 months

HackerOne report #645043 by brainpanic on 2019-07-16, assigned to akelly:

Summary

A DOM-Based XSS in markdown preview page due to mermaid feature.

Steps to reproduce

  1. sign in to GitLab
  2. find a repo and create a issue
  3. submit with the following code
graph LR;  
    A-->CLICK_HERE_AND_GET_BONUS;  
    click A alert "aaa"  
    click CLICK_HERE_AND_GET_BONUS "javascript:alert%28%64%6f%63%75%6d%65%6e%74%2e%64%6f%6d%61%69%6e%29" "Here is the XSS"  
  1. goto the issue page
  2. click the node named "CLICK_HERE_AND_GET_BONUS", you will see an alert box with document.domain

Impact

The XSS can be used to hijack the victim's Gitlab account.

Examples

Goto the link below, and click the node named "CLICK_HERE_AND_GET_BONUS"
https://gitlab.com/c00lyu/sss/issues/1

You will see an alert box with document.domain

What is the current bug behavior?

Execute javascript code

What is the expected correct behavior?

Do not allow javascript code to execute

Relevant logs and/or screenshots

gitlab_xss.png
gitlab_xss.png From the original on GitLab

Output of checks

This bug happens on GitLab.com

Impact

The XSS can be used to hijack the victim's Gitlab account.

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

Root cause

Likely the mermaid diagram renderer did not sanitise click handler URLs, allowing a javascript: scheme to be used as a link target.

Impact

The XSS could be used to hijack the victim's GitLab account, but it required the victim to click a specific diagram node.

What the attacker needed

A GitLab account; victim views the malicious issue; victim clicks a diagram node

How it was found

  1. Sign in to GitLab.
  2. Find a repository and create an issue.
  3. Submit the issue with a mermaid code block containing a click handler with a javascript: URL.
  4. Go to the issue page.
  5. Click the diagram node labelled CLICK_HERE_AND_GET_BONUS to trigger the alert.

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.

Cross-site scripting (XSS) is when a website runs attacker-supplied JavaScript in a victim's browser. Here, a diagram tool called mermaid let a link inside a diagram start with 'javascript:', so clicking it ran code. That code could then act as the victim on GitLab.

What is XSS?

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.

More from GitLab

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site scripting (XSS)

The lesson behind this report.

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.