Fraxlend (Frax Finance) contest - CertoraInc's results

Fraxlend: A permissionless lending platform and the final piece of the Frax Finance Defi Trinity.

General Information

Platform: Code4rena

Start Date: 12/08/2022

Pot Size: $50,000 USDC

Total HM: 15

Participants: 120

Period: 5 days

Judge: Justin Goro

Total Solo HM: 6

Id: 153

League: ETH

Frax Finance

Findings Distribution

Researcher Performance

Rank: 6/120

Findings: 2

Award: $2,581.49

🌟 Selected for report: 1

πŸš€ Solo Findings: 1

Findings Information

🌟 Selected for report: CertoraInc

Labels

bug
2 (Med Risk)
disagree with severity
sponsor disputed

Awards

2535.6587 USDC - $2,535.66

External Links

Lines of code

https://github.com/code-423n4/2022-08-frax/blob/main/src/contracts/FraxlendPairCore.sol#L539

Vulnerability details

Impact

Decimals limitation limits the tokens that can be used.

Proof of Concept

Let's give some name to the decimals of certain numbers: n = decimals of numerator oracle. d = decimals denominator oracle. a = decimals of the asset. c= decimals of the collateral.

now, the oracleNormalization = 10 ^(18 + n - d + a - c). And here: https://github.com/code-423n4/2022-08-frax/blob/main/src/contracts/FraxlendPairCore.sol#L536 , price has decimals of 36 + n -d, so here() when we calculate _exchangeRate = _price / oracleNormalization; it would underflow and revert if a >18 +c. And that's a pretty big limitation on the tokens options. We have USDC which have 6 decimals so all the tokens the their decimals < 24 are not possible to use in this system (with USDC together).

Tools Used

#0 - DrakeEvans

2022-09-06T12:23:51Z

Known issue, prevents certain combinations of tokens from being deployed. No high risk as no deployment will occur. No funds at risk, no incorrect functionality. Low at best.

#1 - gititGoro

2022-10-03T23:07:02Z

This hasn't been listed as a known issue so it can't be marked invalid but since deployments can't occur, it's a medium severity.

Lines of code

https://github.com/code-423n4/2022-08-frax/blob/main/src/contracts/FraxlendPairCore.sol#L748

Vulnerability details

Impact

Put users at a risk of liquidation because they can take loans that very close or even on the max_ltv. It is very important to differ between the maxium_ltv to the liquidation threshold since otherwise users would be able to take loan that on this threshold and every minor change on the assets price would put them expose for liquidation.

Proof of Concept

On Compound and AAVE there is a a clear different between the max_ltv and the liquidation_threshold, so users can't take those un safe loans. You can read in this technical paper: https://github.com/aave/aave-v3-core/blob/master/techpaper/Aave_V3_Technical_Paper.pdf At the difference between them in aave

Tools Used

Create a liquidation threshold > max ltv and configure them as you want. Let the users take loans up to the max ltv and let users liquidate them when the loan gets to the liquidation threshold.

#0 - DrakeEvans

2022-09-06T14:05:24Z

As intended, protections happen at UI level not primitive level.

#1 - gititGoro

2022-10-02T05:04:53Z

Downgrading to QA as this suggestion would facilitate a less jarring experience but is not necessary.

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