The supply and withdraw functions in IAave.sol contract do not perform sufficient validation on the asset parameter. An attacker could potentially send an unsupported asset type, leading to failures or unexpected behavior.
The functions accept an asset parameter (address), which is not validated to ensure it is a valid, supported token within the protocol.
If an unsupported asset is supplied, it could result in loss of funds or other unintended effects.
An attacker could send an unsupported asset (e.g., a non-ERC20 token or malicious contract) to these functions, breaking the protocol's behavior.
This could cause funds to be locked, loss of liquidity, or prevent proper interaction with the protocol.
Proof of Concept for Finding 2: Lack of Validation on Asset Input for supply and withdraw
The supply and withdraw functions do not validate the asset parameter (address) to ensure it is a valid, supported ERC20 token. This could lead to issues where unsupported or malicious tokens are interacted with, causing unexpected behavior or potential loss of funds.
Attacker: The entity providing an unsupported asset (e.g., a non-ERC20 token or malicious token) to the supply or withdraw functions.
Victim: The protocol’s liquidity reserves.
Protocol: The Aave contract system that interacts with ERC20 tokens for asset supply and withdrawal.
Outcome & Implications:
Outcome: The transaction will likely fail or behave unexpectedly. The malicious token may not conform to the ERC20 standard, leading to failed transfers or loss of liquidity. In the worst case, the protocol could be exposed to malicious contracts that cause further issues in the system.
Implications: If the protocol does not validate tokens properly, it opens up the risk of interacting with unsupported or malicious tokens, which could drain funds or cause other unintended consequences, such as locking up liquidity or interfering with normal operations.
Manual code review
Token Validation: Introduce checks in the supply and withdraw functions to validate that the asset being supplied or withdrawn is an actual ERC20 token. This could be done by checking if the token implements the transfer function or using try/catch to handle invalid tokens.
ERC20 Interface Check: You can use IERC20 interface functions to validate if the provided token conforms to the expected interface before proceeding with the operation. For example, checking that the transfer and transferFrom functions exist and behave correctly.
Example Validation Code:
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.