CVE-2023-31907

7.8 HIGH

📋 TL;DR

CVE-2023-31907 is a heap buffer overflow vulnerability in Jerryscript 3.0.0's scanner_literal_is_created function that could allow attackers to execute arbitrary code or cause denial of service. This affects systems running vulnerable versions of Jerryscript, a lightweight JavaScript engine commonly embedded in IoT devices and resource-constrained environments.

💻 Affected Systems

Products:
  • Jerryscript
Versions: Version 3.0.0 specifically
Operating Systems: All platforms running Jerryscript
Default Config Vulnerable: ⚠️ Yes
Notes: Only affects Jerryscript 3.0.0; earlier and later versions are not vulnerable.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Remote code execution leading to complete system compromise, data theft, or persistent backdoor installation.

🟠

Likely Case

Application crash causing denial of service, potentially disrupting device functionality.

🟢

If Mitigated

Limited impact with proper memory protection mechanisms (ASLR, DEP) that may only cause crashes.

🌐 Internet-Facing: MEDIUM - Exploitation requires specific conditions but could affect exposed IoT devices.
🏢 Internal Only: LOW - Typically requires local access or specific application integration.

🎯 Exploit Status

Public PoC: ✅ No
Weaponized: UNKNOWN
Unauthenticated Exploit: ✅ No
Complexity: MEDIUM

Exploitation requires triggering the specific scanner function with crafted JavaScript input.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: Versions after 3.0.0

Vendor Advisory: https://github.com/jerryscript-project/jerryscript/issues/5073

Restart Required: Yes

Instructions:

1. Upgrade Jerryscript to version 3.0.1 or later. 2. Recompile any applications using Jerryscript. 3. Restart affected services or devices.

🔧 Temporary Workarounds

Input Validation

all

Implement strict input validation for JavaScript code processed by Jerryscript

Memory Protection

linux

Enable ASLR and DEP/XN on systems to reduce exploit effectiveness

sysctl -w kernel.randomize_va_space=2

🧯 If You Can't Patch

  • Network segmentation to isolate vulnerable devices
  • Implement strict access controls to limit who can submit JavaScript to affected systems

🔍 How to Verify

Check if Vulnerable:

Check Jerryscript version: jerry --version should not return 3.0.0

Check Version:

jerry --version

Verify Fix Applied:

Verify installed version is 3.0.1 or later and test with known problematic JavaScript inputs

📡 Detection & Monitoring

Log Indicators:

  • Segmentation fault crashes in Jerryscript processes
  • Memory corruption warnings in system logs

Network Indicators:

  • Unusual JavaScript payloads being sent to embedded devices

SIEM Query:

process_name:"jerry" AND (event_type:"crash" OR error_code:"SIGSEGV")

🔗 References

📤 Share & Export