Submitted by minhquanym
In StabilizerNode, the default behaviour when twap is below the lower peg threshold, all transfers to the amm pool are blocked. However when usePrimedWindow = true, it will only block transfers for primedWindow = 10 blocks. After 10 blocks, the block automatically stops and allows free market trading.
The first call to start this priming will receive defaultIncentive Malt and set primedBlock to start the priming. However, function _validateSwingTraderTrigger() which is used to validate and start the priming using livePrice is easy to be manipulated. Attacker can manipulate it to receive defaultIncentive in 2 consecutive blocks.
Consider the scenario:
Attacker cost is only flash loan fee, since his call will start an auction but not trigger swing trader so the state of AMM pool when he repays the flash loan is still the same (only added flash loan fee).
https://github.com/code-423n4/2023-02-malt/blob/700f9b468f9cf8c9c5cffaa1eba1b8dea40503f9/contracts/StabilityPod/StabilizerNode.sol#L312-L334
Consider not giving incentives for caller or reset the primedBlock at least after primedWindow blocks.
0xScotch (Malt) commented:
Picodes (judge) commented:
Picodes (judge) commented:
0xScotch (Malt) acknowledged
