Platform: Code4rena
Start Date: 25/11/2021
Pot Size: $80,000 USDC
Total HM: 35
Participants: 32
Period: 7 days
Judge: GalloDaSballo
Total Solo HM: 27
Id: 59
League: ETH
Rank: 15/32
Findings: 2
Award: $1,125.76
🌟 Selected for report: 1
🚀 Solo Findings: 1
🌟 Selected for report: stonesandtrees
1103.7569 USDC - $1,103.76
stonesandtrees
All of the rewardToken
in a given AMM pool can be removed from the AMM pool and distributed as LP rewards.
In the stabilize
method in the StabilizerNode
the initial check to see if the Malt price needs to be stabilized it uses a short period TWAP:
https://github.com/code-423n4/2021-11-malt/blob/main/src/contracts/StabilizerNode.sol#L156
However, if the price is above the threshold for stabilization then the trade size required to stabilize looks at the AMM pool directly which is vulnerable to flashloan manipulation.
Attack:
stabilize
. This will pass the TWAP check and execute _distributeSupply
which in turn ultimately calls _calculateTradeSize
in the UniswapHandler
. This calculation will determine that almost all of the rewardToken
needs to be removed from the pool to return the price to peg.rewardToken
from the pool.rewardToken
as rewards. 0.3% of which goes directly to the attacker and the rest goes to LP rewards, swing trader and the treasury.The amount of money that can be directly stolen by a malicious actor is small but it can cause a lot of pain for the protocol as the pool will be destroyed and confusion around rewards will be created.
Manual review
Use a short TWAP to calculate the trade size instead of reading directly from the pool.
#0 - GalloDaSballo
2022-01-25T02:04:19Z
I believe the warden has identified a valid grief and potential exploit
I'm not convinced on the simplicity of:
2. Flashloan remove all but a tiny amount of Malt from the pool.
You'd have to buy that liquidity in order to be able to remove the malt, which effectively makes the operation not as straightforward (if not unprofitable for the attacker).
I do believe the grief can be performed but in lack of a clear incentive for the attacker, am going to downgrade to Medium Severity. Can be done, but not clear on the incentives
🌟 Selected for report: cmichel
Also found by: 0x1f8b, Meta0xNull, WatchPug, defsec, jayjonah8, leastwood, stonesandtrees
stonesandtrees
An attacker can frontrun the intializer call to set themselves as admin.
All contracts are set up using OpenZeppellin's initializable
contract. The typical usage of this is for proxy contracts but Malt does not seem to be set up to use proxies.
The vulnerability here is that the admin for the contract (and the timelock) is set up during the initialize call.
https://github.com/code-423n4/2021-11-malt/blob/main/src/contracts/Auction.sol#L156-L160
The deployment and the initialize call are done in separate transactions allowing a malicious actor to front run the initialize call and set themselves as admin. If this was not noticed then the attacker would have absolute control over all admin and timelock only methods.
Depending on the contracts affected this could lead to loss of all funds.
Manual review
Avoid using initializers for critical setup and instead do this setup in the contructor.
#0 - 0xScotch
2021-12-08T13:02:47Z
#245
#1 - GalloDaSballo
2022-01-22T14:44:54Z
Duplicate of #245