HardhatDeFi
15,000 USDC
View results
Submission Details
Severity: low
Invalid

User's shortToken and longToken balance should be checked before transferring the tokens to the wrapper contract in `AaveDIVAWrapperCore::_removeLiquidity`.

Summary

The AaveDIVAWrapperCore::_removeLiquidity transfers the short and long token to the wrapper contract without checking the user's token balance.

Vulnerability Details

POC1
POC2

Impact

unwanted revert with no proper message. https://github.com/Cyfrin/2025-01-diva/blob/main/DOCUMENTATION.md#reverts-2

Tools Used

Manual Review

Recommendations

function _removeLiquidity(
bytes32 _poolId,
uint256 _positionTokenAmount,
address _recipient
) internal returns (uint256) {
...
uint256 _userBalanceShort = _shortTokenContract.balanceOf(msg.sender);
uint256 _userBalanceLong = _longTokenContract.balanceOf(msg.sender);
uint256 _positionTokenAmountToRemove = _positionTokenAmount;
+ if(_positionTokenAmount > _userBalanceLong || _positionTokenAmount > _userBalanceShort){
+ revert NOT_ENOUGH_TOKEN_BALANCE();
+ }
if (_positionTokenAmount == type(uint256).max) {
_positionTokenAmountToRemove = _userBalanceShort > _userBalanceLong ? _userBalanceLong : _userBalanceShort;
}
...
}
Updates

Lead Judging Commences

bube Lead Judge 6 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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