CVE-2020-23306

9.8 CRITICAL

📋 TL;DR

CVE-2020-23306 is a critical stack-based buffer overflow vulnerability in JerryScript's regular expression engine that allows remote code execution. Attackers can exploit this by providing specially crafted regular expressions to trigger the overflow. This affects any application or device using vulnerable versions of JerryScript for JavaScript execution.

💻 Affected Systems

Products:
  • JerryScript JavaScript engine
Versions: Version 2.2.0 specifically (and potentially earlier versions with similar code)
Operating Systems: All platforms running JerryScript (Linux, Windows, embedded systems)
Default Config Vulnerable: ⚠️ Yes
Notes: Any application or device embedding JerryScript for JavaScript execution is vulnerable when processing untrusted regular expressions.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete system compromise with arbitrary code execution, potentially leading to data theft, ransomware deployment, or persistent backdoor installation.

🟠

Likely Case

Remote code execution leading to application compromise, data exfiltration, or lateral movement within the network.

🟢

If Mitigated

Application crash or denial of service if exploit attempts are blocked by security controls.

🌐 Internet-Facing: HIGH - Exploitable remotely without authentication via regular expression input.
🏢 Internal Only: HIGH - Internal applications using JerryScript remain vulnerable to authenticated or network-accessible attacks.

🎯 Exploit Status

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

The vulnerability is in a core parsing function and requires only crafted regular expression input. Public GitHub issue demonstrates the crash condition.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: JerryScript 2.3.0 and later

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

Restart Required: Yes

Instructions:

1. Update JerryScript to version 2.3.0 or later. 2. Recompile any applications using JerryScript. 3. Restart affected services or devices.

🔧 Temporary Workarounds

Input validation for regular expressions

all

Implement strict validation and sanitization of regular expression inputs before passing to JerryScript

Memory protection controls

linux

Enable ASLR, stack canaries, and DEP/NX bit to make exploitation more difficult

echo 2 > /proc/sys/kernel/randomize_va_space
gcc -fstack-protector-all -z noexecstack -o program program.c

🧯 If You Can't Patch

  • Network segmentation to isolate JerryScript applications from untrusted networks
  • Implement WAF rules to block suspicious regular expression patterns

🔍 How to Verify

Check if Vulnerable:

Check JerryScript version: if version is 2.2.0 or earlier, system is vulnerable. Test with crafted regex: /^(a+)+$/ against long 'a' strings.

Check Version:

jerry --version or check build configuration for embedded versions

Verify Fix Applied:

Verify JerryScript version is 2.3.0 or later. Test the same regex pattern that previously caused crashes.

📡 Detection & Monitoring

Log Indicators:

  • Segmentation fault crashes in JerryScript processes
  • Abnormal memory usage patterns
  • Repeated regex processing failures

Network Indicators:

  • Unusual network traffic from JerryScript applications
  • Requests containing complex or malformed regular expressions

SIEM Query:

process.name:"jerry" AND (event.action:"segmentation_fault" OR memory.usage > 90%)

🔗 References

📤 Share & Export