rollup-plugin-uglify@6.0.4

Vulnerabilities

1 via 1 paths

Dependencies

16

Source

npm

Find, fix and prevent vulnerabilities in your code.

Severity
  • 1
Status
  • 1
  • 0
  • 0

high severity

Arbitrary Code Injection

  • Vulnerable module: serialize-javascript
  • Introduced through: serialize-javascript@2.1.2

Detailed paths

  • Introduced through: rollup-plugin-uglify@6.0.4 serialize-javascript@2.1.2
    Remediation: Upgrade to serialize-javascript@3.1.0.

Overview

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__@'}) + ')');

Remediation

Upgrade serialize-javascript to version 3.1.0 or higher.

References