Venus Prime - josephdara'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: 52/115

Findings: 1

Award: $62.21

QA:
grade-a

🌟 Selected for report: 0

🚀 Solo Findings: 0

Lines of code

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

Vulnerability details

Impact

The function initializeTokens() is used to initalize tokens y setting their lastAccruedBlock through the internal _initializeToken(). However this is an issue because it does not set the distribution speed which is a necessity for each tokens being initialized. In the _setTokenDistributionSpeed() we see that it accrues the token using a distributionSpeed of zero up to that point, no matter the amount of blocks which have passed. Which is why in the initialize function, it calls both _initializeToken() and _setTokenDistributionSpeed() at the same time .

Proof of Concept

    /**
     * @notice Initialize the distribution of the token
     * @param tokens_ Array of addresses of the tokens to be intialized
     * @custom:access Only Governance
     */
     //@audit initialize TOkens does not initialize the token distribution speed
    function initializeTokens(address[] calldata tokens_) external onlyOwner {
        for (uint256 i; i < tokens_.length; ) {
            _initializeToken(tokens_[i]);

            unchecked {
                ++i;
            }
        }
    }

Tools Used

Manual Review

Set the distribution speed in the initializeTokens() function to avoid loss of accural blocks.

Assessed type

Other

#0 - 0xRobocop

2023-10-04T23:34:17Z

QA

#1 - c4-pre-sort

2023-10-04T23:34:24Z

0xRobocop marked the issue as low quality report

#2 - c4-pre-sort

2023-10-04T23:35:00Z

0xRobocop marked the issue as primary issue

#3 - c4-judge

2023-10-31T19:05:16Z

fatherGoose1 changed the severity to QA (Quality Assurance)

#4 - fatherGoose1

2023-10-31T19:06:47Z

Agree with QA. Unlikely, and the affected users APR would reflect 0%, raising suspicion to the issue.

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