CVE-2023-40014 OpenZeppelin Contracts's ERC2771Context with custom forwarder may lead to zero-valued _msgSender
Attackers can bypass sender verification in smart contracts using custom forwarders, potentially leading to unauthorized actions.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Over the internet
- Victim action needed
- Not needed
- Fix
- Available
What is CVE-2023-40014?
CVE-2023-40014 is a medium-severity vulnerability in openzeppelin-contracts, published on 10 Aug 2023. An attacker can exploit it over the internet without logging in, with no action from the victim.
Official description
OpenZeppelin 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. The problem has been patched in v4.9.3.
Weakness: CWE-116
Which versions are affected by CVE-2023-40014?
4 open source packages ship an affected version, including @openzeppelin/contracts and @openzeppelin/contracts-upgradeable. It affects 2 products.
| Package | Affected | Fixed in |
|---|---|---|
@openzeppelin/contracts npm | From 4.0.0 | 4.9.3 |
@openzeppelin/contracts npm | From 4.0.0 | 4.9.3 |
@openzeppelin/contracts-upgradeable npm | From 4.0.0 | 4.9.3 |
@openzeppelin/contracts-upgradeable npm | From 4.0.0 | 4.9.3 |
Products include Openzeppelin Openzeppelin Contracts, Openzeppelin Openzeppelin Contracts-Upgradable.
How do I fix CVE-2023-40014?
Upgrade @openzeppelin/contracts to 4.9.3 or later.
Is CVE-2023-40014 being exploited?
There is no known exploitation of CVE-2023-40014 in the wild and no public exploit code.
Sources
Also known as GHSA-g4vp-m682-qqmp, UBUNTU-CVE-2023-40014.