Summary
The AaveDIVAWrapper contract does not properly validate decimal consistency between collateral tokens and wrapped tokens (WTokens). This allows a** misconfigured or malicious DIVA pool** to use mismatched decimals, causing severe underpayments or overpayments during redemption.
WToken Decimals are Not Verified Against Collateral Token Decimals
The contract assumes that the decimals of the WToken match those of the underlying collateral token, but this assumption is incorrect.
Example:
USDC (6 decimals) is used as collateral.
The corresponding WToken is mistakenly/maliciously set to 18 decimals.
This introduces a 1e12 factor difference in calculations.
DIVA Pools Can Be Created with Arbitrary Decimals
The AaveDIVAWrapper blindly trusts DIVA pool parameters without verifying whether the decimals of the registered WToken match the original collateral.
Create a DIVA Pool with a Fake WToken
A malicious actor deploys a custom WToken with 18 decimals, but registers it as collateral for a 6-decimal token (e.g., USDC).
The AaveDIVAWrapper does not check for decimal mismatches.
Users Deposit Funds into the Pool
Users deposit USDC (6 decimals) into the pool, expecting to receive equivalent WTokens.
However, the conversion rate is incorrect, leading to inflated or reduced balances.
Redemption Phase - Users Lose Funds
When users redeem their WTokens, the protocol miscalculates collateral amounts:
If USDC has 6 decimals, but the WToken has 18, users might get 1e12x more or less USDC.
Example: A user expecting 1 USDC (1e6) might receive 0.000000000001 USDC (1e-12) or 1,000,000 USDC (1e12).
This severely disrupts the protocol and can drain liquidity pools or cause users to lose funds.
Deploy a Misconfigured/Malicious WToken
Register it as a 6-Decimal Collateral Token in AaveDIVAWrapper
Deposit 100 USDC into the Pool
Expected WToken balance (correct case): 100 WTokens
Actual balance (due to decimal mismatch): 100 * 1e12 WTokens (wrong amount)
Redeem WTokens
When the user redeems their 100 WTokens, they should receive 100 USDC.
Instead, they receive 0.0000000001 USDC or 100,000,000,000 USDC, depending on whether the protocol divides or multiplies incorrectly.
🔴 Severity: HIGH
💰 Loss of Funds: Users may receive 1e12x too much or too little collateral.
📉 Liquidity Drain: The protocol may overpay or underpay, destabilizing liquidity pools.
⚠️ Trust Damage: Users experiencing incorrect redemptions will lose trust in the protocol.
require(IERC20Metadata(_collateralToken).decimals() == IERC20Metadata(_wToken).decimals(),"Mismatched decimals between collateral and WToken");
When creating a pool, verify that the collateral token decimals match the registered WToken decimals.
Introduce a scaling factor to adjust for decimal mismatches.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.