Lybra Finance - yjrwkk's results

A protocol building the first interest-bearing omnichain stablecoin backed by LSD.

General Information

Platform: Code4rena

Start Date: 23/06/2023

Pot Size: $60,500 USDC

Total HM: 31

Participants: 132

Period: 10 days

Judge: 0xean

Total Solo HM: 10

Id: 254

League: ETH

Lybra Finance

Findings Distribution

Researcher Performance

Rank: 31/132

Findings: 2

Award: $301.90

🌟 Selected for report: 0

🚀 Solo Findings: 0

Findings Information

🌟 Selected for report: T1MOH

Also found by: 0xnev, Iurii3, KupiaSec, LaScaloneta, bytes032, cccz, devival, josephdara, pep7siup, sces60107, skyge, yjrwkk

Labels

bug
3 (High Risk)
satisfactory
duplicate-15

Awards

80.4648 USDC - $80.46

External Links

Lines of code

https://github.com/code-423n4/2023-06-lybra/blob/main/contracts/lybra/governance/LybraGovernance.sol#L66-L68 https://github.com/code-423n4/2023-06-lybra/blob/main/contracts/lybra/governance/LybraGovernance.sol#L120-L121

Vulnerability details

Impact

In the LybraGovernance contract, the _voteSucceeded function returns true if supportVotes[1] > supportVotes[0]. At the same time in the proposals function supportVotes[0] is returned as forVotes and supportVotes[1] is returned as againstVotes. This could suggest, that probably _voteSucceeded returns in fact true for failed votes (or proposals returns the wrong values`).

Proof of Concept

https://github.com/code-423n4/2023-06-lybra/blob/main/contracts/lybra/governance/LybraGovernance.sol#L66-L68
https://github.com/code-423n4/2023-06-lybra/blob/main/contracts/lybra/governance/LybraGovernance.sol#L120-L121

diff --git a/contracts/lybra/governance/LybraGovernance.sol b/contracts/lybra/governance/LybraGovernance.sol index 7b2d4ad..8f566a6 100644 --- a/contracts/lybra/governance/LybraGovernance.sol +++ b/contracts/lybra/governance/LybraGovernance.sol @@ -64,7 +64,7 @@ contract LybraGovernance is GovernorTimelockControl { * @dev Is the proposal successful or not. */ function _voteSucceeded(uint256 proposalId) internal view override returns (bool){ - return proposalData[proposalId].supportVotes[1] > proposalData[proposalId].supportVotes[0]; + return proposalData[proposalId].supportVotes[0] > proposalData[proposalId].supportVotes[1]; } /**

Assessed type

Error

#0 - c4-pre-sort

2023-07-03T23:13:37Z

JeffCX marked the issue as duplicate of #15

#1 - c4-judge

2023-07-28T15:32:59Z

0xean marked the issue as satisfactory

Findings Information

🌟 Selected for report: T1MOH

Also found by: Iurii3, LokiThe5th, josephdara, skyge, squeaky_cactus, yjrwkk, zambody

Labels

bug
3 (High Risk)
satisfactory
upgraded by judge
duplicate-14

Awards

221.4353 USDC - $221.44

External Links

Lines of code

https://github.com/code-423n4/2023-06-lybra/blob/main/contracts/lybra/governance/LybraGovernance.sol#L56-L61

Vulnerability details

Impact

quorumReached does not account for forVotes.

Proof of Concept

The supportVodes mapping of the ProposalExtraData struct consists of three values: forVotes, againstVotes and abstainVotes respectively on keys 0, 1 and 2. The function:

function _quorumReached(uint256 proposalId) internal view override returns (bool){ return proposalData[proposalId].supportVotes[1] + proposalData[proposalId].supportVotes[2] >= quorum(proposalSnapshot(proposalId)); }

seems to account only for againstVotes and abstainVotes votes, omitting forVotes.

diff --git a/contracts/lybra/governance/LybraGovernance.sol b/contracts/lybra/governance/LybraGovernance.sol index 7b2d4ad..2566433 100644 --- a/contracts/lybra/governance/LybraGovernance.sol +++ b/contracts/lybra/governance/LybraGovernance.sol @@ -57,7 +57,7 @@ contract LybraGovernance is GovernorTimelockControl { * @dev Amount of votes already cast passes the threshold limit. */ function _quorumReached(uint256 proposalId) internal view override returns (bool){ - return proposalData[proposalId].supportVotes[1] + proposalData[proposalId].supportVotes[2] >= quorum(proposalSnapshot(proposalId)); + return proposalData[proposalId].supportVotes[0] + proposalData[proposalId].supportVotes[1] + proposalData[proposalId].supportVotes[2] >= quorum(proposalSnapshot(proposalId)); } /**

Assessed type

Error

#0 - c4-pre-sort

2023-07-04T15:14:12Z

JeffCX marked the issue as duplicate of #14

#1 - c4-judge

2023-07-28T15:33:45Z

0xean marked the issue as satisfactory

#2 - c4-judge

2023-07-28T19:42:05Z

0xean changed the severity to 3 (High Risk)

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