Lybra Finance - f00l'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: 92/132

Findings: 1

Award: $43.05

🌟 Selected for report: 0

🚀 Solo Findings: 0

Findings Information

🌟 Selected for report: DelerRH

Also found by: DelerRH, HE1M, LaScaloneta, No12Samurai, RedTiger, adeolu, ayden, bart1e, f00l, pep7siup

Labels

bug
2 (Med Risk)
satisfactory
duplicate-828

Awards

43.047 USDC - $43.05

External Links

Lines of code

https://github.com/code-423n4/2023-06-lybra/blob/main/contracts/lybra/miner/ProtocolRewardsPool.sol#L236

Vulnerability details

Impact

this vulnerability would cause rewardPerTokenStored has an incorrect value.

  rewardPerTokenStored = rewardPerTokenStored + (amount * 1e36 / token.decimals()) / totalStaked();

this line is converting the token decimals to 1e18 for consistent calculations. but some ERC20 tokens decimals() function doesnt't return 1e18 such as USDC stable token decimals() returns 6. This would cause an calculating error.

Proof of Concept

Provide direct links to all referenced code in GitHub. Add screenshots, logs, or any other relevant proof that illustrates the concept.

  1. Configarator set the stableToken to some ERC20 token such as USDC
  2. When call this function to distribute rewards this vulnerability would occur

Tools Used

Manual Review

Assessed type

ERC20

#0 - c4-pre-sort

2023-07-11T18:57:01Z

JeffCX marked the issue as duplicate of #501

#1 - c4-judge

2023-07-28T15:40:28Z

0xean marked the issue as satisfactory

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