Olympus DAO contest - PwnPatrol'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: 43/147

Findings: 2

Award: $401.57

🌟 Selected for report: 0

🚀 Solo Findings: 0

Findings Information

🌟 Selected for report: GalloDaSballo

Also found by: PwnPatrol, cccz, itsmeSTYJ

Labels

bug
duplicate
2 (Med Risk)
sponsor confirmed

Awards

347.2615 DAI - $347.26

External Links

Lines of code

https://github.com/code-423n4/2022-08-olympus/blob/b5e139d732eb4c07102f149fb9426d356af617aa/src/policies/Heart.sol#L106 https://github.com/code-423n4/2022-08-olympus/blob/b5e139d732eb4c07102f149fb9426d356af617aa/src/policies/Heart.sol#L112 https://github.com/code-423n4/2022-08-olympus/blob/b5e139d732eb4c07102f149fb9426d356af617aa/src/libraries/TransferHelper.sol#L23

Vulnerability details

Impact

If the Heart.sol contract's balance of rewardToken ever falls below the reward amount, the heartbeat will fail and the full protocol's metrics will be thrown off.

Proof of Concept

The beat() function contains a call to _issueReward(msg.sender).

This function uses the TransferHelper library to call rewardToken.safeTransfer(to_, reward);.

In the helper function, the transfer is made using a low level call and fails unless the call returns a success boolean.

(bool success, bytes memory data) = address(token).call( abi.encodeWithSelector(ERC20.transfer.selector, to, amount) ); require(success && (data.length == 0 || abi.decode(data, (bool))), "TRANSFER_FAILED");

As a result, the full beat() function will fail.

Tools Used

VS Code

Update the _issueReward() function to check the reward amount and the current balance, and send the minimum value out of these two options.

function _issueReward(address to_) internal { uint bal = rewardToken.balanceOf(address(this)); uint toSend = reward > bal ? bal : reward; rewardToken.safeTransfer(to_, toSend); emit RewardIssued(to_, reward); }

#0 - Oighty

2022-09-07T20:36:30Z

Keepers will be able to check the contract balance and the reward amount prior to calling the contract to avoid failed transactions as a result of a low reward balance. We acknowledge that the fails could happen, but that is typical for reward contracts which do not mint tokens.

#1 - Oighty

2022-09-07T20:42:28Z

After reviewing #378 , I changed my mind about this one due to the anti-DOS characteristics of using a min implementation.

#2 - 0xean

2022-09-19T14:34:39Z

closing as duplicate of #378

Lines of code

https://github.com/code-423n4/2022-08-olympus/blob/b5e139d732eb4c07102f149fb9426d356af617aa/src/modules/TRSRY.sol#L92

Vulnerability details

Impact

The getLoan() function in the TRSRY.sol contract is a way for users to withdraw approved loans from the protocol, which can be repaid with repayLoan().

No policies have permission to call this function, and it appears it was intended to be publicly callable, but it has the permissioned modifier, so it is functionally useless.

Without the getLoan() function, repayLoan() is functionally useless as well.

Proof of Concept

Checking the permissions set in each of the policies, there is no policy that has permission to call getLoan().

The permissioned modifier requires that the function is only called by policies that have been pre-approved.

/// @notice Modifier to restrict which policies have access to module functions. modifier permissioned() { if (!kernel.modulePermissions(KEYCODE(), Policy(msg.sender), msg.sig)) revert Module_PolicyNotPermitted(msg.sender); _; }

As a result, this function cannot be called under any circumstances.

Tools Used

VS Code

Remove the permissioned modifier from the getLoan() function.

#0 - 0xLienid

2022-09-06T13:57:44Z

The system is designed around the ability to add and remove policies in the future. The fact there is not a policy using this feature on launch does not preclude its future use and need for permissioning.

#1 - 0xean

2022-09-16T22:38:31Z

Downgrading to QA, sponsors may want to consider documenting that its intended for future use.

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