Use of SafeApprove()
while swapping may revert causing DoS
#235
Labels
bug
Something isn't working
duplicate
This issue or pull request already exists
QA (Quality Assurance)
Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax
Lines of code
https://github.com/code-423n4/2022-06-connext/blob/b4532655071566b33c41eac46e75be29b4a381ed/contracts/contracts/core/connext/libraries/AssetLogic.sol#L347
Vulnerability details
Impact
_swapAssetOut()
ofAssetLogic.sol
usessafeApprove()
from openzeppelin'sSafeERC20
.safeApprove()
will revert whenvalue != 0
and allowance to the spender != 0 ._amountIn
is > 0 andtoken.allowance(address(this), spender)
> 0, the function will revert.Proof of Concept
Snippet from SafeERC20
Snippet from
_swapAssetOut()
Tools Used
Manual Analysis
Recommended Mitigation Steps
Use
safeIncreaseAllowance
andsafeDecreaseAllowance
instead ofsafeApprove()
.The text was updated successfully, but these errors were encountered: