The vulnerability exists in the ERC7984ERC20Wrapper contract, which allows wrapping of standard ERC20 tokens into confidential tokens. The core issue is a silent integer overflow. The total supply of the confidential token is tracked by an encrypted 64-bit unsigned integer (euint64). When a user tries to wrap more tokens than the contract can support, causing the total supply to exceed the maximum value for a 64-bit integer, the internal _mint function fails silently instead of reverting the transaction.
The wrap and onTransferReceived functions in ERC7984ERC20Wrapper were identified as the vulnerable entry points. These functions would take the user's underlying tokens but would not verify if the subsequent minting of confidential tokens was successful. In the case of an overflow, the user's funds would be lost.
The patch, identified in commit c620d4386021dde63ae3ea1507dee8543791134a, addresses this by overriding the _update function, which is a part of the minting process. The new implementation adds a crucial check (_checkConfidentialTotalSupply) that runs before minting (from == address(0)). This check calculates the potential total supply and explicitly reverts the transaction if an overflow would occur, thus preventing the loss of funds.