AuctionParticipant.sol: setReplenishingIndex mistake could freeze unclaimed tokens
The admin function setReplenishingIndex prevents lowering the index, so an accidental increase would permanently lock unclaimed tokens from auctions at lower indices. An attacker with admin privileges could exploit this to freeze funds.
Originally disclosed on Code4rena
Submitted by harleythedog
In AuctionParticipant.sol, the function setReplenishingIndex is an admin function that allows manually setting replenishingIndex. As I have shown in my two previous findings, I believe that this function could be called frequently. In my opinion (and Murphy’s law would agree), this implies that eventually an admin will accidentally set replenishingIndex incorrectly with this function.
Right now, setReplenishingIndex does not allow the admin to set replenishingIndex to a value smaller than it currently is. So, if an admin were to accidentally set this value too high, then it would be impossible to set it back to a lower value (the higher the value set, the worse this issue). All of the unclaimed tokens on auctions at smaller indices would be locked forever.
Proof of Concept
See code for setReplenishingIndex here: https://github.com/code-423n4/2021-11-malt/blob/c3a204a2c0f7c653c6c2dda9f4563fd1dc1cecf3/src/contracts/AuctionParticipant.sol#L132
Recommended Mitigation Steps
Remove the require statement on line 136, so that an admin can set the index to a smaller value.
Alex the Entreprenerd (judge) commented:
Agree with the finding in that if the
ADMINwere to increase thereplenishingIndexthen the unclaim tokens at auctions below the index wouldn’t be claimable anymore.I believe the warden properly highlighted what an hypothetical abuse of
admin privilegewould look like. As such I’ll rate the finding with medium severity.I don’t necessarily agree with the warden recommended mitigation, it may actually be best to simply delete the setter, or force it to go up by one index at a time after checking that all tokens are claimed
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the require statement in setReplenishingIndex prevents decreasing the index, making an erroneous increase irreversible.
Impact
Unclaimed tokens on auctions at smaller indices could be locked forever if the admin sets the index too high.
What the attacker needed
Admin privileges
The fix
Remove the require statement that prevents lowering the index, or delete the setter or force it to increase by one index at a time after checking that all tokens are claimed.
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.
This is a smart contract where an admin can change a number that controls which auctions are processed. If the admin sets it too high by mistake, tokens from earlier auctions can never be claimed because the number cannot be lowered. The report suggests removing a restriction so the admin can fix such mistakes.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.