The WToken
contract within the AaveDIVAWrapper
protocol allows for manual setting of decimals during deployment, which can result in mismatched decimals between WToken
and the underlying collateral token. This misalignment introduces precision errors during liquidity operations, yield distributions, and collateral conversions. These errors are not the result of malicious actions but can stem from developer oversight during the deployment of WToken
. This vulnerability can lead to incorrect yield calculations, liquidity pool imbalances, and user dissatisfaction.
The root issue lies in the design of the WToken
contract, which allows decimals to be manually set during deployment. This opens the possibility of decimals misalignment between WToken
and the underlying collateral token.
Vulnerable Code:
Manual Decimals Management: Developers deploying WToken
can inadvertently assign decimals that do not match the collateral token’s decimals.
Lack of Decimals Validation: The protocol does not validate the decimals of WToken
against the underlying collateral token during the registration process.
Deployment of WToken with Misconfigured Decimals
A developer deploys a WToken
with 18 decimals, while the underlying collateral token (e.g., USDC) has 6 decimals. This could occur due to a lack of clear documentation or oversight during deployment.
Registration of WToken
The misconfigured WToken
is registered as collateral in the protocol via registerCollateralToken
. The protocol does not validate the decimals during this process.
Operational Errors
During liquidity operations or yield distributions, the protocol performs calculations assuming consistent decimals between WToken
and the collateral token. Due to the mismatch:
Over-Calculation: Users receive more WToken
than intended during collateral conversions.
Under-Calculation: Users receive less yield than they are entitled to during distributions.
Financial and Operational Impact
Imbalanced Liquidity Pools: The protocol’s liquidity pools are destabilized, increasing the risk of liquidation.
User Dissatisfaction: Users experience financial losses due to inaccurate conversions and distributions.
Financial Discrepancies:
Incorrect calculations result in over or under-distribution of funds, directly affecting user balances and the protocol’s reserves.
Protocol Instability:
Liquidity pool imbalances lead to operational disruptions and increased risk of insolvency.
Eroded User Trust:
Users lose confidence in the protocol’s reliability due to perceived inaccuracies in token handling.
Simulate the deployment of a WToken
with 18 decimals for a 6-decimal collateral token (e.g., USDC):
Register the WToken
as collateral using the protocol’s registerCollateralToken
function.
Perform liquidity operations with the misconfigured WToken
:
Behavior:
The protocol over-mints WToken
due to the assumption of 6 decimals for USDC.
This results in users receiving excessive yields or liquidity imbalances within the pool.
Set a fixed decimals value (e.g., 18) for all WToken
deployments to ensure consistency:
Ensure that the decimals of WToken
match the underlying collateral token during the registration process:
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.