31112 - [SC - Critical] Bribesolwithdraw doesnt update the totalVotings...

Submitted on May 12th 2024 at 23:48:52 UTC by @crazy_squirrel for Boost | Alchemix

Report ID: #31112

Report type: Smart Contract

Report severity: Critical

Target: https://github.com/alchemix-finance/alchemix-v2-dao/blob/main/src/Bribe.sol

Impacts:

  • The totalVoting tracker can be inflated

Description

Brief/Intro

Bribe.sol The Bribe.sol contract distributes bribes for a given Gauge. Each Gauge had a Bribe contract attached to it, and each Bribe can accept multiple (up to 16) different tokens as bribes. During each epoch, veALCX stakers can collect bribes for a given gauge if they voted on that gauge in the previous epoch.

  • the total amount of bribe b on pool p claimable by a veALCX NFT with token-ID i during a given epoch n is equal to the proportion of total veALCX power that that NFT used to vote on pool p

Vulnerability Details

In the Bribe.sol contract, the deposit function increases the totalVoting tracker's amount. However during the withdrawal's execution, the totalVoting's value is NOT decreased.

This missing totalVoting decrease directly impacts the voting power checkpointing and calculations by writing the wrong amount:

Impact Details

Medium.

By impacting the variable used in the voting result calculations, this

References

Proof of Concept

See and compare the following PoC's console.logs.

These will be:

Priot to running forge test --match-contract PassthroughGauge -vvvv --fork-url https://eth-mainnet.alchemyapi.io/v2/{YOUR_ALCHEMY_API_KEY}, paste the following code to the src/test/PassthroughGauge.t.sol file:

Notice that the totalVoting amount HAS NOT decreased after the withdrawal.

Last updated

Was this helpful?