CVE-2021-37700 Clipboard-based DOM-XSS
An attacker can execute arbitrary JavaScript in a victim's browser by tricking them into pasting malicious clipboard data into applications using this library.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Over the internet
- Victim action needed
- A user has to click or open something
- Fix
- Available
What is CVE-2021-37700?
CVE-2021-37700 is a medium-severity cross-site scripting vulnerability in github paste-markdown, published on 12 Aug 2021. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.
Official description
@github/paste-markdown is an npm package for pasting markdown objects. A self Cross-Site Scripting vulnerability exists in the @github/paste-markdown before version 0.3.4. If the clipboard data contains the string `<table>`, a **div** is dynamically created, and the clipboard content is copied into its **innerHTML** property without any sanitization, resulting in improper execution of JavaScript in the browser of the victim (the user who pasted the code). Users directed to copy text from a malicious website and paste it into pages that utilize this library are affected. This is fixed in version 0.3.4. Refer the to the referenced GitHub Advisory for more details including an example exploit.
Weakness: CWE-79
Which versions are affected by CVE-2021-37700?
2 open source packages ship an affected version, including @github/paste-markdown. It affects 1 product.
| Package | Affected | Fixed in |
|---|---|---|
@github/paste-markdown npm | All versions | 0.3.4 |
@github/paste-markdown npm | All versions | 0.3.4 |
Products include Paste-Markdown Project Paste-Markdown.
How do I fix CVE-2021-37700?
Upgrade @github/paste-markdown to 0.3.4 or later.
Escape output for the context it lands in and set a strict Content Security Policy. Upgrading the affected component is the real fix. More about Cross-site scripting.
Is CVE-2021-37700 being exploited?
There is no known exploitation of CVE-2021-37700 in the wild and no public exploit code.
Sources
Also known as GHSA-gpfj-4j6g-c4w9.