CVE-2023-30542: @openzeppelin/contracts GovernorCompatibilityBravo May Trim Proposal Calldata Vulnerability

HIGH
Advisory Identifier: GHSA-93hq-5wgc-jc82
CVSS 8.8
CWE-20
Published
Advisory Summary

CVE-2023-30542 is a HIGH (CVSS 8.8) governorcompatibilitybravo may trim proposal calldata vulnerability (CWE-20: Improper Input Validation) affecting @openzeppelin/contracts libraries in the npm ecosystem. The issue involves governorcompatibilitybravo may trim proposal calldata. Remediation is available by upgrading affected packages to version 4.8.3.

CVE-2023-30542 at a Glance

CVE Identifier CVE-2023-30542
GHSA Identifier GHSA-93hq-5wgc-jc82
Severity HIGH
CVSS v3.1 Base Score 8.8
CWE Classification CWE-20: Improper Input Validation
Affected Product @openzeppelin/contracts
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 8.8

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

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

How to Fix CVE-2023-30542

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

@openzeppelin/contracts fixed: 4.8.3
npm install @openzeppelin/contracts@4.8.3
@openzeppelin/contracts-upgradeable fixed: 4.8.3
npm install @openzeppelin/contracts-upgradeable@4.8.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 @openzeppelin/contracts

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2023-30542, inspect your project dependencies using npm:

npm ls @openzeppelin/contracts

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

Note: The npm ls @openzeppelin/contracts 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-20: Improper Input Validation, where the product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly. In @openzeppelin/contracts, 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

### Impact The proposal creation entrypoint (`propose`) in `GovernorCompatibilityBravo` allows the creation of proposals with a `signatures` array shorter than the `calldatas` array. This causes the additional elements of the latter to be ignored, and if the proposal succeeds the corresponding actions would eventually execute without any calldata. The `ProposalCreated` event correctly represents what will eventually execute, but the proposal parameters as queried through `getActions` appear to respect the original intended calldata. ### Patches This issue has been patched in v4.8.3. ### Workarounds Ensure that all proposals that pass through governance have equal length `signatures` and `calldatas` parameters.

CVE-2023-30542 Affected @openzeppelin/contracts Versions

2 component(s)
Fixed Versions:
4.8.3
Product / Package Ecosystem Affected Versions Fixed Version
@openzeppelin/contracts
npm
≥ 4.3.0
< 4.8.3
4.8.3
@openzeppelin/contracts-upgradeable
npm
≥ 4.3.0
< 4.8.3
4.8.3

References

Frequently Asked Questions

What is CVE-2023-30542?
CVE-2023-30542 is a security vulnerability in @openzeppelin/contracts involving GovernorCompatibilityBravo may trim proposal calldata under CWE-20: Improper Input Validation.
Which @openzeppelin/contracts versions are affected?
Affected versions include releases prior to 4.8.3 across affected packages: @openzeppelin/contracts, @openzeppelin/contracts-upgradeable.
What version fixes CVE-2023-30542?
Upgrading to 4.8.3 (or the latest patched release for your respective branch) resolves the vulnerability.
Is @openzeppelin/contracts affected?
Yes, @openzeppelin/contracts is affected in releases prior to 4.8.3. Upgrade your dependency to 4.8.3 or later.
Is @openzeppelin/contracts-upgradeable affected?
Yes, @openzeppelin/contracts-upgradeable is affected in releases prior to 4.8.3. Upgrade your dependency to 4.8.3 or later.
What is the CVSS score of CVE-2023-30542?
CVE-2023-30542 has a CVSS v3.1 base score of 8.8 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2023-30542?
CVE-2023-30542 is classified under CWE-20: Improper Input Validation (The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.).
How can I check npm dependencies for CVE-2023-30542?
Run the dependency tree command: 'npm ls @openzeppelin/contracts'. 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-93hq-5wgc-jc82",
  "modified" : "2023-04-27T15:35:33Z",
  "published" : "2023-04-20T14:11:03Z",
  "aliases" : [ "CVE-2023-30542" ],
  "summary" : "GovernorCompatibilityBravo may trim proposal calldata",
  "details" : "### Impact\n\nThe proposal creation entrypoint (`propose`) in `GovernorCompatibilityBravo` allows the creation of proposals with a `signatures` array shorter than the `calldatas` array. This causes the additional elements of the latter to be ignored, and if the proposal succeeds the corresponding actions would eventually execute without any calldata. The `ProposalCreated` event correctly represents what will eventually execute, but the proposal parameters as queried through `getActions` appear to respect the original intended calldata.\n\n### Patches\n\nThis issue has been patched in v4.8.3.\n\n### Workarounds\n\nEnsure that all proposals that pass through governance have equal length `signatures` and `calldatas` parameters.\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@openzeppelin/contracts"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "4.3.0"
      }, {
        "fixed" : "4.8.3"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@openzeppelin/contracts-upgradeable"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "4.3.0"
      }, {
        "fixed" : "4.8.3"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/OpenZeppelin/openzeppelin-contracts/security/advisories/GHSA-93hq-5wgc-jc82"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-30542"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/OpenZeppelin/openzeppelin-contracts/commit/8d633cb7d169f2f8595b273660b00b69e845c2fe"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/OpenZeppelin/openzeppelin-contracts"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/OpenZeppelin/openzeppelin-contracts/releases/tag/v4.8.3"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-20" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-04-20T14:11:03Z",
    "nvd_published_at" : "2023-04-16T08:15:00Z"
  }
}