Fraxlend (Frax Finance) contest - mrpathfindr'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: 104/120

Findings: 1

Award: $21.17

🌟 Selected for report: 0

🚀 Solo Findings: 0

G002 - Cache Array Length Outside of Loop

Instances Include:

https://github.com/FraxFinance/fraxlend/blob/0f9bc5ddd6872fba04f4d8fb67c92a88416d19b2/src/contracts/FraxlendPair.sol#L289

https://github.com/FraxFinance/fraxlend/blob/0f9bc5ddd6872fba04f4d8fb67c92a88416d19b2/src/contracts/FraxlendPair.sol#L308

https://github.com/FraxFinance/fraxlend/blob/0f9bc5ddd6872fba04f4d8fb67c92a88416d19b2/src/contracts/FraxlendPairCore.sol#L265

Mitigation:

Do this

var borrowersLength = _borrowers.length for (uint256 i = 0; i < borrowersLength; i++) {

Instead of this

for (uint256 i = 0; i < _borrowers.length; i++) {

G003 - Use != 0 instead of > 0 for Unsigned Integer Comparison

Instances: 


https://github.com/FraxFinance/fraxlend/blob/0f9bc5ddd6872fba04f4d8fb67c92a88416d19b2/src/contracts/FraxlendPairCore.sol#L477

https://github.com/FraxFinance/fraxlend/blob/0f9bc5ddd6872fba04f4d8fb67c92a88416d19b2/src/contracts/FraxlendPairCore.sol#L754

https://github.com/FraxFinance/fraxlend/blob/0f9bc5ddd6872fba04f4d8fb67c92a88416d19b2/src/contracts/FraxlendPairCore.sol#L835

Mitigation:

Do this:

if (userBorrowShares[msg.sender] > 0) {

Instead of this

if (userBorrowShares[msg.sender] != 0) {

G009 - Make Function external instead of public

Instances: 



https://github.com/FraxFinance/fraxlend/blob/0f9bc5ddd6872fba04f4d8fb67c92a88416d19b2/src/contracts/FraxlendPairHelper.sol#L159

https://github.com/FraxFinance/fraxlend/blob/0f9bc5ddd6872fba04f4d8fb67c92a88416d19b2/src/contracts/FraxlendPairHelper.sol#L226

https://github.com/FraxFinance/fraxlend/blob/0f9bc5ddd6872fba04f4d8fb67c92a88416d19b2/src/contracts/LinearInterestRate.sol#L52

Mitigation:

Do this:

function previewRateInterest( address _fraxlendPairAddress, uint256 _timestamp, uint256 _blockNumber ) external view returns (uint256 _interestEarned, uint256 _newRate) {

Instead of this

function previewRateInterest( address _fraxlendPairAddress, uint256 _timestamp, uint256 _blockNumber ) public view returns (uint256 _interestEarned, uint256 _newRate) {

G012 - Use Prefix Increment instead of Postfix Increment if possible|

Instances:

https://github.com/FraxFinance/fraxlend/blob/0f9bc5ddd6872fba04f4d8fb67c92a88416d19b2/src/contracts/FraxlendPair.sol#L289

https://github.com/FraxFinance/fraxlend/blob/0f9bc5ddd6872fba04f4d8fb67c92a88416d19b2/src/contracts/FraxlendPair.sol#L308

https://github.com/FraxFinance/fraxlend/blob/0f9bc5ddd6872fba04f4d8fb67c92a88416d19b2/src/contracts/FraxlendWhitelist.sol#L51

Mitigation:

Do this:

for (uint256 i = 0; i < _lenders.length; ++i) {

Instead of this:

for (uint256 i = 0; i < _lenders.length; i++) {
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