The AaveDIVAWrapper contract does not validate user inputs in several functions, particularly for _collateralToken, _recipient, and _poolId parameters. This omission could result in transactions with zero addresses, invalid pool IDs, or interactions with nonexistent collateral tokens, leading to unintended contract behavior, failed transactions, or potential security risks.
registerCollateralToken(address _collateralToken)
addLiquidity(bytes32 _poolId, uint256 _collateralAmount, address _longRecipient, address _shortRecipient)
removeLiquidity(bytes32 _poolId, uint256 _positionTokenAmount, address _recipient)
redeemPositionToken(address _positionToken, uint256 _positionTokenAmount, address _recipient)
redeemWToken(address _wToken, uint256 _wTokenAmount, address _recipient)
claimYield(address _collateralToken, address _recipient)
These functions do not check if the provided _collateralToken, _recipient, or _poolId are valid. As a result:
A user could pass a zero address (0x0) as _recipient, causing funds to be irretrievable.
_collateralToken could be an invalid or unlisted token, leading to failures in integrations.
_poolId could be invalid or nonexistent, causing incorrect operations on pools.
There is no validation to check if _collateralToken is a valid address. A zero address input (0x000...000) could cause failures in downstream functions.
Missing require statements to validate function inputs.
Lack of input sanitization before using user-supplied values in critical operations.
https://github.com/Cyfrin/2025-01-diva/blob/1b6543768c341c2334cdff87b6dd627ee2f62c89/contracts/src/AaveDIVAWrapper.sol#L49
| Impact Type | Description |
|---|---|
| Denial of Service | Transactions with invalid addresses or pool IDs will fail, causing unnecessary gas expenditure. |
| Loss of Funds | If _recipient is 0x0, tokens may become irretrievable. |
| Contract Misbehavior | Interacting with an invalid _collateralToken could break external integrations. |
Hardhat (for Proof of Concept testing)
Slither (to detect missing input validation)
Solidity Visual Auditor (SVA)
To confirm the issue, we simulate a transaction where _recipient is a zero address in the removeLiquidity function.
Create a test file: test/missing-input-validation.js
The transaction revert when _recipient or _collateralToken is 0x0, confirming the missing input validation issue.
To fix this issue, add require statements in the affected functions:
Require _recipient, _collateralToken, and _poolId to be valid before execution.
Use custom error messages for better debugging.
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.