Venus Prime - d3e4's results

Earn, borrow & lend on the #1 Decentralized Money Market on the BNB chain.

General Information

Platform: Code4rena

Start Date: 28/09/2023

Pot Size: $36,500 USDC

Total HM: 5

Participants: 115

Period: 6 days

Judge: 0xDjango

Total Solo HM: 1

Id: 290

League: ETH

Venus Protocol

Findings Distribution

Researcher Performance

Rank: 84/115

Findings: 1

Award: $4.37

QA:
grade-b

🌟 Selected for report: 0

🚀 Solo Findings: 0

Lines of code

https://github.com/code-423n4/2023-09-venus/blob/b11d9ef9db8237678567e66759003138f2368d23/contracts/Tokens/Prime/Prime.sol#L288-L309

Vulnerability details

Impact

Markets cannot be removed. Any mistake or problem with the VToken market or its address when added, or any future problem arising with the market, will essentially brick the Prime contract.

Proof of Concept

A market is added using addMarket() which pushes it into the list of allMarkets. There is no way to remove a market from this list.

Several functions invoke allMarkets in a loop. Thus if any market starts misbehaving, or was mistakenly added, or otherwise becomes undesirable, this has a permanent effect on most of Prime which cannot be corrected. The potential points of failure would be numerous, but difficult to determine. It could be that the oracle loses support or in other ways cannot appropriately manage the price anymore, such as due to market volatility, or that the underlying token loses its appeal or even becomes compromised. Perhaps the greatest danger is the possibility of adding an incorrect market address, or adding a misconfigured VToken.

Furthermore, Prime is initialized with a max loops limit. This limit restricts how many markets can be added. The function to change this limit is internal and only called in the initializer. The loop limit thus cannot be changed. So not only can one not replace a market, one also cannot let the old market be and just add the new one on top. So even if one doesn't necessarily want to remove markets, some markets may become obsolete or of marginal utility. Then one cannot keep up with the ever evolving market landscape and update the market portfolio.

Add functionality for removing markets. Possibly also a way for the owner to _setMaxLoopsLimit().

Assessed type

DoS

#0 - 0xRobocop

2023-10-04T21:51:23Z

Seems like a decision decision.

Marking as primary for sponsor review anyways.

#1 - c4-pre-sort

2023-10-04T21:51:29Z

0xRobocop marked the issue as primary issue

#2 - c4-pre-sort

2023-10-04T21:51:34Z

0xRobocop marked the issue as high quality report

#3 - c4-sponsor

2023-10-24T16:18:07Z

chechu marked the issue as disagree with severity

#4 - chechu

2023-10-24T16:19:06Z

Regarding the missing setMaxLoopsLimit, it’s a fair point. We would consider it QA.

Regarding removing a market, we don't think it's valid.

Removing a market is not a simple scenario. There could be users with claimable interests, so we should wait them for to claim their rewards.

There are available alternatives to “disable” a market. For example, we could set the multipliers of the market, used to calculate the user scores, to zero. This way no more rewards will be allocated to the users.

If the issue is in the market contract, Venus VToken contracts are upgradable, so we could resolve the potential issue with an upgrade (it would depend on the specific problem).

#5 - c4-sponsor

2023-10-24T18:45:49Z

chechu (sponsor) disputed

#6 - c4-judge

2023-10-31T19:00:56Z

fatherGoose1 changed the severity to QA (Quality Assurance)

#7 - fatherGoose1

2023-10-31T19:01:42Z

Agree with sponsor. There are various ways to effectively set a market as inactive. The recommendation to add an external function to set the max loop limit is valid.

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