Cross-Site Scripting Vulnerability in mxGraph

mxgraph Updated 02 Oct 2025

Summary

12/10/2022
No i
Moderate
6.1

CVE-2022-40440: mxGraph vulnerable to cross-site scripting in setTooltips function. Affects mxgraph versions < 4.2.2. No fix is published. 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

mxGraph is an npm package that provides a JavaScript library for creating interactive diagrams and graphs. It is widely used in web applications to visualize complex data and workflows. The package offers various features, including the ability to set tooltips for elements in the graph. However, version 4.2.2 of mxGraph has been found to contain a cross-site scripting (XSS) vulnerability in the setTooltips() function.

Vulnerability Detail

The cross-site scripting vulnerability in mxGraph's setTooltips() function allows an attacker to inject malicious code into the tooltips of graph elements. When a user hovers over an element with a manipulated tooltip, the injected code gets executed in the context of the user's browser, potentially leading to unauthorized actions, data theft, or further exploitation. This vulnerability has a CVSS score of 6.1, indicating a moderate severity level.

How To Fix

No fixed version is published for this vulnerability.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. Scan free →

Workaround

As a temporary workaround, developers can manually sanitize the tooltip content to prevent the execution of any injected scripts. This can be done by using a library or function that escapes or removes any potentially malicious HTML or JavaScript tags from the tooltip text. Here's an example of how to sanitize the tooltip content using the DOMPurify library:

const DOMPurify = require('dompurify');

const sanitizedTooltip = DOMPurify.sanitize(tooltipContent);

Conclusion

In conclusion, mxGraph version 4.2.2 is vulnerable to a cross-site scripting (XSS) attack through the setTooltips() function. Developers should upgrade to a non-affected version of mxGraph and sanitize tooltip content to mitigate the risk of exploitation. For further support on vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for mxgraph →

Share this vulnerability

FAQ

mxGraph is an npm package that provides a JavaScript library for creating interactive diagrams and graphs. It is commonly used in web applications to visualize complex data and workflows.

Cross-site scripting (XSS) is a type of security vulnerability that allows attackers to inject malicious scripts into web pages viewed by other users. This can lead to various attacks, such as stealing sensitive information or performing unauthorized actions on behalf of the user.

The vulnerability in mxGraph's setTooltips() function allows an attacker to inject malicious code into the tooltips of graph elements. When a user hovers over an element with a manipulated tooltip, the injected code gets executed in the user's browser, potentially leading to unauthorized actions or data theft.

This vulnerability has a CVSS score of 6.1, indicating a moderate severity level.

To fix this vulnerability, you should upgrade to a version of mxGraph that is not affected by the issue. Run the command npm install mxgraph@latest in your project directory to fetch and install the latest version from the npm registry.

Related vulnerabilities

Recent vulnerabilities recorded for mxgraph.

How To Fix

No fixed version is published for this vulnerability.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. 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