Acorn regular expression denial of service

Severity: low · CVSS 3.1 · Published 2020-04-03

Acorn is a popular JavaScript parser used by many build tools and development environments. A malicious regular expression pattern can cause the parser to enter an infinite loop, consuming CPU and halting processing. An application that processes untrusted JavaScript code without proper validation could be rendered unavailable.

Vendors: npm.

Quick answers

Is This vulnerability exploited in the wild?
No. Junglewise Threat Intelligence has no report of This vulnerability being exploited in the wild.
How severe is This vulnerability?
Low severity, with a CVSS score of 3.1, published 3 April 2020.
Which products and versions are affected?
acorn (npm) SEMVER:introduced=5.5.0,fixed=5.7.4.
Is there a fix for This vulnerability?
Yes. acorn (npm): upgrade to 5.7.4 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is This vulnerability attacked?
It is attacked over the network, in a software library.
Am I affected?
Check whether you run acorn (npm) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

How to fix

  • acorn (npm): upgrade to 5.7.4 or later
    npm install acorn@5.7.4

Technical details

The vulnerability is a Regular Expression Denial of Service (ReDoS) in Acorn's regexp validator. A crafted regex pattern in the form of /[x-\ud800]/u (containing invalid UTF-16 surrogate pairs) causes the parser to enter an infinite loop during validation. The attack requires passing untrusted input directly to Acorn's parser, as invalid UTF-16 strings are normally sanitized. The vulnerability affects Acorn versions 5.5.0–5.7.3, 6.0.0–6.4.0, and 7.0.0–7.1.0, with fixes available in versions 5.7.4, 6.4.1, and 7.1.1 respectively.

Affected products

  • Acorn Acorn 5.5.0–5.7.3, 6.0.0–6.4.0, 7.0.0–7.1.0

Timeline

  • 2020-04-03: disclosed
  • 2020: patched: Fixes released in versions 5.7.4, 6.4.1, and 7.1.1

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.