Executive brief
OpenZeppelin's confidential-contracts library includes an ERC7984ERC20Wrapper component used to wrap and encrypt ERC20 tokens on blockchain networks. Due to inadequate error checking in the token minting logic, users can lose funds when wrapping tokens if the wrapper's capacity is exceeded. Specifically, if a user sends tokens to be wrapped and the minting fails silently due to overflow, the user loses their underlying tokens without receiving any wrapped tokens in return. While this requires very large token supplies (~18.4 trillion by default), it represents a critical loss-of-funds vector for affected implementations.
Technical details
The vulnerability is an unchecked silent failure in the ERC7984 contract's `_mint` function when operating on confidential `euint64` values. The `wrap` and `onTransferReceived` functions call `_mint` without verifying its return value or handling overflow conditions. When total supply reaches the 64-bit unsigned integer limit, the mint fails silently instead of reverting. An attacker (or any user after capacity is reached) can invoke wrap or send tokens via onTransferReceived; their tokens are transferred but no wrapped tokens are minted, resulting in permanent fund loss. The attack vector is network-accessible (direct function calls) with no privileges or user interaction required beyond the wrapping transaction itself. The patch in 0.3.1 adds proper return value checking and overflow handling to prevent silent failures.
Affected products
- OpenZeppelin confidential-contracts <= 0.3.0
Timeline
- 2026-01-05: disclosed: Advisory published by OpenZeppelin
- 2026-01-05: patched: Patched in version 0.3.1