CVE-2021-23639 Remote Code Execution (RCE)
Attackers can execute arbitrary code via malicious front matter in Markdown files due to unsafe JS engine usage in the md-to-pdf library.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Over the internet
- Victim action needed
- Not needed
- Fix
- Available
What is CVE-2021-23639?
CVE-2021-23639 is a critical code injection vulnerability in md-to-pdf, published on 10 Dec 2021. An attacker can exploit it over the internet without logging in, with no action from the victim.
Official description
The package md-to-pdf before 5.0.0 are vulnerable to Remote Code Execution (RCE) due to utilizing the library gray-matter to parse front matter content, without disabling the JS engine.
Which versions are affected by CVE-2021-23639?
2 open source packages ship an affected version, including md-to-pdf. It affects 1 product.
| Package | Affected | Fixed in |
|---|---|---|
md-to-pdf npm | All versions | 5.0.0 |
md-to-pdf npm | All versions | 5.0.0 |
Products include Markdown to Pdf Project Markdown to Pdf.
How do I fix CVE-2021-23639?
Upgrade md-to-pdf to 5.0.0 or later.
Upgrade, and never evaluate templates, expressions or code built from user input. More about Code injection.
Is CVE-2021-23639 being exploited?
There is no known exploitation of CVE-2021-23639 in the wild and no public exploit code.
Public exploit code: 1 proofs of concept on GitHub.
Sources
Also known as GHSA-x949-7cm6-fm6p, SNYK-JS-MDTOPDF-1657880.