CVE-2020-7773: Cross-site Scripting in markdown-it-highlightjs

markdown-it-highlightjs Updated 02 Oct 2025

Summary

10/02/2022
Yes i
Moderate
6.1

CVE-2020-7773: Cross-site Scripting in markdown-it-highlightjs. Affects markdown-it-highlightjs versions < 3.3.1. Fixed in 3.3.1. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

Background

markdown-it-highlightjs is an npm package that provides inline code highlighting for Markdown documents. It is commonly used in web applications to render code snippets with syntax highlighting. The package integrates with markdown-it, a popular Markdown parser. However, versions before 3.3.1 of markdown-it-highlightjs are vulnerable to a cross-site scripting (XSS) attack.

Vulnerability Detail

The vulnerability in markdown-it-highlightjs allows an attacker to inject malicious JavaScript code by exploiting the Inline code highlighting feature. By providing a specially crafted value for the 'lang' parameter, an attacker can execute arbitrary code in the context of the user's browser. This can lead to various security risks, including unauthorized access to sensitive information, session hijacking, and defacement of the affected web application.

How To Fix

Latest published version: 4.3.0 as of 22 Oct 2026

npm install markdown-it-highlightjs@4.3.0

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

3.3.1

This is the first release that contains the fix.

npm install markdown-it-highlightjs@3.3.1

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

If upgrading to the latest version is not immediately feasible, a temporary workaround is to disable the inline code highlighting feature in markdown-it-highlightjs. This can be done by setting the 'inline' option to 'false' when configuring the markdown-it-highlightjs plugin. However, this workaround may impact the visual presentation of code snippets in the rendered Markdown.

Conclusion

The vulnerability in markdown-it-highlightjs allows for cross-site scripting attacks, potentially leading to unauthorized access and other security risks. It is crucial to upgrade to the latest version of markdown-it-highlightjs (3.3.1 or later) to mitigate this vulnerability. If upgrading immediately is not possible, consider applying the temporary workaround of disabling the inline code highlighting feature. For further support on vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for markdown-it-highlightjs →

Share this vulnerability

FAQ

markdown-it-highlightjs is an npm package that provides inline code highlighting for Markdown documents. It integrates with markdown-it, a popular Markdown parser.

The vulnerability allows an attacker to execute arbitrary JavaScript code in the user's browser, potentially leading to unauthorized access, session hijacking, and defacement of the affected web application.

To fix this vulnerability, upgrade to version 3.3.1 or later of markdown-it-highlightjs. Ensure that your application's dependencies are updated to use the latest version.

Yes, you can temporarily disable the inline code highlighting feature in markdown-it-highlightjs by setting the 'inline' option to 'false' when configuring the plugin. However, this may affect the visual presentation of code snippets in the rendered Markdown.

You can find more information about this vulnerability in the GitHub Advisory Database. Additionally, you can use Vulert's playground (https://vulert.com/scanner) to check if your application is affected by this vulnerability.

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

How To Fix

Latest published version: 4.3.0 as of 22 Oct 2026

npm install markdown-it-highlightjs@4.3.0

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

3.3.1

This is the first release that contains the fix.

npm install markdown-it-highlightjs@3.3.1

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback