The AaveDIVAWrapperCore contract relies on the balanceOf function of collateral tokens to determine the contract's token balance during critical operations such as withdrawals and liquidity removal. However, this value can potentially be manipulated by malicious actors through techniques such as donation attacks. This manipulation could lead to incorrect calculations, resulting in financial losses or disruptions to the protocol.
The contract calculates the amount of collateral to return during operations such as removeLiquidity and redeemPositionTokens by subtracting the initial balance from the current balance using the balanceOf function. A malicious actor could manipulate this balance by sending additional tokens to the contract, inflating the balance and causing the contract to overestimate the amount of collateral available for withdrawal.
removeLiquidity function
redeemPositionToken function
Incorrect balance calculations could result in users receiving more or fewer tokens than they are entitled to, leading to financial losses for either the protocol or its users.
Malicious actors could exploit the vulnerability to drain funds from the contract or manipulate its state for personal gain.
Manual Review
Instead of relying on balanceOf, maintain an internal accounting system to track the contract's token balances. For example, use a mapping to store the expected balance of each collateral token and update it during deposits and withdrawals.
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.