CVE-2026-27013

7.6 HIGH

📋 TL;DR

Fabric.js versions before 7.2.0 have an SVG export vulnerability where user-controlled JSON data isn't properly escaped when converted to SVG. This allows attackers to inject malicious SVG elements with JavaScript event handlers, leading to stored cross-site scripting (XSS). Applications that accept user JSON input via loadFromJSON() and render SVG output are vulnerable.

💻 Affected Systems

Products:
  • Fabric.js
Versions: All versions before 7.2.0
Operating Systems: All
Default Config Vulnerable: ⚠️ Yes
Notes: Only affects applications using both loadFromJSON() with user input and toSVG() export functionality.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Attackers execute arbitrary JavaScript in victims' browsers, potentially stealing session cookies, credentials, or performing actions as the user.

🟠

Likely Case

Stored XSS attacks where malicious SVG content is saved and rendered to multiple users, compromising their browser sessions.

🟢

If Mitigated

If input validation and output encoding are implemented, impact is limited to SVG rendering issues without code execution.

🌐 Internet-Facing: HIGH
🏢 Internal Only: MEDIUM

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: LIKELY
Unauthenticated Exploit: ✅ No
Complexity: LOW

Exploitation requires ability to supply JSON to loadFromJSON() and SVG rendering to victims.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 7.2.0

Vendor Advisory: https://github.com/fabricjs/fabric.js/security/advisories/GHSA-hfvx-25r5-qc3w

Restart Required: No

Instructions:

1. Update Fabric.js to version 7.2.0 or later. 2. Update package.json to specify 'fabric': '^7.2.0'. 3. Run npm update fabric or yarn upgrade fabric. 4. Test SVG export functionality.

🔧 Temporary Workarounds

Input Validation

all

Validate and sanitize all JSON input before passing to loadFromJSON()

Output Encoding

all

Manually escape XML special characters in SVG attributes before toSVG() export

🧯 If You Can't Patch

  • Implement strict Content Security Policy (CSP) to block inline scripts
  • Disable SVG export functionality for user-generated content

🔍 How to Verify

Check if Vulnerable:

Check if using Fabric.js version <7.2.0 and if application uses loadFromJSON() with user input followed by toSVG() export.

Check Version:

npm list fabric | grep fabric or check package.json version

Verify Fix Applied:

Test SVG export with malicious JSON payloads after updating to 7.2.0+

📡 Detection & Monitoring

Log Indicators:

  • Unusual SVG export requests
  • Large or malformed JSON payloads to loadFromJSON endpoints

Network Indicators:

  • SVG files containing script tags or event handlers
  • JSON payloads with SVG/XML injection patterns

SIEM Query:

source="web_logs" AND (uri="*loadFromJSON*" OR uri="*toSVG*") AND (payload="*onload=*" OR payload="*<script>*")

🔗 References

📤 Share & Export