Olympus DAO contest - Chom's results

Version 3 of Olympus protocol, a decentralized floating currency.

General Information

Platform: Code4rena

Start Date: 25/08/2022

Pot Size: $75,000 USDC

Total HM: 35

Participants: 147

Period: 7 days

Judge: 0xean

Total Solo HM: 15

Id: 156

League: ETH

Olympus DAO

Findings Distribution

Researcher Performance

Rank: 108/147

Findings: 1

Award: $54.31

🌟 Selected for report: 0

πŸš€ Solo Findings: 0

Lines of code

https://github.com/code-423n4/2022-08-olympus/blob/b5e139d732eb4c07102f149fb9426d356af617aa/src/Kernel.sol#L351-L372

Vulnerability details

Impact

Kernel may not be able to migrate due to having too many keycodes or policies. Having too many keycodes or policies will raise the gas limit revert on _migrateKernel function.

Proof of Concept

function _migrateKernel(Kernel newKernel_) internal { uint256 keycodeLen = allKeycodes.length; for (uint256 i; i < keycodeLen; ) { Module module = Module(getModuleForKeycode[allKeycodes[i]]); module.changeKernel(newKernel_); unchecked { ++i; } } uint256 policiesLen = activePolicies.length; for (uint256 j; j < policiesLen; ) { Policy policy = activePolicies[j]; // Deactivate before changing kernel policy.setActiveStatus(false); policy.changeKernel(newKernel_); unchecked { ++j; } } }

Since it loop with allKeycodes and activePolicies. If either allKeycodes or activePolicies has too many members. Gas will explode.

Tools Used

Manual review

limit number of allKeycodes and activePolicies

#0 - ind-igo

2022-09-02T23:37:20Z

We acknowledged this months ago and realized that the number of contracts to make this an issue would be much much higher than we ever plan to have.

#1 - 0xean

2022-09-19T23:30:55Z

There is no reasonable limit that could be set here as each contract will take an indeterminant amount of gas, so leaving it unbounded, but realizing the issue exists (as it does with all smart contracts) is reasonable.

Downgrading to QA

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