safeApprove has been deprecated in favor of safeIncreaseAllowance and safeDecreaseAllowance.
Using safeApprove is unsafe as when WormholeTokenBridge does not consume all the allowance for some reason, the future call to SafeERC20.safeApprove() will revert, because safeApprove will check and revert if the current allowance is not 0.
Lines of code
https://github.com/code-423n4/2022-02-anchor/blob/7af353e3234837979a19ddc8093dc9ad3c63ab6b/contracts/cross-chain-contracts/ethereum/CrossAnchorBridge.sol#L190
Vulnerability details
safeApprove
has been deprecated in favor ofsafeIncreaseAllowance
andsafeDecreaseAllowance
.Using
safeApprove
is unsafe as whenWormholeTokenBridge
does not consume all the allowance for some reason, the future call toSafeERC20.safeApprove()
will revert, becausesafeApprove
will check and revert if the current allowance is not0
.https://github.com/code-423n4/2022-02-anchor/blob/7af353e3234837979a19ddc8093dc9ad3c63ab6b/contracts/cross-chain-contracts/ethereum/CrossAnchorBridge.sol#L190
Recommendation
Consider changing to
safeIncreaseAllowance()
: