Closed c4-bot-2 closed 7 months ago
MarioPoneder marked the issue as primary issue
Related to #22 (same mitigation measures)
Not duplicating for now.
zjesko (sponsor) confirmed
zjesko (sponsor) acknowledged
zjesko (sponsor) confirmed
MarioPoneder marked the issue as duplicate of #22
MarioPoneder changed the severity to 2 (Med Risk)
The findings are duplicates if they share the same root cause. More specifically, if fixing the Root Cause (in a reasonable manner) would cause the finding to no longer be exploitable, then the findings are duplicates.
MarioPoneder marked the issue as satisfactory
Lines of code
https://github.com/code-423n4/2024-03-neobase/blob/main/src/GaugeController.sol#L224-L229
Vulnerability details
Impact
remove_gauge
will remove the weight of non-existent gauge types due to incorrect execution order.Proof of Concept
When
remove_gauge
is called, it will first remove thegauge_types_
of the provided_gauge
address by setting it to 0. Then, it will remove the gauge weight by calling_remove_gauge_weight
.https://github.com/code-423n4/2024-03-neobase/blob/main/src/GaugeController.sol#L224-L229
However, calling
_remove_gauge_weight
will always remove the weight of non-existent gauge types because it accessesgauge_types_
to get the gauge type, which has already been removed before this function is called.https://github.com/code-423n4/2024-03-neobase/blob/main/src/GaugeController.sol#L350-L374
This will cause the
remove_gauge
function to not properly remove gauge's weight and update gauge type's point sum.Tools Used
Manual review.
Recommended Mitigation Steps
Set
gauge_types_
to 0 after_remove_gauge_weight
is called.Assessed type
Error