Cloudanix VulnDB

CVE-2021-46344

Medium · 5.5

CVSS

5.5

EPSS

0.6%

Published

Jan 20, 2022

CISA due date

—

Cloudanix analysis

Schedule a fix SSVC: Track

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.

Exploit Available
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

  1. Identify an application or device that embeds JerryScript and accepts JavaScript input
  2. Craft a minimal JavaScript snippet exercising rest elements in a pattern that violates the parser's flag assumptions
  3. Deliver the payload via file, network, or API to the target parser
  4. 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