CVE-2022-22894
High · 7.8CVSS
7.8
EPSS
0.7%
Published
Jan 21, 2022
CISA due date
—
Cloudanix analysis
A bug in a lightweight JavaScript engine can let an attacker who supplies a specially made script take over or crash the program that runs it.
- Exploitation
- Requires User Interaction
- Attacker needs
- User Interaction
- Complexity
- Low
- Impact
- Full Compromise
- Component
- Library
- Class
- Memory Corruption
- Remediation
- Upgrade
- Effort
- Medium
- Patch risk
- Low
What it actually does
Stack-based buffer overflow triggered during hash table lookup in the ECMA lcache implementation, allowing out-of-bounds memory writes on the stack.
Why it matters to the business
Applications embedding the JavaScript engine can be crashed or made to execute attacker-supplied code when processing untrusted scripts, leading to service disruption or full host compromise in environments that rely on this engine.
How an attack unfolds
An attacker crafts a JavaScript payload that repeatedly triggers ecma_lcache_lookup with values that overflow the stack frame; because the flaw requires local access and user interaction, the payload is typically delivered via a malicious file or embedded script that the victim opens or executes.
How to fix it
Upgrade to a patched Jerryscript release that corrects the bounds handling inside ecma_lcache_lookup; if no newer release exists, apply a vendor or community patch that adds proper stack-size validation before cache operations, or sandbox the engine with strict memory limits.
How to confirm the fix worked
Confirm the installed Jerryscript version is newer than 3.0.0 and that the ecma-lcache.c source no longer contains the vulnerable lookup path; run the original proof-of-concept script under a debugger or sanitizer to verify absence of stack overflow.
Typical attack path
- Identify or supply a Jerryscript-based application that processes attacker-controlled JavaScript.
- Craft a script containing repeated property accesses or object operations that exercise the lcache lookup path.
- Deliver the script locally (file, command-line argument, or embedded resource) and trigger execution.
- Overwrite stack control data to redirect execution to attacker-controlled code or cause denial of service.
How to detect it
Search process execution logs and application telemetry for Jerryscript instances started with untrusted script arguments; inspect crash dumps or sanitizer reports for stack overflow indicators around ecma_lcache_lookup; monitor for repeated cache-miss patterns that precede abnormal termination.
What your security team should do
- Inventory all products and containers that embed Jerryscript and mark them for immediate upgrade or replacement.
- Apply runtime sandboxing or memory-limit controls to any remaining instances until patches are deployed.
- Block untrusted JavaScript execution paths in applications that cannot be updated promptly.
- Add the engine to the vulnerability scanning policy with an alert for any version <= 3.0.0.
The record
Jerryscript 3.0.0 was discovered to contain a stack overflow via ecma_lcache_lookup in /jerry-core/ecma/base/ecma-lcache.c.
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|---|---|---|
| Ubuntu:18.04:LTS | iotjs | 0 | No fix |
| Ubuntu:22.04:LTS | iotjs | 0 | No fix |
| Ubuntu:Pro:18.04:LTS | iotjs | 0 | No fix |
| conan | jerryscript | 3.0.0 | No fix |
Related vulnerabilities
- CVE-2024-33255 Jerryscript commit cefd391 was discovered to contain an Assertion Failure via… Also affects iotjs
- CVE-2024-33260 Jerryscript commit cefd391 was discovered to contain a segmentation violation via the… Also affects iotjs
- CVE-2024-33258 Jerryscript commit ff9ff8f was discovered to contain a segmentation violation via the… Also affects iotjs
- CVE-2024-33259 Jerryscript commit cefd391 was discovered to contain a segmentation violation via the… Also affects iotjs
- CVE-2023-36109 Buffer Overflow vulnerability in JerryScript version 3.0, allows remote attackers to… Also affects iotjs
- CVE-2023-38961 Buffer Overflwo vulnerability in JerryScript Project jerryscript v.3.0.0 allows a remote… Also affects iotjs
- CVE-2023-36201 An issue in JerryscriptProject jerryscript v.3.0.0 allows an attacker to obtain sensitive… Also affects iotjs
- CVE-2023-34867 Jerryscript 3.0 (commit 05dbbd1) was discovered to contain an Assertion Failure via the… Also affects iotjs