Venus Protocol Isolated Pools - carlitox477'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: 60/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/8be784ed9752b80e6f1b8b781e2e6251748d0d7e/contracts/WhitePaperInterestRateModel.sol#L17

Vulnerability details

Description

Venus operates in the BSC chain, where the block emission rate is different from Ethereum, where Compound is deployed. In the BSC chain, the average block time is 3 seconds. This means that we can expect a block emission of $\frac{60}{3} = 20$ per minute, giving a total of $20 \times 60 \times 24 \times 365 = 10512000$ blocks per year, a total of $\frac{BSC; Blocks ; per ; Year}{ETH; Blocks ; per ; Year} - 1 = 400%$ more blocks per year.

Impact

The error leads to miscalculation of baseRatePerBlock and multiplierPerBlock, affecting critical parts of the protocol

POC

The pointed mistake leads to miscalculation of WhitePaperInterestRateModel::getBorrowRate by inflating it.

This directly affects VToken::borrowRatePerBlock and VToken::accrueInterest

VToken::accrueInterest affects:

  • VToken::totalBorrowsCurrent
  • VToken::borrowBalanceCurrent
  • VToken::mint
  • VToken::mintBehalf
  • VToken::redeem
  • VToken::redeemUnderlying
  • VToken::borrow
  • VToken::repayBorrow
  • VToken::repayBorrowBehalf
  • VToken::setReserveFactor
  • VToken::reduceReserves
  • VToken::addReserves
  • VToken::setInterestRateModel
  • VToken::exchangeRateCurrent
  • VToken::_liquidateBorrow
  • VToken::repayBorrowBehalf
  • VToken::repayBorrowBehalf
  • VToken::repayBorrowBehalf

Mitigation steps

Just change uint256 public constant blocksPerYear = 2102400; for uint256 public constant blocksPerYear = 10512000;

Assessed type

Error

#0 - c4-judge

2023-05-16T09:22:22Z

0xean marked the issue as duplicate of #559

#1 - c4-judge

2023-06-05T14:02:57Z

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