CVE-2021-46340
Medium · 5.5CVSS
5.5
EPSS
0.6%
Published
Jan 20, 2022
CISA due date
—
Cloudanix analysis
A bug in a JavaScript engine can let attackers crash programs that use it by feeding them specially crafted code.
- Exploitation
- Requires User Interaction
- Attacker needs
- User Interaction
- Complexity
- Low
- Impact
- Denial Of Service
- Component
- Library
- Class
- Denial of service
- Remediation
- Upgrade
- Effort
- Medium
- Patch risk
- Low
What it actually does
Assertion failure in JerryScript parser at js-scanner.c during statement scanning causes immediate process crash when processing certain JavaScript input.
Why it matters to the business
Applications embedding JerryScript can be forced offline by untrusted scripts, interrupting services that rely on the engine for execution.
How an attack unfolds
An attacker supplies a malicious JavaScript file or snippet that reaches the scanner's statement-end logic, triggering the failing assertion and terminating the process. Public exploit code is available to automate the crash.
How to fix it
Upgrade to a patched JerryScript release once available; in the interim, isolate the engine from untrusted input or wrap it in a crash-resilient supervisor process.
How to confirm the fix worked
Replay the known crashing JavaScript snippet against the updated binary and confirm the assertion no longer fires and the process remains stable.
Typical attack path
- Identify an application or service that embeds JerryScript and accepts external JavaScript
- Craft input that ends a try or catch statement in a way that violates the scanner stack check
- Deliver the input through the application's normal script ingestion path
- Observe process termination and service unavailability
How to detect it
Review application and system logs for unexpected JerryScript process terminations or assertion failures around the js-scanner module when processing external scripts.
What your security team should do
- Inventory all deployments that embed JerryScript and mark them for priority patching
- Apply runtime sandboxing or process restart policies around the engine until a fix is deployed
- Monitor upstream JerryScript commits for the scanner assertion fix and test the resulting build
The record
There is an Assertion 'context_p->stack_top_uint8 == SCAN_STACK_TRY_STATEMENT || context_p->stack_top_uint8 == SCAN_STACK_CATCH_STATEMENT' failed at /parser/js/js-scanner.c(scanner_scan_statement_end) 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