StabilizerNode Will Mint An Incentive For Triggering An Auction Even If An Auction Exists Already
The StabilizerNode contract rewards the caller for triggering an auction even when an auction already exists but is inactive, because the check only tests whether the auction is active rather than whether it exists. An attacker could repeatedly call the stabilize function to mint free Malt tokens through the caller incentive.
Submitted by leastwood
_startAuction utilises the SwingTrader contract to purchase Malt. If SwingTrader has insufficient capital to return the price of Malt back to its target price, an auction is triggered with the remaining amount. However, no auction is triggered if the current auction exists, but msg.sender is still rewarded for their call to stabilize.
Proof of Concept
_shouldAdjustSupply initially checks if the current auction is active, however, it does not check if the current auction exists. There is a key distinction between the auctionActive and auctionExists functions which are not used consistently. Hence, an auction which is inactive but exists would satisfy the edge case and result in triggerAuction simply returning.
- https://github.com/code-423n4/2021-11-malt/blob/main/src/contracts/Auction.sol#L382-L386
- https://github.com/code-423n4/2021-11-malt/blob/main/src/contracts/Auction.sol#L268-L272
- https://github.com/code-423n4/2021-11-malt/blob/main/src/contracts/StabilizerNode.sol#L342-L344
- https://github.com/code-423n4/2021-11-malt/blob/main/src/contracts/Auction.sol#L873-L888
Recommended Mitigation Steps
Consider using auctionExists and auctionActive consistently in StabilizerNode and Auction to ensure this edge case cannot be abused.
Alex the Entreprenerd (judge) commented:
The warden found a way to effectively mint free malt by spamming the caller incentive by abusing a specific edge case.
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
The contract checks whether an auction is active instead of whether it exists, so an inactive but existing auction still triggers the caller reward.
Impact
An attacker could mint free Malt tokens by repeatedly claiming the caller incentive, as confirmed by the judge.
What the attacker needed
An inactive but existing auction; ability to call stabilize repeatedly
The fix
The contracts should use `auctionExists` and `auctionActive` consistently to prevent this edge case from being abused.
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.
A smart contract pays a reward to anyone who starts an auction when the token price is off target. The code mistakenly pays the reward even when an auction already exists but is not currently running, so someone can call the function over and over to collect free tokens without doing the intended work.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.