Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XSS Vulnerability in Markdown Editor #1233

5alt opened this issue Jul 3, 2019 · 2 comments

XSS Vulnerability in Markdown Editor #1233

5alt opened this issue Jul 3, 2019 · 2 comments


Copy link

@5alt 5alt commented Jul 3, 2019


I found a XSS issue in the editor. The XSS lies in the Mermaid feature.

The following is the PoC, you can also check it here.

graph TD
A[<script src= ></script>] -->|Get money| B(Go shopping)
B --> C{Let me think}
C -->|One| D[Laptop]
C -->|Two| E[iPhone]
C -->|Three| F[fa:fa-car Car]

The editor renders the script tag in the html and I can bypass the CSP using google-analytics as shows in this link.

Copy link

@knsv knsv commented Jul 14, 2019

It is important to keep in mind that if I add the following graph to a html page. Then the google analytics script will run as a part of the regular page load, before mermaid starts.

<div class="mermaid">
graph TD
   B --> C{<script src= ></script>}

To properly test this mermaids handling of the xss issue one need to use the mermaid API so that mermaid does not pick up the text from the page but some other source like an input field. If I take example above and paste in mermaids online editor it wont run as there would be a syntax error. If I fix that and put quotes around the script tag, then it renders as a script tag but it wont run, (second link). So I would need help to get way to reproduce this in order to verify my security fix where I disable tags in node text.

Copy link

@jackycute jackycute commented Aug 1, 2019

Close this in favor of #1242

@jackycute jackycute closed this Aug 1, 2019
edgarogh pushed a commit to WartaPoirier-corp/codimd that referenced this issue Sep 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants