31514 - [SC - Medium] Malicious users can cause pokeTokens to revert

Submitted on May 20th 2024 at 22:41:29 UTC by @Django for Boost | Alchemix

Report ID: #31514

Report type: Smart Contract

Report severity: Medium

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

Impacts:

  • Griefing (e.g. no profit motive for an attacker, but damage to the users or the protocol)

Description

Brief/Intro

The voter admin can poke tokens to ensure that they accrue their FLUX and that their votes are reset. In the case where a token's lock has expired in the VE contract, the token is fully reset via voter.reset(). The admin passes in an array of tokens to reset. However, a griefer can cause the entire call to revert by simply frontrunning and resetting their own token.

This will:

  • Cost the Alchemix admin wasted gas

  • Delay the process to reset gauge votes

Vulnerability Details

After an epoch ends, the Voter admin can reset tokens by calling pokeTokens().

As seen above, if a token's lock has ended, it also calls reset() for the token.

The reset() function can revert due to its modifier onlyNewEpoch():

Therefore, a griefer can vote with multiple tokens and simply frontrun any admin call to pokeTokens(). A single token that has already been reset will cause the entire function call to fail. On mainnet, this can be a costly revert due to numerous writes to storage. If the malicious token is near the end of the array, it could waste significant gas.

Impact Details

  • Cost the Alchemix admin wasted gas

  • Delay the process to reset gauge votes

Output from POC

Proof of Concept

Last updated

Was this helpful?