Venus Prime - rvierdiiev'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: 44/115

Findings: 2

Award: $129.33

QA:
grade-b

🌟 Selected for report: 0

🚀 Solo Findings: 0

Awards

124.9633 USDC - $124.96

Labels

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

External Links

Lines of code

https://github.com/code-423n4/2023-09-venus/blob/main/contracts/Tokens/Prime/Prime.sol#L331-L359

Vulnerability details

Impact

stakedAt is not deleted for irrevocable token, in case if token will be burnt, then user will be able to mint revocable token instantly

Proof of Concept

It's possible that irrevocable token will be minted for user, who doesn't have revocable token yet. As you can see, in this case user's stakedAt time is not removed, as it is for revocable minting.

Also it's possible that any token will be burnt by dao. This function will also not remove stakedAt for user.

Because of that next situation is possible. 1.User staked needed amount of token and have waited 80 days. 2.For some reasons, irrevocable token was minted to him by dao and his stakedAt was not deleted. 3.After some long time his token was burnt by dao, but stakedAt is still old enough to mint new revocable token instantly. 4.User calls claim and don't need to wait additional 90 days to get revocable token.

Tools Used

VsCode

When burn irrevocable token, then set stakedAt to block.timestamp.

Assessed type

Error

#0 - c4-pre-sort

2023-10-05T00:02:17Z

0xRobocop marked the issue as duplicate of #633

#1 - c4-judge

2023-10-31T19:49:20Z

fatherGoose1 marked the issue as satisfactory

#2 - c4-judge

2023-11-05T00:50:32Z

fatherGoose1 changed the severity to 3 (High Risk)

QA-01. PrimeLiquidityProvider.getEffectiveDistributionSpeed may show incorrect results

Description

In case if contract has more token balance, then amount that is accrued by rewarders, then PrimeLiquidityProvider.getEffectiveDistributionSpeed function returns distributionSpeed.

However, it's possible that accrueTokens wasn't called for a long time for a token and as result remaining balance is distributed as well, but still not stored in tokenAmountAccrued[token_] variable. As result, function will show that token still accrues rewards, when it's not.

Recommendation

In order to show correct value, you need to call accrueTokens function before. But as this function is not view, that will unlikely be done.

#0 - c4-pre-sort

2023-10-07T02:10:46Z

0xRobocop marked the issue as low quality report

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