CVE-2025-9910: jsondiffpatch Vulnerable to Cross-site Scripting (XSS)
Summary
CVE-2025-9910: jsondiffpatch is vulnerable to Cross-site Scripting (XSS) via HtmlFormatter::nodeBegin. Affects jsondiffpatch versions < 0.7.2. Fixed in 0.7.2. How to fix ↓
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.
No signup required · Results in about 60 seconds
Background
jsondiffpatch is an open-source JavaScript library that allows developers to compute and visualize the differences between JSON objects. It is widely used for its ability to generate diffs and apply patches to JSON data structures. The library features an HtmlFormatter that can render differences in HTML format, making it easier for users to view changes. However, certain versions of jsondiffpatch are susceptible to a Cross-site Scripting (XSS) vulnerability, which can pose significant security risks if exploited.
Vulnerability Detail
Versions of jsondiffpatch prior to 0.7.2 are vulnerable to Cross-site Scripting (XSS) via the HtmlFormatter::nodeBegin method. This vulnerability allows an attacker to inject malicious scripts into HTML payloads. If untrusted payloads are used as the source for the diff and the built-in HTML formatter is employed on a private website, it may lead to code execution, compromising the security of the application and its users.
How To Fix
Latest published version: 0.7.6 as of 22 Oct 2026
npm install jsondiffpatch@0.7.6
Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.
If you need the minimum change
0.7.2
This is the first release that contains the fix.
npm install jsondiffpatch@0.7.2
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
If you cannot immediately update the package, consider sanitizing any HTML input that is passed to the HtmlFormatter to prevent script injection. You can use libraries like DOMPurify to clean the HTML content before rendering it.
Conclusion
The jsondiffpatch library has a known vulnerability (CVE-2025-9910) that allows for Cross-site Scripting (XSS) attacks in versions prior to 0.7.2. It is crucial for developers to update to the latest version to protect their applications from potential exploits. Additionally, using tools like Vulert can help monitor and identify vulnerabilities in real-time.
See every vulnerability recorded for jsondiffpatch →
FAQ
XSS is a security vulnerability that allows attackers to inject malicious scripts into web pages viewed by other users, potentially leading to data theft or unauthorized actions.
You can use Vulert, which monitors and alerts for open-source vulnerabilities in your software. You can also check your application using the Vulert playground without any signup.
Failure to address this vulnerability could lead to unauthorized access, data breaches, and compromised user accounts, resulting in significant security risks.
Yes, you can sanitize HTML inputs using libraries like DOMPurify to prevent script injection until you can update the package.
The CVSS score of this vulnerability is 4.7, indicating a moderate level of risk.
References
Related vulnerabilities
Recent vulnerabilities recorded for jsondiffpatch.