CVE-2026-27013 Fabric.js Affected by Stored XSS via SVG Export
Attackers can execute arbitrary JavaScript in victim browsers via stored XSS when exporting maliciously crafted JSON to SVG using Fabric.js.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Over the internet
- Victim action needed
- A user has to click or open something
- Fix
- Available
What is CVE-2026-27013?
CVE-2026-27013 is a high-severity cross-site scripting vulnerability in fabricjs fabric.js, published on 19 Feb 2026. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.
Official description
Fabric.js is a Javascript HTML5 canvas library. Prior to version 7.2.0, Fabric.js applies `escapeXml()` to text content during SVG export (`src/shapes/Text/TextSVGExportMixin.ts:186`) but fails to apply it to other user-controlled string values that are interpolated into SVG attribute markup. When attacker-controlled JSON is loaded via `loadFromJSON()` and later exported via `toSVG()`, the unescaped values break out of XML attributes and inject arbitrary SVG elements including event handlers. Any application that accepts user-supplied JSON (via `loadFromJSON()`, collaborative sharing, import features, CMS plugins) and renders the `toSVG()` output in a browser context (SVG preview, export download rendered in-page, email template, embed) is vulnerable to stored XSS. An attacker can execute arbitrary JavaScript in the victim's browser session. Version 7.2.0 contains a fix.
Which versions are affected by CVE-2026-27013?
2 open source packages ship an affected version, including fabric. It affects 1 product.
| Package | Affected | Fixed in |
|---|---|---|
fabric npm | All versions | 7.2.0 |
fabric npm | All versions | 7.2.0 |
Products include Fabricjs Fabric.js.
How do I fix CVE-2026-27013?
Upgrade fabric to 7.2.0 or later.
Escape output for the context it lands in and set a strict Content Security Policy. Upgrading the affected component is the real fix. More about Cross-site scripting.
Is CVE-2026-27013 being exploited?
There is no known exploitation of CVE-2026-27013 in the wild and no public exploit code.
Other vulnerabilities in fabricjs fabric.js
Sources
Also known as GHSA-hfvx-25r5-qc3w.