Venus Protocol Isolated Pools - sces60107's results

Earn, Borrow & Lend on the #1 Decentralized Money Market on the BNB Chain

General Information

Platform: Code4rena

Start Date: 08/05/2023

Pot Size: $90,500 USDC

Total HM: 17

Participants: 102

Period: 7 days

Judge: 0xean

Total Solo HM: 4

Id: 236

League: ETH

Venus Protocol

Findings Distribution

Researcher Performance

Rank: 59/102

Findings: 1

Award: $66.59

🌟 Selected for report: 0

🚀 Solo Findings: 0

Awards

66.5871 USDC - $66.59

Labels

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

External Links

Lines of code

https://github.com/code-423n4/2023-05-venus/blob/main/contracts/WhitePaperInterestRateModel.sol#L17 https://github.com/code-423n4/2023-05-venus/blob/main/contracts/BaseJumpRateModelV2.sol#L23

Vulnerability details

Impact

Venus is deployed on BNB Chain instead of Ethereum. Their block times are different. And WhitePaperInterestRateModel.sol is modified from compound. Therefore, blocksPerYear should be modified or Venus would get the wrong rate when using WhitePaperInterestRateModel

Proof of Concept

WhitePaperInterestRateModel.sol set blocksPerYear to 2102400. https://github.com/code-423n4/2023-05-venus/blob/main/contracts/WhitePaperInterestRateModel.sol#L17

    /**
     * @notice The approximate number of blocks per year that is assumed by the interest rate model
     */
    uint256 public constant blocksPerYear = 2102400;

Which is the same in compound. https://github.com/compound-finance/compound-protocol/blob/master/contracts/WhitePaperInterestRateModel.sol#L19

/** * @notice The approximate number of blocks per year that is assumed by the interest rate model */ uint public constant blocksPerYear = 2102400;

However, BNB Chain has the different block time from Ethereum. BaseJumpRateModelV2.sol has the correct blocksPerYear. https://github.com/code-423n4/2023-05-venus/blob/main/contracts/BaseJumpRateModelV2.sol#L23

    /**
     * @notice The approximate number of blocks per year that is assumed by the interest rate model
     */
    uint256 public constant blocksPerYear = 10512000;

Tools Used

Manual Review

Fix the blocksPerYear in WhitePaperInterestRateModel.sol

    /**
     * @notice The approximate number of blocks per year that is assumed by the interest rate model
     */
    uint256 public constant blocksPerYear = 10512000; // use 10512000 instead of 2102400 when deployed on BNB Chain

Assessed type

Context

#0 - c4-judge

2023-05-16T09:21:51Z

0xean marked the issue as duplicate of #559

#1 - c4-judge

2023-06-05T14:02:54Z

0xean marked the issue as satisfactory

#2 - c4-judge

2023-06-05T14:38:22Z

0xean changed the severity to 2 (Med Risk)

#3 - c4-judge

2023-06-05T14:38:32Z

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