Cross Site Scripting Vulnerability in MathJax - CVE-2018-1999024

mathjax Updated 02 Oct 2025

Summary

23/07/2018
N/A
Yes i
Medium
5.4

CVE-2018-1999024: MathJax version prior to version 2.7.4 contains a Cross Site Scripting (XSS) vulnerability in the \unicode{} macro that can result in Potentially untrusted Javascript running within a web browser. Affects mathjax across 2 version ranges.

< 2.7.4+dfsg-1 < a55da396c18cafb767a26aa9ad96f6f4199852f1

Fixed in 2.7.4+dfsg-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 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

MathJax is an open-source JavaScript display engine that produces high-quality mathematical typesetting in web pages. It is widely used in educational and scientific contexts to render complex mathematical equations. The package is designed to be flexible and supports various input formats, making it a popular choice among developers. However, prior to version 2.7.4, MathJax contained a critical Cross Site Scripting (XSS) vulnerability that could allow untrusted JavaScript to execute in a user's browser, posing significant security risks.

Vulnerability Detail

The vulnerability, identified as CVE-2018-1999024, arises from the \unicode{} macro in MathJax versions prior to 2.7.4. This flaw allows attackers to inject potentially malicious JavaScript into web pages that process untrusted content using MathJax. When a victim views such a page, the untrusted JavaScript can execute in their browser, leading to unauthorized actions or data theft. The vulnerability is particularly concerning because it can be exploited without any user interaction, simply by visiting a compromised page.

How To Fix

Minimum fixed version

2.7.4+dfsg-1

This is the first release that contains the fix.

sudo apt-get install --only-upgrade mathjax

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

Workaround

If upgrading is not immediately feasible, a temporary workaround is to avoid processing untrusted content with MathJax. Ensure that any input passed to MathJax is sanitized and comes from trusted sources. Additionally, consider implementing Content Security Policy (CSP) headers to restrict the execution of untrusted scripts.

Conclusion

CVE-2018-1999024 is a significant security vulnerability in MathJax that can lead to Cross Site Scripting attacks. Users are strongly advised to upgrade to version 2.7.4 or later to mitigate risks. For those unable to upgrade, implementing workarounds and ensuring content is trusted can help reduce exposure to this vulnerability.

See every vulnerability recorded for mathjax →

Share this vulnerability

FAQ

CVE-2018-1999024 is a Cross Site Scripting (XSS) vulnerability found in MathJax versions prior to 2.7.4, allowing untrusted JavaScript to execute in a user's browser.

You can use Vulert's playground at Vulert Scanner to check if your application is affected by this vulnerability without needing to sign up.

The risks include unauthorized actions, data theft, and exposure of sensitive information due to the execution of malicious scripts in the user's browser.

The CVSS score for CVE-2018-1999024 is 5.4, indicating a moderate level of severity.

If immediate upgrading is not possible, ensure that any content processed by MathJax is sanitized and comes from trusted sources, and consider implementing CSP headers.

Related vulnerabilities

Recent vulnerabilities recorded for mathjax.

How To Fix

Minimum fixed version

2.7.4+dfsg-1

This is the first release that contains the fix.

sudo apt-get install --only-upgrade mathjax

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