BadgerDAO Zaps contest - Meta0xNull's results

Building Products to Bring BTC to DeFi.

General Information

Platform: Code4rena

Start Date: 14/11/2021

Pot Size: $30,000 USDC

Total HM: 7

Participants: 13

Period: 3 days

Judge: leastwood

Total Solo HM: 4

Id: 57

League: ETH

BadgerDAO

Findings Distribution

Researcher Performance

Rank: 5/13

Findings: 3

Award: $1,086.58

🌟 Selected for report: 2

🚀 Solo Findings: 0

Findings Information

🌟 Selected for report: WatchPug

Also found by: 0x0x0x, Meta0xNull, fatima_naz, gzeon, ksk2345

Labels

bug
duplicate
3 (High Risk)
sponsor confirmed

Awards

925.536 USDC - $925.54

External Links

Handle

Meta0xNull

Vulnerability details

Impact

governance = _guardian

The Guardian will become Governance of the Contract which is Not Expected. Original Governance will lose control of this contract if they call setGuardian() with Address/Key beyong their control.

Proof of Concept

https://github.com/Badger-Finance/badger-ibbtc-utility-zaps/blob/6f700995129182fec81b772f97abab9977b46026/contracts/IbbtcVaultZap.sol#L116-L119 https://github.com/Badger-Finance/badger-ibbtc-utility-zaps/blob/a5c71b72222d84b6414ca0339ed1761dc79fe56e/contracts/SettToRenIbbtcZap.sol#L130-L133

Tools Used

Manual Review

Before: governance = _guardian;

After: guardian = _guardian;

#0 - GalloDaSballo

2021-11-17T14:42:31Z

Agree with the finding, we fixed it before deployment

#1 - 0xleastwood

2021-12-09T12:11:04Z

duplicate of #51

Findings Information

🌟 Selected for report: Meta0xNull

Labels

bug
G (Gas Optimization)

Awards

80.5196 USDC - $80.52

External Links

Handle

Meta0xNull

Vulnerability details

Impact

The Pool size is known which is 0 to 3. Thus, SLOAD pools.length for Every Loop is Waste of Gas

Proof of Concept

https://github.com/Badger-Finance/ibbtc/blob/d8b95e8d145eb196ba20033267a9ba43a17be02c/contracts/Zap.sol#L70

Tools Used

Manual Review

Before: for (uint i = 0; i < pools.length; i++)

After: for (uint i = 0; i < 4; i++)

#0 - GalloDaSballo

2021-11-17T16:49:18Z

Agree with finding

Findings Information

🌟 Selected for report: Meta0xNull

Labels

bug
G (Gas Optimization)

Awards

80.5196 USDC - $80.52

External Links

Handle

Meta0xNull

Vulnerability details

Impact

The local variable used as for loop index need not be initialized to 0 because the default value is 0. Avoiding this anti-pattern can save a few opcodes and therefore a tiny bit of gas.

Proof of Concept

https://github.com/Badger-Finance/badger-ibbtc-utility-zaps/blob/6f700995129182fec81b772f97abab9977b46026/contracts/IbbtcVaultZap.sol#L149 https://github.com/Badger-Finance/ibbtc/blob/d8b95e8d145eb196ba20033267a9ba43a17be02c/contracts/Zap.sol#L70

Tools Used

Manual Review

Remove explicit 0 initialization of for loop index variable.

Before: for (uint256 i = 0;

After for (uint256 i;

#0 - GalloDaSballo

2021-11-17T16:49:07Z

Agree with finding

AuditHub

A portfolio for auditors, a security profile for protocols, a hub for web3 security.

Built bymalatrax © 2024

Auditors

Browse

Contests

Browse

Get in touch

ContactTwitter