Stratax Contracts

First Flight #57
Beginner FriendlyDeFi
100 EXP
View results
Submission Details
Impact: medium
Likelihood: medium
Invalid

Unchecked `approve` for Aave `supply` May Fail Silently

Unchecked approve for Aave supply May Fail Silently

Description:
Before calling aavePool.supply, the contract does:

function _executeOpenOperation(address _asset, uint256 _amount, uint256 _premium, bytes calldata _params)
internal
returns (bool)
{
(, address user, FlashLoanParams memory flashParams) =
abi.decode(_params, (OperationType, address, FlashLoanParams));
// Step 1: Supply flash loan amount + user's extra amount to Aave as collateral
uint256 totalCollateral = _amount + flashParams.collateralAmount;
IERC20(_asset).approve(address(aavePool), totalCollateral);
aavePool.supply(_asset, totalCollateral, address(this), 0);
...
}

The return value of approve is not checked. Some ERC20s may return false instead of reverting, which could cause allowance not to be set as expected.

Impact:
If allowance is not correctly set, aavePool.supply can revert or behave unexpectedly, breaking the open-position flow.

Recommended Mitigation:

- IERC20(_asset).approve(address(aavePool), totalCollateral);
+ bool ok = IERC20(_asset).approve(address(aavePool), totalCollateral);
+ require(ok, "approve failed");
Updates

Lead Judging Commences

izuman Lead Judge 16 days ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

WEIRD ERC20 Tokens

Currently there is no support for weird ERC20 tokens i.e. FOT tokens, missing return values, reentrancy etc.

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.

Give us feedback!