OpenLeverage contest - defsec's results

Permissionless lending and margin trading protocol that enables traders to long/short any trading pair on DEXs efficiently and securely.

General Information

Platform: Code4rena

Start Date: 27/01/2022

Pot Size: $75,000 USDT

Total HM: 6

Participants: 29

Period: 7 days

Judge: leastwood

Total Solo HM: 6

Id: 72

League: ETH

OpenLeverage

Findings Distribution

Researcher Performance

Rank: 2/29

Findings: 3

Award: $6,006.20

🌟 Selected for report: 1

πŸš€ Solo Findings: 1

Findings Information

🌟 Selected for report: defsec

Labels

bug
2 (Med Risk)
sponsor acknowledged

Awards

4882.8125 USDT - $4,882.81

External Links

Handle

defsec

Vulnerability details

Impact

Eth sent to Timelock will be locked in current implementation. I came across this problem while playing around with the governance contract.

Proof of Concept

  • Setup the governance contracts (GovernanceAlpha, Timelock)
  • Send eth to timelock contract
  • Setup a proposal to send 0.1 eth out. Code snippet in ether.js below. proxy refers to GovernorAlpha.
await proxy.propose( [signers[3].address], [ethers.utils.parseEther("0.1")], [""], [ethers.BigNumber.from(0)], "Send funds to 3rd signer" );
  • Vote and have the proposal succeed.
  • Execute the proposal, the proposal number here is arbitrary.
await proxy.execute(2); // this fails await proxy.execute(2, {value: ethers.utils.parseEther("0.1")}) // this would work 0.1 eth will be sent out, but it is sent from the msg.sender not from the timelock contract.

Tools Used

Consider implementing the following code.

function execute(uint proposalId) external { require(state(proposalId) == ProposalState.Queued, "GovernorAlpha::execute: proposal can only be executed if it is queued"); Proposal storage proposal = proposals[proposalId]; proposal.executed = true; for (uint i = 0; i < proposal.targets.length; i++) { timelock.executeTransaction(proposal.targets[i], proposal.values[i], proposal.signatures[i], proposal.calldatas[i], proposal.eta); } emit ProposalExecuted(proposalId); }

##Β Reference

https://github.com/compound-finance/compound-protocol/pull/177/files

#0 - 0xleastwood

2022-02-19T11:22:06Z

I agree with this 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