GHSA-m56h-5xx3-2jc2: Jsii Prototype Pollution Vulnerability

LOW
CVSS 3.7
CWE-1321
Published
Advisory Summary

GHSA-m56h-5xx3-2jc2 is a LOW (CVSS 3.7) prototype pollution vulnerability (CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution')) affecting Jsii libraries in the npm ecosystem. The issue involves prototype pollution in jsii.configurecategories. Remediation is available by upgrading affected packages to version 5.7.3, 5.6.4, 5.5.15, 5.4.46.

GHSA-m56h-5xx3-2jc2 at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-m56h-5xx3-2jc2
Severity LOW
CVSS v3.1 Base Score 3.7
CWE Classification CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution')
Affected Product Jsii
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 3.7

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality Low (C:L)
Integrity None (I:N)
Availability None (A:N)

How to Fix GHSA-m56h-5xx3-2jc2

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

jsii fixed: 5.7.3
npm install jsii@5.7.3
jsii fixed: 5.6.4
npm install jsii@5.6.4
jsii fixed: 5.5.15
npm install jsii@5.5.15
jsii fixed: 5.4.46
npm install jsii@5.4.46
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 jsii

How to Check if You Are Affected

To determine whether your Node.js application is affected by GHSA-m56h-5xx3-2jc2, inspect your project dependencies using npm:

npm ls jsii

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

Note: The npm ls jsii 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 Jsii, 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 `jsii` is a TypeScript to JavaScript compiler that also extracts an interface definition manifest to generate RPC stubs in various programming languages. jsii is typically used as a command-line tool, but it can also be loaded as a library. When loaded as a library into a larger application, prototype pollution may happen if untrusted user input is passed to the library. When used as a command line-tool, this pollution cannot occur. ## Impact You may be impacted if you have written an application that loads jsii as a library, and passes untrusted user input into the `jsii.configureCategories()` function. In that case, a user can craft input in such a way that, following the invocation, a field named "category" with a user-controlled value is added to the JavaScript Object prototype. This will cause every object in the program (both new and existing) to have a field named "category", even if it shouldn't. **This will not affect jsii itself, but it might affect the application you have loaded jsii into.** > The function `jsii.configureCategories()` is used to configure the severity (error, warning, etc.) of various jsii diagnostics. **Impacted versions: <=5.7.2, <=5.6.3, <=5.5.14, <=5.4.45** **Example:** ```js const jsii = require('jsii'); // prints 'undefined' console.log(JSON.stringify({}.category)) // calling 'configureCategories' with user input jsii.configureCategories(JSON.parse('{"__proto__": "user-input"}')) // from this point onwards, every single object literal in the program // will contain the 'category' key, with user controlled value console.log(JSON.stringify({}.category)) // prints 'user-input' // this can affect the execution of the main program in case it also makes // use of an object key called 'category'. for example, if the main programs // happens to have code like this: const x = {} // some object in the main program (not necessarily empty) if (x.category) { // this block will always be executed, effectively // changing the behavior of the main program. console.log('Do something') } else { console.log('Do something else') } ``` For more information about javascript prototype pollution, see [1]. ## Patches A patch is included in versions [5.7.3](https://github.com/aws/jsii-compiler/releases/tag/v5.7.3), [5.6.4](https://github.com/aws/jsii-compiler/releases/tag/v5.6.4), [5.5.15](https://github.com/aws/jsii-compiler/releases/tag/v5.5.15), [5.4.46](https://github.com/aws/jsii-compiler/releases/tag/v5.4.46) ## Workarounds Sanitize user input to configureCategories() by stripping the __proto__ property if detected. ## References If you have any questions or comments about this advisory, we ask that you contact AWS/Amazon Security via our issue reporting page [2] or directly via email to [aws-security@amazon.com](mailto:aws-security@amazon.com). Please do not create a public GitHub issue. [1] https://learn.snyk.io/lesson/prototype-pollution/ [2] [https://aws.amazon.com/security/issue-reporting](https://aws.amazon.com/security/vulnerability-reporting) ## Credits We would like to thank _Tariq Hawis_ for collaborating on this issue through the coordinated vulnerability disclosure process.

GHSA-m56h-5xx3-2jc2 Affected Jsii Versions

4 component(s)
Fixed Versions:
5.7.35.6.45.5.155.4.46
Product / Package Ecosystem Affected Versions Fixed Version
jsii
npm
≥ 5.7.0
< 5.7.3
5.7.3
jsii
npm
≥ 5.6.0
< 5.6.4
5.6.4
jsii
npm
≥ 5.5.0
< 5.5.15
5.5.15
jsii
npm
≥ 5.4.0
< 5.4.46
5.4.46

References

Frequently Asked Questions

What is GHSA-m56h-5xx3-2jc2?
GHSA-m56h-5xx3-2jc2 is a security vulnerability in Jsii involving Prototype pollution in jsii.configureCategories under CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution').
Which Jsii versions are affected?
Affected versions include releases prior to 5.7.3, 5.6.4, 5.5.15, 5.4.46 across affected packages: jsii.
What version fixes GHSA-m56h-5xx3-2jc2?
Upgrading to 5.7.3, 5.6.4, 5.5.15, 5.4.46 (or the latest patched release for your respective branch) resolves the vulnerability.
Is jsii affected?
Yes, jsii is affected in releases prior to 5.7.3, 5.6.4, 5.5.15, 5.4.46. Upgrade your dependency to 5.7.3, 5.6.4, 5.5.15, 5.4.46 or later.
What is the CVSS score of GHSA-m56h-5xx3-2jc2?
GHSA-m56h-5xx3-2jc2 has a CVSS v3.1 base score of 3.7 (LOW) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N.
What CWE is associated with GHSA-m56h-5xx3-2jc2?
GHSA-m56h-5xx3-2jc2 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-m56h-5xx3-2jc2?
Run the dependency tree command: 'npm ls jsii'. 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-m56h-5xx3-2jc2",
  "modified" : "2025-01-07T15:12:20Z",
  "published" : "2024-12-18T15:50:09Z",
  "aliases" : [ ],
  "summary" : "Prototype pollution in jsii.configureCategories",
  "details" : "## Summary\n\n`jsii` is a TypeScript to JavaScript compiler that also extracts an interface definition manifest to generate RPC stubs in various programming languages. jsii is typically used as a command-line tool, but it can also be loaded as a library.\nWhen loaded as a library into a larger application, prototype pollution may happen if untrusted user input is passed to the library. When used as a command line-tool, this pollution cannot occur.\n\n## Impact\n\nYou may be impacted if you have written an application that loads jsii as a library, and passes untrusted user input into the `jsii.configureCategories()` function. In that case, a user can craft input in such a way that, following the invocation, a field named \"category\" with a user-controlled value is added to the JavaScript Object prototype. This will cause every object in the program (both new and existing) to have a field named \"category\", even if it shouldn't. \n\n**This will not affect jsii itself, but it might affect the application you have loaded jsii into.**\n\n> The function `jsii.configureCategories()` is used to configure the severity (error, warning, etc.) of various jsii diagnostics.\n\n**Impacted versions: <=5.7.2, <=5.6.3, <=5.5.14, <=5.4.45** \n\n**Example:**\n\n```js\nconst jsii = require('jsii');\n\n// prints 'undefined'\nconsole.log(JSON.stringify({}.category))\n\n// calling 'configureCategories' with user input\njsii.configureCategories(JSON.parse('{\"__proto__\": \"user-input\"}'))\n\n// from this point onwards, every single object literal in the program\n// will contain the 'category' key, with user controlled value\nconsole.log(JSON.stringify({}.category)) // prints 'user-input'\n\n\n// this can affect the execution of the main program in case it also makes \n// use of an object key called 'category'. for example, if the main programs \n// happens to have code like this:\n\nconst x = {} // some object in the main program (not necessarily empty)\n\nif (x.category) {\n  // this block will always be executed, effectively \n  // changing the behavior of the main program.\n  console.log('Do something')\n} else {\n  console.log('Do something else')\n}\n```\n\nFor more information about javascript prototype pollution, see [1].\n\n## Patches\n\nA patch is included in versions [5.7.3](https://github.com/aws/jsii-compiler/releases/tag/v5.7.3), [5.6.4](https://github.com/aws/jsii-compiler/releases/tag/v5.6.4), [5.5.15](https://github.com/aws/jsii-compiler/releases/tag/v5.5.15), [5.4.46](https://github.com/aws/jsii-compiler/releases/tag/v5.4.46)\n\n## Workarounds\n\nSanitize user input to configureCategories() by stripping the __proto__ property if detected.\n\n## References\n\nIf you have any questions or comments about this advisory, we ask that you contact AWS/Amazon Security via our issue reporting page [2] or directly via email to [aws-security@amazon.com](mailto:aws-security@amazon.com). Please do not create a public GitHub issue.\n\n[1] https://learn.snyk.io/lesson/prototype-pollution/\n\n[2] [https://aws.amazon.com/security/issue-reporting](https://aws.amazon.com/security/vulnerability-reporting)\n\n## Credits\n\nWe would like to thank _Tariq Hawis_ for collaborating on this issue through the coordinated vulnerability disclosure process.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "jsii"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "5.7.0"
      }, {
        "fixed" : "5.7.3"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "jsii"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "5.6.0"
      }, {
        "fixed" : "5.6.4"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "jsii"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "5.5.0"
      }, {
        "fixed" : "5.5.15"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "jsii"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "5.4.0"
      }, {
        "fixed" : "5.4.46"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/aws/jsii-compiler/security/advisories/GHSA-m56h-5xx3-2jc2"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/aws/jsii-compiler"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/aws/jsii-compiler/releases/tag/v5.4.46"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/aws/jsii-compiler/releases/tag/v5.5.15"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/aws/jsii-compiler/releases/tag/v5.6.4"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/aws/jsii-compiler/releases/tag/v5.7.3"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-1321" ],
    "severity" : "LOW",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-12-18T15:50:09Z",
    "nvd_published_at" : null
  }
}