Backd Tokenomics contest - StyxRave's results

Maximize the power of your assets and start earning yield

General Information

Platform: Code4rena

Start Date: 27/05/2022

Pot Size: $75,000 USDC

Total HM: 20

Participants: 58

Period: 7 days

Judge: GalloDaSballo

Total Solo HM: 15

Id: 131

League: ETH

Backd

Findings Distribution

Researcher Performance

Rank: 15/58

Findings: 3

Award: $909.59

🌟 Selected for report: 0

🚀 Solo Findings: 0

Findings Information

🌟 Selected for report: peritoflores

Also found by: JC, StyxRave

Labels

bug
duplicate
2 (Med Risk)

Awards

737.784 USDC - $737.78

External Links

Lines of code

https://github.com/code-423n4/2022-05-backd/blob/2a5664d35cde5b036074edef3c1369b984d10010/protocol/contracts/swappers/SwapperRouter.sol#L280 https://github.com/code-423n4/2022-05-backd/blob/2a5664d35cde5b036074edef3c1369b984d10010/protocol/contracts/swappers/SwapperRouter.sol#L140

Vulnerability details

Using payable(address).transfer is deprecated in favor of using .call{value:...}("") as the correct way of sending ETH. Using transfer or send will make transactions fail when the address corresponds to a contract that does not implement a payable function using less than 2300 gas (multisigs and proxied contracts). Implementations of this in SwapperRouter.sol will prevent such contracts from being able to correctly interact with the protocol.

#0 - chase-manning

2022-06-06T11:11:02Z

Duplicate of #180

#1 - GalloDaSballo

2022-06-19T21:10:06Z

Dup of #180

Awards

113.8755 USDC - $113.88

Labels

bug
QA (Quality Assurance)
resolved
sponsor confirmed

External Links

Redundant greater than 0 checks for uint When executing pool weight changes in InflationManager.sol (_executeKeeperPoolWeight, _executeLpPoolWeight, _executeAmmTokenWeight), corresponding total pool weights x are unsigned int. As they can't only be x >= 0, the expression x>0 ? x : 0 does nothing.

Sensible changes, such as adding a Governor should be a two-step process addGovernance directly grants Roles.GOVERNANCE to the newGovernor. It should be a two-step process (e.g. setGovernance-acceptGovernance) to ensure the input address is correct. Whilst renounceGovernance checks that there is at least one Governor left, in a single-Governor scenario, back to back execution of addGovernance with an incorrect address followed by renounceGovernance will render the protocol ungovernable. Additionally, as there is no way to revoke this role, granting governance to an address means that address will have complete control over the protocol forever after.

Requirement uses external call to user-controlled address in PoolMigrationZap.sol - migrate require(oldPool_.getWithdrawalFee(msg.sender, lpTokenAmount_) == 0, "withdrawal fee not 0"); makes an external call to oldPoolAddress_, which is a user-controlled address. It could be a malicious contract, thus reporting any result needed to bypass the guard.

Erring on the safe side for reentrancy in PoolMigrationZap.sol - migrate While I did not manage to exploit it in any way - I'd recommend against not including a nonReentrant guard in this function. oldPoolAddress_ could be a malicious contract thus enabling multiple calls to migrate spanning from the external calls to oldPool or lpToken_.

Recommended missing events Modifying key protocol variables or triggering key events should always emit events accordingly to ensure transparency and proper traceability.

#0 - GalloDaSballo

2022-06-20T15:29:55Z

Redundant greater than 0 checks for uint

Agree as they can at lowest be 0

Sensible changes, such as adding a Governor should be a two-step process

Personally disagree, but valid find

Requirement uses external call to user-controlled address in PoolMigrationZap.sol - migrate

Because of the architecture it's the callers responsibility to ensure the old contract is safe, as no funds beside the caller are at stake, I don't believe any risk was shown in this finding

Erring on the safe side for reentrancy in PoolMigrationZap.sol - migrate

Agree that the function doesn't respect CEI

Agree with informational level finding

Overall a concise report, I especially liked the formatted links which make the text way faster to read through

Awards

57.93 USDC - $57.93

Labels

bug
G (Gas Optimization)
resolved
sponsor confirmed

External Links

  • PoolMigrationZap.sol - Use UncheckedMath.uncheckedInc instead of ++i in loop

  • FeeBurner.sol - Use calldata instead of memory for read-only function argument array tokens_.

#0 - GalloDaSballo

2022-06-17T22:43:38Z

PoolMigrationZap.sol - Use UncheckedMath.uncheckedInc instead of ++i in loop

20 gas

FeeBurner.sol - Use calldata instead of memory for read-only function argument array tokens_.

In lack of explanation will not give it any gas saved

#1 - GalloDaSballo

2022-06-17T22:43:41Z

20 gas saved

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