Livepeer Onchain Treasury Upgrade - VAD37's results

Decentralized video infrastructure protocol powering video in web3's leading social and media applications.

General Information

Platform: Code4rena

Start Date: 31/08/2023

Pot Size: $55,000 USDC

Total HM: 5

Participants: 30

Period: 6 days

Judge: hickuphh3

Total Solo HM: 2

Id: 282

League: ETH

Livepeer

Findings Distribution

Researcher Performance

Rank: 5/30

Findings: 1

Award: $2,318.70

🌟 Selected for report: 0

🚀 Solo Findings: 0

Findings Information

🌟 Selected for report: bronze_pickaxe

Also found by: Krace, VAD37, ether_sky

Labels

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

Awards

2318.7003 USDC - $2,318.70

External Links

Lines of code

https://github.com/code-423n4/2023-08-livepeer/blob/main/contracts/bonding/BondingManager.sol#L355

Vulnerability details

BondingManager.sol have 2 mathUtils libraries, MathUtils use 1e6 as precision while PreciseMathUtils use 1e27 as precision. Some variable use MathUtils while other use PreciseMathUtils which might cause confusion. It happen with treasuryRewardCutRate variable which require PreciseMathUtils (comment) but mistakenly use MathUtils instead on this specific line

Impact

Function updateTranscoderWithFees() not workinga as intended and always revert when calling twice for current round.

Proof of Concept

    // Deduct what would have been the treasury rewards
    uint256 treasuryRewards = MathUtils.percOf(rewards, treasuryRewardCutRate);//@audit M treasury rate is 1e27. Here it is 1e6
    rewards = rewards.sub(treasuryRewards);//@note reward now send some percentage to treasury

treasuryRewardCutRate decimal value is 1e27 which suppose to use with PreciseMathUtils.percOf for all operation.

Like implemented in rewardWithHint() from same contract.

treasuryRewardCutRate is 0.1e27 in config

So this second line rewards = rewards - (rewards * treasuryRewardCutRate /1e6) always underflow and revert.

Tools Used

manual

Change MathUtils to PreciseMathUtils

    // Deduct what would have been the treasury rewards
    uint256 treasuryRewards = PreciseMathUtils.percOf(rewards, treasuryRewardCutRate);
    rewards = rewards.sub(treasuryRewards);

Assessed type

Decimal

#0 - c4-pre-sort

2023-09-08T15:11:22Z

141345 marked the issue as duplicate of #165

#1 - c4-judge

2023-09-18T02:45:05Z

HickupHH3 changed the severity to 3 (High Risk)

#2 - c4-judge

2023-09-18T02:45:25Z

HickupHH3 marked the issue as satisfactory

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