CVE-2023-49552

7.5 HIGH

📋 TL;DR

CVE-2023-49552 is an out-of-bounds write vulnerability in Cesanta mjs 2.20.0's mjs_op_json_stringify function that allows remote attackers to cause denial of service. This affects any application using the vulnerable mjs library version. Attackers can trigger crashes or potentially execute arbitrary code by exploiting this memory corruption issue.

💻 Affected Systems

Products:
  • Cesanta mjs
Versions: 2.20.0
Operating Systems: All platforms running mjs
Default Config Vulnerable: ⚠️ Yes
Notes: Any application embedding mjs 2.20.0 is vulnerable when processing JSON stringify operations

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Remote code execution leading to complete system compromise

🟠

Likely Case

Denial of service causing application crashes and service disruption

🟢

If Mitigated

Application crash with limited impact if properly sandboxed

🌐 Internet-Facing: HIGH - Remote attackers can exploit without authentication
🏢 Internal Only: MEDIUM - Requires attacker to reach vulnerable service internally

🎯 Exploit Status

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

Proof of concept available in GitHub issue #256, demonstrates crash via crafted input

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 2.21.0 or later

Vendor Advisory: https://github.com/cesanta/mjs/issues/256

Restart Required: Yes

Instructions:

1. Update mjs to version 2.21.0 or later. 2. Rebuild any applications using mjs. 3. Restart affected services.

🔧 Temporary Workarounds

Disable JSON stringify functionality

all

Remove or disable mjs_op_json_stringify function usage if not required

Modify source code to avoid mjs_op_json_stringify calls

Input validation and sanitization

all

Implement strict input validation for JSON operations

Add bounds checking before mjs_op_json_stringify calls

🧯 If You Can't Patch

  • Network segmentation to isolate vulnerable systems
  • Implement WAF rules to block malicious JSON payloads

🔍 How to Verify

Check if Vulnerable:

Check if mjs version is 2.20.0 in application dependencies

Check Version:

Check package manifest or run: grep -r "mjs" package.json

Verify Fix Applied:

Verify mjs version is 2.21.0 or later after update

📡 Detection & Monitoring

Log Indicators:

  • Application crashes
  • Segmentation faults
  • Memory corruption errors

Network Indicators:

  • Unusual JSON payloads to mjs endpoints
  • Repeated crash-inducing requests

SIEM Query:

source="application.log" AND ("segmentation fault" OR "mjs" OR "json_stringify")

🔗 References

📤 Share & Export