LoopFi - Kirkeelee's results

A dedicated lending market for Ethereum carry trades. Users can supply a long tail of Liquid Restaking Tokens (LRT) and their derivatives as collateral to borrow ETH for increased yield exposure.

General Information

Platform: Code4rena

Start Date: 01/05/2024

Pot Size: $12,100 USDC

Total HM: 1

Participants: 47

Period: 7 days

Judge: Koolex

Id: 371

League: ETH

LoopFi

Findings Distribution

Researcher Performance

Rank: 16/47

Findings: 1

Award: $386.08

🌟 Selected for report: 0

🚀 Solo Findings: 0

Awards

284.4444 USDC - $284.44

Labels

bug
3 (High Risk)
satisfactory
sponsor confirmed
sufficient quality report
upgraded by judge
:robot:_primary
:robot:_42_group
edited-by-warden
duplicate-33

External Links

Lines of code

https://github.com/code-423n4/2024-05-loop/blob/40167e469edde09969643b6808c57e25d1b9c203/src/PrelaunchPoints.sol#L179-L182 https://github.com/code-423n4/2024-05-loop/blob/40167e469edde09969643b6808c57e25d1b9c203/src/PrelaunchPoints.sol#L321-L322

Vulnerability details

Impact

The contract is designed to receive ETH so that users can use the function lockETH() to get lpETH (1 to 1 conversion). User deposits are stored in the state variable totalSupply. While converting all user deposited ETH to lpETH via a privileged function convertAllETH(), the ETH balance of the current contract is used instead of the state variable totalSupply. In case that some users mistakenly sent ETH directly to the contract the 1 to 1 conversion ratio of ETH to lpETH will be broken leading to users getting more lpETH than they were supposed to.

Proof of Concept

  • Consider all user ETH deposits in the state variable is 1000.
  • Someone mistakenly had sent 10 ETH directly to the contract.
  • totalBalance variable in the function convertAllETH() will be 1010 resulting in minting of 1010 lpETH. totalLpETH state variable will be also 1010.
  • While user is claiming lpETH, the following formula is used claimedAmount = userStake.mulDiv(totalLpETH, totalSupply);

In this situation, all users will get 1.01 more lpETH that the ETH they staked. It will be more if the amount of ETH that was mistakenly sent is higher.

Tools Used

Manual review.

Use state variable totalSupply in the function convertAllETH instead of "address(this).balance" to calculate the amount to be deposited to lpETH contract.

Assessed type

Invalid Validation

#0 - c4-judge

2024-05-15T12:30:04Z

koolexcrypto marked the issue as duplicate of #6

#1 - c4-judge

2024-05-15T12:30:18Z

koolexcrypto marked the issue as partial-50

#2 - c4-judge

2024-05-15T12:32:39Z

koolexcrypto marked the issue as not a duplicate

#3 - c4-judge

2024-05-15T12:33:01Z

koolexcrypto marked the issue as primary issue

#4 - c4-judge

2024-05-31T09:52:33Z

koolexcrypto marked the issue as satisfactory

#5 - c4-judge

2024-06-03T09:03:33Z

koolexcrypto changed the severity to 3 (High Risk)

#6 - c4-judge

2024-06-05T07:29:38Z

koolexcrypto changed the severity to 2 (Med Risk)

#7 - c4-judge

2024-06-05T09:41:02Z

koolexcrypto changed the severity to 3 (High Risk)

#8 - c4-judge

2024-06-05T09:41:30Z

koolexcrypto marked the issue as duplicate of #33

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