CVE-2023-40014: @openzeppelin/contracts OpenZeppelin Contracts Vulnerable To Improper Vulnerability
MODERATECVE-2023-40014 is a MODERATE (CVSS 5.3) openzeppelin contracts vulnerable to improper vulnerability (CWE-116: Improper Encoding or Escaping of Output) affecting @openzeppelin/contracts libraries in the npm ecosystem. The issue involves openzeppelin contracts vulnerable to improper escaping of output. Remediation is available by upgrading affected packages to version 4.9.3.
CVE-2023-40014 at a Glance
Security Impact
CVSS: 5.3
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N).
How to Fix CVE-2023-40014
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.
npm install @openzeppelin/contracts@4.9.3
npm install @openzeppelin/contracts-upgradeable@4.9.3
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-40014, 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.9.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-116: Improper Encoding or Escaping of Output, where the product prepares a structured message for communication with another component, but encoding or escaping of the data is either missing or done incorrectly. as a result, the intended structure of the message is not preserved. 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
CVE-2023-40014 Affected @openzeppelin/contracts Versions
2 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
@openzeppelin/contracts
|
npm |
≥ 4.0.0
< 4.9.3
|
4.9.3
|
|
@openzeppelin/contracts-upgradeable
|
npm |
≥ 4.0.0
< 4.9.3
|
4.9.3
|
References
Frequently Asked Questions
What is CVE-2023-40014?
Which @openzeppelin/contracts versions are affected?
What version fixes CVE-2023-40014?
Is @openzeppelin/contracts affected?
Is @openzeppelin/contracts-upgradeable affected?
What is the CVSS score of CVE-2023-40014?
What CWE is associated with CVE-2023-40014?
How can I check npm dependencies for CVE-2023-40014?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-g4vp-m682-qqmp",
"modified" : "2023-08-11T19:00:48Z",
"published" : "2023-08-11T19:00:48Z",
"aliases" : [ "CVE-2023-40014" ],
"summary" : "OpenZeppelin Contracts vulnerable to Improper Escaping of Output",
"details" : "### Impact\n\nOpenZeppelin Contracts is a library for secure smart contract development. Starting in version 4.0.0 and prior to version 4.9.3, contracts using `ERC2771Context` along with a custom trusted forwarder may see `_msgSender` return `address(0)` in calls that originate from the forwarder with calldata shorter than 20 bytes. This combination of circumstances does not appear to be common, in particular it is not the case for `MinimalForwarder` from OpenZeppelin Contracts, or any deployed forwarder the team is aware of, given that the signer address is appended to all calls that originate from these forwarders.\n\n### Patches\n\nThe problem has been patched in v4.9.3.\n",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "@openzeppelin/contracts"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "4.0.0"
}, {
"fixed" : "4.9.3"
} ]
} ]
}, {
"package" : {
"ecosystem" : "npm",
"name" : "@openzeppelin/contracts-upgradeable"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "4.0.0"
}, {
"fixed" : "4.9.3"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/OpenZeppelin/openzeppelin-contracts/security/advisories/GHSA-g4vp-m682-qqmp"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-40014"
}, {
"type" : "WEB",
"url" : "https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4481"
}, {
"type" : "WEB",
"url" : "https://github.com/OpenZeppelin/openzeppelin-contracts/pull/4484"
}, {
"type" : "WEB",
"url" : "https://github.com/OpenZeppelin/openzeppelin-contracts/commit/9445f96223041abf2bf08daa56f8da50b674cbcd"
}, {
"type" : "WEB",
"url" : "https://github.com/OpenZeppelin/openzeppelin-contracts/commit/e4435eed757d4309436b1e06608e97b6d6e2fdb5"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/OpenZeppelin/openzeppelin-contracts"
}, {
"type" : "WEB",
"url" : "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.9.3/CHANGELOG.md"
}, {
"type" : "WEB",
"url" : "https://github.com/OpenZeppelin/openzeppelin-contracts/releases/tag/v4.9.3"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-116" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2023-08-11T19:00:48Z",
"nvd_published_at" : "2023-08-10T20:15:10Z"
}
}