# Controller is vulnerable to sandwich attack
The controller contract calls Curve (crv) swaps without specifying a minimum return amount, leaving trades open to sandwich attacks. An attacker could front-run and back-run the swap to profit from the price impact, potentially draining user funds.
Submitted by jonah1005
Impact
The protocol frequently interacts with crv a lot. However, the contract doesn’t specify the minimum return amount. Given the fact that there’s a lot of MEV searchers, calling swap without specifying the minimum return amount really puts user funds in danger.
For example, controller’s withdrawAll is designed to transfer all the funds in a strategy.Controller.sol#L360 The arbitrage space is enough for a searcher to sandwich this trade.
Proof of Concept
Recommended Mitigation Steps
Always calculates an estimate return when calling to crv.
transferAndCall (yAxis) acknowledged
GalloDaSballo (judge) commented:
Agree with finding, agree with severity as this allows to “leak value”
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 does not specify a minimum return amount when calling Curve's swap function.
Impact
An attacker could sandwich the trade and leak value from user funds.
What the attacker needed
Access to mempool; ability to trade on Curve
The fix
The contract should always calculate an estimated return and pass it as a minimum when calling Curve.
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 contract trades on a decentralised exchange without setting a minimum amount it will accept, an attacker can buy just before the trade (pushing the price up) and sell just after (profiting from the inflated price). This is called a sandwich attack and it steals value from the original trade.
What is Smart contracts?
Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.