Missing Validations in _redeemWToken Function
The _redeemWToken function in the AaveDIVAWrapperCore contract lacks critical validations for its input parameters:
_wToken is not validated as a contract address. This could allow interactions with non-contract addresses, leading to failed transactions or unexpected behavior.
_recipient is not validated as a non-zero address. Sending funds to the zero address (address(0)) would result in permanent loss of tokens.
Scenario 1: _wToken is Not a Contract
Attacker Action: Call redeemWToken with _wToken = address(0x123) (an EOA).
Result: The transaction reverts at IWToken(_wToken).burn(), as EOAs cannot implement the burn function. Users cannot redeem tokens, and gas is wasted.
Scenario 2: _recipient is Zero Address
User Mistake: A user accidentally sets _recipient = address(0) in redeemWToken.
Result: The private function reverts, but validating earlier would prevent unnecessary state changes.
Interacting with Non-Contract Addresses
If _wToken is not a contract (e.g., an EOA or uninitialized address), calls to IWToken(_wToken).burn() will revert, wasting gas and disrupting user operations.
An attacker could exploit this to intentionally cause transaction failures, harming protocol reliability.
Loss of Funds
If _recipient is set to address(0), tokens withdrawn from Aave will be sent to an irrecoverable address, permanently burning user funds. While the private function checks for this, earlier validation improves safety.
Hardhat
1. Validate _wToken is a Contract
Use OpenZeppelin’s Address library to ensure _wToken is a contract:
2. Validate _wToken is Registered
Ensure _wToken is a registered collateral token to prevent invalid redemptions:
3. Use Safe Token Transfers
Add checks for collateral token validity before burning wTokens:
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.