CVE-2026-44311 Fabric.js: Improper escaping in fabric.Gradient colorStops leads to XSS in SVG serialization

Medium 5.4 Published Updated

Attackers can inject malicious scripts via unescaped gradient colors in SVG output, leading to XSS if the SVG is rendered in the browser.

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-44311?

CVE-2026-44311 is a medium-severity cross-site scripting vulnerability in fabricjs fabric.js, published on 22 Jun 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 7.4.0, 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, this may allow an attacker to inject arbitrary HTML/SVG and execute JavaScript in the victim's browser. This vulnerability is fixed in 7.4.0.

Weakness: CWE-79, CWE-116

Which versions are affected by CVE-2026-44311?

2 open source packages ship an affected version, including fabric. It affects 1 product.

PackageAffectedFixed in
fabric npmAll versions7.4.0
fabric npmAll versions7.4.0

Products include Fabricjs Fabric.js.

How do I fix CVE-2026-44311?

Upgrade fabric to 7.4.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-44311 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2026-44311 exists.

Sources

Also known as GHSA-w22m-hvvm-xmwx.

Is CVE-2026-44311 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free