CVE-2024-45047

5.4 MEDIUM

📋 TL;DR

This CVE describes a mutation XSS (mXSS) vulnerability in Svelte's server-side rendering where HTML escaping is improperly handled. Attackers can inject malicious content into attributes within noscript tags, causing browsers to interpret it differently than Svelte expects during server-side rendering. This affects all Svelte applications using server-side rendering up to version 4.2.19.

💻 Affected Systems

Products:
  • Svelte
Versions: All versions up to but not including 4.2.19
Operating Systems: All
Default Config Vulnerable: ⚠️ Yes
Notes: Only affects applications using Svelte's server-side rendering (SSR) functionality.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Full account takeover, session hijacking, or credential theft through persistent XSS payloads executing in users' browsers.

🟠

Likely Case

Limited XSS attacks stealing session cookies or performing actions on behalf of authenticated users.

🟢

If Mitigated

No impact if proper Content Security Policies are implemented and input validation/sanitization is in place.

🌐 Internet-Facing: HIGH
🏢 Internal Only: MEDIUM

🎯 Exploit Status

Public PoC: ✅ No
Weaponized: UNKNOWN
Unauthenticated Exploit: ⚠️ Yes
Complexity: MEDIUM

Exploitation requires specific conditions with noscript tags and attribute injection during SSR.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 4.2.19

Vendor Advisory: https://github.com/sveltejs/svelte/security/advisories/GHSA-8266-84wp-wv5c

Restart Required: Yes

Instructions:

1. Update package.json to specify svelte version 4.2.19 or higher. 2. Run npm update svelte or yarn upgrade svelte. 3. Restart your application server. 4. Rebuild and redeploy your application.

🧯 If You Can't Patch

  • Implement strict Content Security Policy (CSP) with script-src directives
  • Add additional input validation and output encoding for user-controlled data in noscript attributes

🔍 How to Verify

Check if Vulnerable:

Check package.json or package-lock.json for svelte version below 4.2.19

Check Version:

npm list svelte | grep svelte

Verify Fix Applied:

Confirm svelte version is 4.2.19 or higher in package.json and node_modules

📡 Detection & Monitoring

Log Indicators:

  • Unusual attribute values in noscript tags
  • Multiple failed attempts to inject script-like content

Network Indicators:

  • Unexpected script execution from noscript tag contexts

SIEM Query:

web_logs WHERE request_uri CONTAINS 'noscript' AND (request_body CONTAINS 'javascript:' OR request_body CONTAINS 'onload=' OR request_body CONTAINS 'onerror=')

🔗 References

📤 Share & Export