Fabric.js Stored Cross-Site Scripting Vulnerability via SVG Export

Vulnerability

A stored cross-site scripting vulnerability has been identified in Fabric.js versions prior to 7.2.0. The issue arises during SVG export, where user-controlled string values are not properly escaped, allowing for the injection of arbitrary SVG elements and event handlers. This vulnerability can be exploited by loading attacker-controlled JSON into the application, which is then exported as SVG and rendered in a browser context.

Impact

Exploitation of this vulnerability allows for the injection of malicious scripts that are executed in the context of the user's browser session, potentially leading to unauthorized actions or data exposure.

Reproduction

To reproduce this vulnerability, load a JSON object containing unescaped strings into a Fabric.js canvas using the `loadFromJSON()` method. Ensure that the strings are crafted to break out of SVG attributes and inject SVG elements, such as images or event handlers. After exporting the canvas to SVG with the `toSVG()` method, the injected scripts will execute when the SVG is rendered in a browser.

Remediation

Users can update to Fabric.js version 7.2.0 or later, where this vulnerability has been fixed.

Added: Feb 19, 2026, 8:58 PM
Updated: Feb 19, 2026, 8:58 PM

Vulnerability Rating

Custom Algorithm
spread
0.0
impact
1.3
exploitability
5.6
remediation
0.0
relevance
3.2
threat
4.8
urgency
2.9
incentive
0.0

Our algorithm analyzes dozens of metrics to generate these 8 key vulnerability categories, which are then combined to calculate the overall risk score.