Malt Finance contest - stonesandtrees's results

Yield farmable, incentive-centric algorithmic stable coin.

General Information

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

Malt Finance

Findings Distribution

Researcher Performance

Rank: 15/32

Findings: 2

Award: $1,125.76

🌟 Selected for report: 1

🚀 Solo Findings: 1

Findings Information

🌟 Selected for report: stonesandtrees

Labels

bug
2 (Med Risk)
sponsor confirmed

Awards

1103.7569 USDC - $1,103.76

External Links

Handle

stonesandtrees

Vulnerability details

Impact

All of the rewardToken in a given AMM pool can be removed from the AMM pool and distributed as LP rewards.

Proof of Concept

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.

https://github.com/code-423n4/2021-11-malt/blob/main/src/contracts/DexHandlers/UniswapHandler.sol#L250-L275

Attack:

  1. Wait for TWAP to rise above the stabilization threshold
  2. Flashloan remove all but a tiny amount of Malt from the pool.
  3. Call 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.
  4. Malt will mint enough Malt to remove a lot of the rewardToken from the pool.
  5. The protocol will now distribute that received 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.

Tools Used

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

AuditHub

A portfolio for auditors, a security profile for protocols, a hub for web3 security.

Built bymalatrax © 2024

Auditors

Browse

Contests

Browse

Get in touch

ContactTwitter