CVE-2024-40453

9.8 CRITICAL

📋 TL;DR

SquirrellyJS template engine versions 9.0.0 contain a code injection vulnerability in the options.varName component that allows attackers to execute arbitrary JavaScript code. This affects any application using vulnerable SquirrellyJS versions for server-side template rendering. The vulnerability is particularly dangerous in web applications that process user-controlled template variables.

💻 Affected Systems

Products:
  • squirrellyjs
Versions: v9.0.0 only
Operating Systems: All
Default Config Vulnerable: ⚠️ Yes
Notes: Only affects SquirrellyJS v9.0.0; earlier versions are not vulnerable. Applications must be using the vulnerable options.varName component.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Remote code execution leading to complete system compromise, data theft, and lateral movement within the network.

🟠

Likely Case

Server-side JavaScript execution allowing data exfiltration, file system access, and potential privilege escalation.

🟢

If Mitigated

Limited impact with proper input validation and sandboxing, potentially reduced to denial of service or information disclosure.

🌐 Internet-Facing: HIGH
🏢 Internal Only: MEDIUM

🎯 Exploit Status

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

Proof of concept available in public references. Exploitation requires the application to process attacker-controlled template variables through the vulnerable component.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: v9.0.1

Vendor Advisory: https://github.com/squirrellyjs/squirrelly/pull/262

Restart Required: Yes

Instructions:

1. Check current SquirrellyJS version: npm list squirrelly
2. Update to v9.0.1: npm update squirrelly@9.0.1
3. Restart the application server
4. Verify the update: npm list squirrelly

🔧 Temporary Workarounds

Input Validation and Sanitization

all

Implement strict input validation and sanitization for all template variables before passing to SquirrellyJS.

Disable Vulnerable Component

all

Avoid using the options.varName component in template rendering if possible.

🧯 If You Can't Patch

  • Implement strict input validation and sanitization for all user-controlled template variables.
  • Deploy web application firewall (WAF) rules to detect and block template injection attempts.

🔍 How to Verify

Check if Vulnerable:

Check package.json or run: npm list squirrelly | grep squirrelly

Check Version:

npm list squirrelly | grep squirrelly

Verify Fix Applied:

Verify installed version is 9.0.1 or higher: npm list squirrelly

📡 Detection & Monitoring

Log Indicators:

  • Unusual JavaScript execution in template rendering logs
  • Errors from SquirrellyJS parsing unexpected template syntax
  • Suspicious template variable patterns containing JavaScript code

Network Indicators:

  • HTTP requests containing JavaScript code in template parameters
  • Unusual outbound connections from the application server

SIEM Query:

source="application.logs" AND ("squirrelly" OR "template") AND ("eval" OR "Function" OR "constructor")

🔗 References

📤 Share & Export