In case a gauge weight reduction is performed via GaugeController::change_gauge_weight , it is possible that all functions will stop functioning permanently for that gauge
A gauge weight reduction via GaugeController::change_gauge_weight can cause an underflow in the slope calculation, permanently denying service to all functions related to that gauge. This prevents users from claiming rewards and withdrawing assets from affected liquidity gauges.
If the weight of a given gauge has been manually changed using the GaugeController::change_gauge_weight function, all functions related to that gauge might become permanently DoSed.
Proof of Concept
This issue has been reported in this and this report from the previous Code4rena audit of the codebase. However, by the looks of it, no fix has been applied in order to mitigate it, so it is still present.
Recommended Mitigation Steps
Whenever pt.slope is less than d.slope, set the value of pt.slope to 0:
Assets not at direct risk, but the function of the protocol or its availability could be impacted. change_gauge_weight is only callable by the governance, but no admin mistake is required for this to happen.
This issue will actually lead to an absolutely certain loss of funds in the event where a gauge weight reduction is performed via GaugeController::change_gauge_weight. This is because inside of the LendingLedger::update_market function ,which is called inside of both LendingLedger::claim and LendingLedger::sync_ledger there is a call to GaugeController::gauge_relative_weight_write:
What this means is that since GaugeController::gauge_relative_weight_write calls GaugeController::_get_weight internally, whenever a gauge weight reduction is performed, all of those functions will become permanently DoSed; making it impossible for users to claim their rewards for a given market/gauge from the LendingLedger. Also, if the gauge that the weight reduction is performed on uses a LiquidityGauge, the users that have deposited into that liquidity gauge won’t be able to withdraw their underlying assets from it, since in the LiquidityGauge::_afterTokenTransfer hook there are calls to LendingLedger::sync_ledger.
Because of that, I believe that this issue deserves to be judged as one of a High severity, rather than a Medium.
No new information should be introduced and considered in PJQA. Elaborations of the already introduced information can be considered (e.g. tweaking a POC), from either the Judge or the Warden, but they will only count towards the validity of the issue, not its quality score.
Although the underlying issue might qualify for High severity in case more elaboration of impacts and/or a PoC was provided in the original report, it seems to be fair and most in line with our present ruling to maintain Medium severity.
I have one final note to make. In this report from the previous audit of the codebase that I have linked to in my report, the following is stated in its impact section:
… the impact is that the entire gauge is useless, voting powers are permanently locked there and its weight is impossible to change, so the impact is high.
Given that this is actually a part of the original report and that issue #18 was judged as a High under pretty much the same reasoning, doesn’t this issue also fall within the High severity category because of that?
I treat it as a supporting reference but not as a “replacement” for your report.
Although the PoC and reasoning there might fully apply to this audit’s code in scope, it’s reasonable & fair to expect the present report to include impact-based reasoning for High severity and/or a coded PoC which undoubtedly applies to the current audit/code in scope.
In contrast, #18 clearly argues and proves in the original report that voting power will be lost/locked.
I understand if you have reservations about my judgement as this one is definitely a narrow path to walk. Nevertheless, your input is legit and appreciated.
The original report as published on Code4rena, by Arabadzhiev. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
Generating the AI write-up for this report.
This usually takes about 30 seconds. You can read the original meanwhile; this page updates itself.
Writing the technical write-up
Writing the version for beginners
Checking every passage against the original
How it worked
Root cause
Likely an arithmetic underflow when subtracting the weight change from the current slope without checking if the slope is large enough.
What the attacker needed
Governance calls change_gauge_weight to reduce weight
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
Generating the AI write-up for this report.
This usually takes about 30 seconds. You can read the original meanwhile; this page updates itself.
Writing the technical write-up
Writing the version for beginners
Checking every passage against the original
A gauge is a smart contract that distributes rewards. If an admin reduces a gauge's weight, a calculation can go negative and crash, breaking all functions for that gauge. Users then cannot claim rewards or withdraw their deposits.
What is DoS?
A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.