The function GaugeController::_updateGaugeWeight
is vulnerable to an underflow issue. A user can manipulate the gauge weight calculations, leading to unexpected behavior or breaking the contract logic.
An underflow occurs in the function GaugeController::_updateGaugeWeight
. Below is a proof of concept:
A new gauge is created with an initial weight:
The first user calls GaugeController::vote
with votingPower = 4000
and weight = 6000
. Execution proceeds to _updateGaugeWeight
:
The user's voting power increases, and they attempt to reset the weight to 0 by calling GaugeController::vote
with votingPower = 5000
and weight = 0
:
The subtraction operation leads to an underflow because 2400 - 3000
results in a negative number, which Solidity does not support in unsigned integers.
User will not be able to revoke the votes.
Many case it will be DOS.
Manual code review
Implement proper bounds checks before performing subtraction.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.