CVE-2021-46344
Medium · 5.5CVSS
5.5
EPSS
0.6%
Published
Jan 20, 2022
CISA due date
—
Cloudanix analysis
A programming error in a lightweight JavaScript engine can make programs using it crash when they receive certain kinds of code, interrupting whatever service or device relies on that engine.
- Exploitation
- Requires User Interaction
- Attacker needs
- User Interaction
- Complexity
- Low
- Impact
- Denial Of Service
- Component
- Library
- Class
- Improper Input Validation
- Remediation
- Upgrade
- Effort
- Medium
- Patch risk
- Low
What it actually does
The flaw triggers an assertion failure in the JavaScript parser when encountering certain rest element patterns, causing the process to terminate abnormally.
Why it matters to the business
Applications or devices embedding JerryScript may experience sudden crashes when processing untrusted or malformed JavaScript, leading to service outages and potential data loss in embedded or IoT environments.
How an attack unfolds
An attacker supplies a crafted JavaScript payload containing specific rest element syntax to any JerryScript-based parser or runtime; the input reaches the expression parser in js-parser-expr.c, violates the expected flag state, and forces an assertion abort that crashes the hosting application.
How to fix it
Upgrade JerryScript to a version that removes or guards the failing assertion in js-parser-expr.c; where upgrades are unavailable, wrap the parser in a separate process with restart logic and restrict JavaScript input sources.
How to confirm the fix worked
Replay known crashing rest-element test cases against the parser and confirm the process no longer aborts; monitor for absence of the specific assertion string in logs or core dumps.
Typical attack path
- Identify an application or device that embeds JerryScript and accepts JavaScript input
- Craft a minimal JavaScript snippet exercising rest elements in a pattern that violates the parser's flag assumptions
- Deliver the payload via file, network, or API to the target parser
- Trigger parsing of the input, causing the assertion failure and process termination
How to detect it
Search application and system logs for the assertion message referencing PARSER_PATTERN_HAS_REST_ELEMENT or the file js-parser-expr.c; correlate sudden JerryScript process crashes with recent JavaScript parsing activity.
- Assertion 'flags & PARSER_PATTERN_HAS_REST_ELEMENT' failed
- /jerry-core/parser/js/js-parser-expr.c
- jerryscript parser crash on rest element
What your security team should do
- Prioritize upgrade of all JerryScript deployments given the public exploit and long disclosure window
- Implement input validation and sandboxing around any JavaScript parsing entry points
- Add monitoring for unexpected JerryScript process exits and assertion failures
- Review downstream dependencies that ship JerryScript for the same exposure
The record
There is an Assertion 'flags & PARSER_PATTERN_HAS_REST_ELEMENT' failed at /jerry-core/parser/js/js-parser-expr.c in JerryScript 3.0.0.
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