Vulnerabilities/

Fabric.js improper escaping in fabric.Gradient colorStops leads to XSS in SVG serialization

Severity:
Medium

Description

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.

Recommendation

Update the fabric package to the latest compatible version. Followings are version details:

References

Related Issues

Tags:
npm
fabric
Anything's wrong? Let us know Last updated on July 18, 2026