ERC20Gauges::_decrementWeightUntilFree() can result in Dos due to infinite loop. #653
Labels
bug
Something isn't working
downgraded by judge
Judge downgraded the risk level of this issue
duplicate-152
grade-c
QA (Quality Assurance)
Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax
sufficient quality report
This report is of sufficient quality
unsatisfactory
does not satisfy C4 submission criteria; not eligible for awards
Lines of code
https://github.com/code-423n4/2023-12-ethereumcreditguild/blob/2376d9af792584e3d15ec9c32578daa33bb56b43/src/tokens/ERC20Gauges.sol#L500-L540
Vulnerability details
Impact
The logic of incrementing the counter for the loop is placed inside a conditional statement.
Incase the if condition is not met, the function can enter into an infinite for loop leading to DOS attack.
Proof of Concept
Refer to the function below, where incrementing the counter was inside a condition and hence incrementing could be skipped.
Tools Used
Manual review
Recommended Mitigation Steps
Move the incrementing line outside the if condition like below.
Assessed type
Loop
The text was updated successfully, but these errors were encountered: