CVE-2018-1999024: Cross Site Scripting (XSS) in MathJax

mathjax Updated 02 Oct 2025

Summary

27/07/2018
Yes i
Moderate
5.4

CVE-2018-1999024: Macro in MathJax running untrusted Javascript within a web browser. Affects mathjax versions < 2.7.4. Fixed in 2.7.4. How to fix ↓

Also tracked for

The same CVE-2018-1999024 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.

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

Sponsored Devnack Mobile apps built by Devnack Design, build and launch iOS and Android apps with a senior product team. From idea to store release Start a project

Background

MathJax is an open-source JavaScript library that allows the rendering of mathematical equations on web pages. It provides a comprehensive set of tools for displaying math formulas and symbols. MathJax is commonly used in educational websites, scientific publications, and online math courses. However, versions prior to 2.7.4 are vulnerable to a Cross Site Scripting (XSS) attack.

Vulnerability Detail

The vulnerability in MathJax arises from the \unicode{} macro, which processes untrusted content and can execute potentially malicious JavaScript code within a web browser. An attacker can exploit this vulnerability by tricking a victim into viewing a page that utilizes MathJax to process untrusted content. This can lead to the execution of arbitrary JavaScript code, compromising the victim's browser and potentially exposing sensitive information. The vulnerability has been assigned a CVSS score of 5.4, indicating a moderate severity level.

How To Fix

Minimum fixed version

2.7.4

This is the first release that contains the fix.

npm install mathjax@2.7.4

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

Workaround

If upgrading MathJax is not immediately feasible, a temporary workaround is to disable the use of the \unicode{} macro in the application. This can be achieved by modifying the code that utilizes MathJax and removing any instances of the \unicode{} macro. By removing this macro, the vulnerability is mitigated until a proper upgrade can be implemented.

Conclusion

The Cross Site Scripting (XSS) vulnerability in MathJax can allow the execution of potentially malicious JavaScript code within a web browser. It is important to upgrade MathJax to version 2.7.4 or later to mitigate this vulnerability. If immediate upgrading is not possible, disabling the \unicode{} macro can serve as a temporary workaround. For further assistance in vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for mathjax →

Share this vulnerability

FAQ

MathJax is an open-source JavaScript library used for rendering mathematical equations on web pages. It provides a wide range of tools and features for displaying math formulas and symbols.

The vulnerability in MathJax is a Cross Site Scripting (XSS) vulnerability that allows the execution of potentially malicious JavaScript code within a web browser.

The vulnerability can be exploited by tricking a user into visiting a page that utilizes MathJax to process untrusted content. This can lead to the execution of arbitrary JavaScript code in the user's browser.

The impact of this vulnerability can vary depending on the context in which MathJax is used. However, it can potentially lead to the compromise of user's browsers, unauthorized access to sensitive information, and the execution of malicious actions.

To fix this vulnerability, it is recommended to upgrade MathJax to version 2.7.4 or later. This version includes a fix for the XSS vulnerability in the \unicode{} macro.

Related vulnerabilities

Recent vulnerabilities recorded for mathjax.

How To Fix

Minimum fixed version

2.7.4

This is the first release that contains the fix.

npm install mathjax@2.7.4

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