Arbitrary Code Injection Affecting org.webjars.npm:serialize-javascript package, versions [,3.1.0)


Severity

Recommended
0.0
high
0
10

    Threat Intelligence

    Exploit Maturity
    Proof of concept
    EPSS
    1.03% (84th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk ID SNYK-JAVA-ORGWEBJARSNPM-570745
  • published 1 Jun 2020
  • disclosed 19 May 2020
  • credit Unknown

How to fix?

Upgrade org.webjars.npm:serialize-javascript to version 3.1.0 or higher.

Overview

org.webjars.npm:serialize-javascript is a package to serialize JavaScript to a superset of JSON that includes regular expressions and functions.

Affected versions of this package are vulnerable to Arbitrary Code Injection. An object like {"foo": /1"/, "bar": "a\"@__R-<UID>-0__@"} would be serialized as {"foo": /1"/, "bar": "a\/1"/}, meaning an attacker could escape out of bar if they controlled both foo and bar and were able to guess the value of <UID>. UID is generated once on startup, is chosen using Math.random() and has a keyspace of roughly 4 billion, so within the realm of an online attack.

PoC

eval('('+ serialize({"foo": /1" + console.log(1)/i, "bar": '"@__R-<UID>-0__@'}) + ')');

CVSS Scores

version 3.1
Expand this section

Snyk

7.7 high
  • Attack Vector (AV)
    Network
  • Attack Complexity (AC)
    High
  • Privileges Required (PR)
    None
  • User Interaction (UI)
    None
  • Scope (S)
    Unchanged
  • Confidentiality (C)
    High
  • Integrity (I)
    High
  • Availability (A)
    Low
Expand this section

NVD

8.1 high
Expand this section

Red Hat

8.1 high