Prototype Pollution Vulnerability in Highlight.js - CVE-2020-26237

highlight.js Updated 02 Oct 2025

Summary

24/11/2020
N/A
Yes i
High
8.7

CVE-2020-26237: Highlight.js is a syntax highlighter written in JavaScript. Affects highlight.js across 2 version ranges.

< 9.18.1+dfsg1-3 < 7241013ae011a585983e176ddc0489a7a52f6bb0

Fixed in 9.18.1+dfsg1-3. 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 Devnack Penetration testing for web, API and mobile Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

Highlight.js is a popular syntax highlighter written in JavaScript, widely used to enhance the readability of code snippets in web applications. It supports a variety of programming languages and is known for its ease of use and integration. However, certain versions of Highlight.js are vulnerable to a prototype pollution issue that can lead to unexpected behavior in applications that allow user-generated content.

Vulnerability Detail

The vulnerability, identified as CVE-2020-26237, arises from the ability of a malicious user to craft specific HTML code blocks that exploit the prototype pollution feature of Highlight.js. This occurs when the library processes user input without proper validation, allowing harmful properties to be added to the base object's prototype. While the immediate impact may seem benign, it can lead to application crashes or unpredictable behavior, especially in systems that do not anticipate these additional properties. The affected versions are those prior to 9.18.2 and 10.1.2.

How To Fix

Minimum fixed version

9.18.1+dfsg1-3

This is the first release that contains the fix.

sudo apt-get install --only-upgrade highlight.js

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

Workaround

If upgrading is not immediately feasible, consider implementing input validation to filter out potentially harmful language names provided by users. This can be done by sanitizing user input before it is processed by Highlight.js. For example, you can restrict the allowed language names to a predefined list:

Conclusion

CVE-2020-26237 is a significant vulnerability in Highlight.js that can lead to prototype pollution if user input is not properly validated. Upgrading to the latest version is the best course of action to mitigate this risk. Additionally, using tools like Vulert can help you monitor and manage vulnerabilities in your applications effectively.

See every vulnerability recorded for highlight.js →

Share this vulnerability

FAQ

Prototype pollution is a security vulnerability that allows an attacker to manipulate the prototype of a base object, potentially leading to unexpected behavior in applications.

Highlight.js versions before 9.18.2 and 10.1.2 are vulnerable to this issue.

The vulnerability can lead to application crashes, unexpected behavior, or even denial of service (DOS) if the application does not handle the polluted properties correctly.

You can use Vulert, which monitors open-source vulnerabilities in your software. By uploading your manifest file like package-lock.json, you can receive real-time alerts about vulnerabilities.

The CVSS score for CVE-2020-26237 is 8.7, indicating a high severity level.

Related vulnerabilities

Recent vulnerabilities recorded for highlight.js.

How To Fix

Minimum fixed version

9.18.1+dfsg1-3

This is the first release that contains the fix.

sudo apt-get install --only-upgrade highlight.js

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