Vulnerabilities in pkg:npm/@stablelib/cbor

PACKAGE
Advisory Summary

GHSA-w48f-fwg7-ww6p is a HIGH prototype poisoning vulnerability (CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution')) affecting @stablelib/cbor libraries in the npm ecosystem. The issue involves prototype poisoning via `__proto__` map keys in cbor decoding. Remediation is available by upgrading affected packages to version 2.0.3.

2 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:npm/@stablelib/cbor

2 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:npm/@stablelib/cbor. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-w48f-fwg7-ww6p - HIGH @stablelib/cbor: Prototype poisoning via `__proto__` map keys in CBOR decoding
GHSA-5jg4-p4qw-cgfr - HIGH @stablelib/cbor: Stack exhaustion Denial of Service via deeply nested CBOR arrays, maps, or tags

GHSA-w48f-fwg7-ww6p at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-w48f-fwg7-ww6p
Severity HIGH
CVSS v3.1 Base Score N/A
CWE Classification CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution')
Affected Product @stablelib/cbor
Package Ecosystem npm
Published Date
Last Updated

How to Fix GHSA-w48f-fwg7-ww6p

To remediate this vulnerability, upgrade all affected @stablelib/cbor dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

@stablelib/cbor fixed: 2.0.3
npm install @stablelib/cbor@2.0.3
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls @stablelib/cbor

How to Check if You Are Affected

To determine whether your Node.js application is affected by GHSA-w48f-fwg7-ww6p, inspect your project dependencies using npm:

npm ls @stablelib/cbor

Analyze the terminal output to locate any version of @stablelib/cbor in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.0.3), your application is affected.

Note: The npm ls @stablelib/cbor command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution'), where the product receives input from an upstream component that specifies attributes that are to be initialized or updated in an object, but it does not properly control modifications of attributes of the object prototype. In @stablelib/cbor, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Summary `@stablelib/cbor` decodes CBOR maps into ordinary JavaScript objects and assigns attacker-controlled keys directly onto those objects. A CBOR map key named `__proto__` therefore changes the prototype of the decoded object instead of becoming an ordinary data property. ### Details The decoder builds map results with a plain `{}` and then stores attacker-controlled keys using bracket assignment. That is unsafe for special property names. In JavaScript, assigning to `obj["__proto__"]` on a normal object does not create a plain own property. It invokes the built-in `__proto__` setter and replaces the object’s prototype if the supplied value is an object or `null`. As a result, a CBOR payload containing a map entry like: * key: `"__proto__"` * value: `{ isAdmin: true }` does not decode to an object with an own property called `__proto__`. It decodes to an object whose prototype is now attacker-controlled. Any code that later reads properties through normal lookup will see inherited attacker-supplied values. ### PoC ```js import { decode } from "@stablelib/cbor"; // CBOR: // { // "__proto__": { "isAdmin": true } // } // // a1 map(1) // 69 text(9) // "__proto__" // a1 map(1) // 67 text(7) // "isAdmin" // f5 true const payload = new Uint8Array([ 0xa1, 0x69, 0x5f, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x5f, 0x5f, 0xa1, 0x67, 0x69, 0x73, 0x41, 0x64, 0x6d, 0x69, 0x6e, 0xf5 ]); const obj = decode(payload); console.log(Object.hasOwn(obj, "isAdmin")); // false console.log(obj.isAdmin); // true console.log(Object.getPrototypeOf(obj).isAdmin); // true ``` ### Impact Any application that decodes untrusted CBOR into JavaScript objects can receive objects with attacker-controlled prototypes. In practice, that can corrupt configuration objects, influence authorization checks, alter feature flags, and break application logic that relies on normal property lookup instead of strict own-property checks. If the decoded object is later merged into other objects, the impact can spread further. ### Solution Upgrade to version 2.0.4.

GHSA-w48f-fwg7-ww6p Affected @stablelib/cbor Versions

1 component(s)
Fixed Versions:
2.0.3
Product / Package Ecosystem Affected Versions Fixed Version
@stablelib/cbor
npm
< 2.0.3
2.0.3

References

Frequently Asked Questions

What is GHSA-w48f-fwg7-ww6p?
GHSA-w48f-fwg7-ww6p is a security vulnerability in @stablelib/cbor involving Prototype poisoning via `__proto__` map keys in CBOR decoding under CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution').
Which @stablelib/cbor versions are affected?
Affected versions include releases prior to 2.0.3 across affected packages: @stablelib/cbor.
What version fixes GHSA-w48f-fwg7-ww6p?
Upgrading to 2.0.3 (or the latest patched release for your respective branch) resolves the vulnerability.
Is @stablelib/cbor affected?
Yes, @stablelib/cbor is affected in releases prior to 2.0.3. Upgrade your dependency to 2.0.3 or later.
What CWE is associated with GHSA-w48f-fwg7-ww6p?
GHSA-w48f-fwg7-ww6p is classified under CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution') (The product receives input from an upstream component that specifies attributes that are to be initialized or updated in an object, but it does not properly control modifications of attributes of the object prototype.).
How can I check npm dependencies for GHSA-w48f-fwg7-ww6p?
Run the dependency tree command: 'npm ls @stablelib/cbor'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-w48f-fwg7-ww6p",
  "modified" : "2026-04-07T14:23:12Z",
  "published" : "2026-04-04T04:24:27Z",
  "aliases" : [ ],
  "summary" : "@stablelib/cbor: Prototype poisoning via `__proto__` map keys in CBOR decoding",
  "details" : "### Summary\n\n`@stablelib/cbor` decodes CBOR maps into ordinary JavaScript objects and assigns attacker-controlled keys directly onto those objects. A CBOR map key named `__proto__` therefore changes the prototype of the decoded object instead of becoming an ordinary data property.\n\n### Details\n\nThe decoder builds map results with a plain `{}` and then stores attacker-controlled keys using bracket assignment.\n\nThat is unsafe for special property names. In JavaScript, assigning to `obj[\"__proto__\"]` on a normal object does not create a plain own property. It invokes the built-in `__proto__` setter and replaces the object’s prototype if the supplied value is an object or `null`.\n\nAs a result, a CBOR payload containing a map entry like:\n\n* key: `\"__proto__\"`\n* value: `{ isAdmin: true }`\n\ndoes not decode to an object with an own property called `__proto__`. It decodes to an object whose prototype is now attacker-controlled. Any code that later reads properties through normal lookup will see inherited attacker-supplied values.\n\n### PoC\n\n```js\nimport { decode } from \"@stablelib/cbor\";\n\n// CBOR:\n// {\n//   \"__proto__\": { \"isAdmin\": true }\n// }\n//\n// a1                    map(1)\n//   69                  text(9)\n//     \"__proto__\"\n//   a1                  map(1)\n//     67                text(7)\n//       \"isAdmin\"\n//     f5                true\n\nconst payload = new Uint8Array([\n  0xa1,\n  0x69, 0x5f, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x5f, 0x5f,\n  0xa1,\n  0x67, 0x69, 0x73, 0x41, 0x64, 0x6d, 0x69, 0x6e,\n  0xf5\n]);\n\nconst obj = decode(payload);\n\nconsole.log(Object.hasOwn(obj, \"isAdmin\")); // false\nconsole.log(obj.isAdmin);                   // true\nconsole.log(Object.getPrototypeOf(obj).isAdmin); // true\n```\n\n### Impact\n\nAny application that decodes untrusted CBOR into JavaScript objects can receive objects with attacker-controlled prototypes.\n\nIn practice, that can corrupt configuration objects, influence authorization checks, alter feature flags, and break application logic that relies on normal property lookup instead of strict own-property checks. If the decoded object is later merged into other objects, the impact can spread further.\n\n### Solution\n\nUpgrade to version 2.0.4.",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:H/VA:N/SC:N/SI:H/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@stablelib/cbor"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.0.3"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/StableLib/stablelib/security/advisories/GHSA-w48f-fwg7-ww6p"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/StableLib/stablelib/commit/0f153a63b7552a0e8721f640984113e419015026"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/StableLib/stablelib"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-1321" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-04-04T04:24:27Z",
    "nvd_published_at" : null
  }
}