_distributeRewards Does Not Reset Approval If Not All Tokens Were Allocated
The StabilizerNode contract approves the Auction contract for a fixed token amount before calling allocateArbRewards, but the function may not use the full amount, leaving residual token approvals. An attacker could potentially exploit these leftover approvals to spend tokens from the StabilizerNode contract.
Submitted by leastwood
_distributeRewards attempts to reward LP token holders when the price of Malt exceeds its price target. Malt Finance is able to being Malt back to its peg by selling Malt and distributing rewards tokens to LP token holders. An external call to Auction is made via the allocateArbRewards function. Prior to this call, the StabilizerNode approves the contract for a fixed amount of tokens, however, the allocateArbRewards function does not necessarily utilise this entire amount. Hence, dust token approval amounts may accrue from within the StabilizerNode contract.
Proof of Concept
https://github.com/code-423n4/2021-11-malt/blob/main/src/contracts/StabilizerNode.sol#L252-L253 https://github.com/code-423n4/2021-11-malt/blob/main/src/contracts/Auction.sol#L809-L871
Recommended Mitigation Steps
Consider resetting the approval amount if the input rewarded amount to allocateArbRewards is less than the output amount.
Alex the Entreprenerd (judge) commented:
Finding is valid, incorrect approvals can cause reverts (USDT being an example), and not fully resetting will also negate gas refunds
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 contract approves a fixed amount but does not reset the approval to zero after the call, leaving a residual allowance.
Impact
Leftover approvals could allow the Auction contract to spend more tokens than intended, potentially leading to token loss or transaction reverts for tokens like USDT.
What the attacker needed
None
The fix
The approval amount should be reset if the rewarded amount is less than the output amount.
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.
When a smart contract allows another contract to spend its tokens, it sets an allowance. If that allowance is not fully used, the leftover amount remains, and the other contract could still spend it later. This report points out that leftover allowances can build up and be misused.
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.