code-423n4 / 2022-06-connext-findings

1 stars 0 forks source link

Approving from non-zero to non-zero allowance will revert with OZ's `safeApprove()` #275

Closed code423n4 closed 2 years ago

code423n4 commented 2 years ago

Lines of code

https://github.com/code-423n4/2022-06-connext/blob/b4532655071566b33c41eac46e75be29b4a381ed/contracts/contracts/core/connext/libraries/AssetLogic.sol#L347

Vulnerability details

Impact

Transaction reverting.

Proof of Concept

  require(
      (value == 0) || (token.allowance(address(this), spender) == 0),
      "SafeERC20: approve from non-zero to non-zero allowance"
  );

Affected Code

346:         // perform the swap
347:         SafeERC20.safeApprove(IERC20(_assetIn), address(pool), _amountIn);

Recommended Mitigation Steps

Set the allowance to zero immediately before the existing safeApprove() call.

ecmendenhall commented 2 years ago

Duplicate of #154

jakekidd commented 2 years ago

Closed as duplicate of https://github.com/code-423n4/2022-06-connext-findings/issues/154

0xleastwood commented 1 year ago

No explanation on how bridge transfers are impacted (potentially locking funds), hence I'll downgrade this to QA.

0xleastwood commented 1 year ago

Merging with #263.