The contract AaveDIVAWrapperCore._removeLiquidity in its current implementation ignores the return value of the transferFrom function call. This could lead to unintended behavior if the transferFrom fails silently. The issue arises from the assumption that transferFrom will always succeed, but since it returns a boolean indicating success, ignoring this return value could allow the contract to proceed with invalid or incomplete state changes.
Vulnerable Contract: AaveDIVAWrapperCore
Function: _removeLiquidity
Line of Occurrence: Line 229 in AaveDIVAWrapperCore.sol
Description: The contract calls transferFrom on the _shortTokenContract token without verifying the success of the call. This could lead to a scenario where liquidity removal is not executed correctly, but the function continues to execute without reversion or error, leading to inconsistent contract state.
This vulnerability could result in the following potential impacts:
Inconsistent State: Liquidity might not be removed, but the contract continues its execution, leading to a mismatch between the state of the contract and the expected behavior.
Loss of Tokens: If the transferFrom
fails silently and liquidity is not removed, the contract might hold the tokens indefinitely without proper liquidity management.
Security Risk: Attackers could exploit this by passing an amount that exceeds the available balance, causing the contract to fail silently and execute unintended logic.
Hardhat: Used to write and run the Solidity tests.
OpenZeppelin Contracts: Provides ERC20 implementations and other utilities.
Solidity: Used to write the smart contracts and PoC test.
Always Check Return Values: Ensure that the return value of critical functions such as transferFrom
is checked. If it returns false, revert the transaction.
Use Safe Methods: Prefer safeTransferFrom
or similar wrappers that ensure the transaction is successful before proceeding.
Improve Error Handling: Implement appropriate error handling and reverts in functions that depend on external contract calls to prevent silent failures.
This PoC demonstrates the issue with AaveDIVAWrapperCore._removeLiquidity
by simulating the failure of transferFrom
and observing the results. The test suite uses Hardhat for testing.
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.