Closed code423n4 closed 2 years ago
Missing approve(0) RubiconRouter.sol approveAssetOnMarket() - line 157 RubiconRouter.sol depositWithETH() - line 465 BathToken.initialize() - line 214 BathToken.approveMarket() - line 256 Impact ERC20.approve() function is called only once without setting the allowance to zero. Some tokens, require first reducing the address' allowance to zero by calling approve(_spender, 0). Transactions will revert when using an unsupported token.
Proof of Concept: https://github.com/code-423n4/2022-05-rubicon/blob/main/contracts/RubiconRouter.sol#L157 https://github.com/code-423n4/2022-05-rubicon/blob/main/contracts/RubiconRouter.sol#L465 https://github.com/code-423n4/2022-05-rubicon/blob/main/contracts/rubiconPools/BathToken.sol#L256
Recommended Mitigation Steps: Use approve(_spender, 0) to set the allowance to zero immediately before each of the existing approve() calls.
dup of #100
Judge has assessed an item in Issue #220 as Medium risk. The relevant finding follows: