vaultOwner Can Front-Run rebalance() With setAutomation() To Lower Incentives
A vault owner can front-run a keeper's rebalance call by lowering the incentive fee via setAutomation, causing the keeper to receive less reward than expected. The attacker can then restore the fee afterwards.
Submitted by 0xNazgul
Impact
A vaultOwner who is “not confident enough in ourselves to stay up-to-date with market conditions to know when we should move to less volatile collateral to avoid liquidations.” They can open their vault to other users who pay attention to the markets and would call rebalance to receive the incentivized fees. The vaultOwner who doesn’t want to pay the baiting high fees instead front-runs the autoRebalance() with setAutomation() to lower incentives.
Proof of Concept
- Mallory, a
vaultOwnerisn’t confident in staying up-to-date with market conditions. She has her vault setup to be automated and has high fee incentives. - Alice, a user who is confident in staying up-to-date with market conditions see’s a profitable opportunity and calls
rebalance(). - Mallory is confident in her programing and watching mempools for when
rebalance()is called. See’s that Alice just calledrebalance()and callssetAutomation()to lower the incentives. - Alice’s call to
rebalance()then goes through getting lower incentives and Mallory then callssetAutomation()to set the incentives back to normal.
Recommended Mitigation Steps
Add a time-lock to setAutomation so that the vaultOwner can’t front-run users.
RnkSngh (Mimo) confirmed and commented:
We confirm that this is an issue and intend to implement a fix.
horsefacts (warden) reviewed mitigation:
Status: 👍 Acknowledged
Finding: A warden identified that a malicious vault owner could frontrun automated calls to
MIMOAutoRebalance#rebalanceand reconfigure their automated vault with a reduced incentive fee.
What changed: The Mimo team have acknowledged the finding.
Acknowledgement:
We’ve decided against fixing this in the end. The only potential loser is a keeper/automator that gets frontrun and does not get the reward they thought they would get and thus paid a gas fee that was not covered by the reward. We feel keepers are advanced enough to hide their txs from the mempool and that they’re also smart enough to let the tx revert if it does not yield a profit. For legit users of the protocol this has no impact whatsoever IMO. We also feel a timelock wouldn’t have been enough of a mitigation and might hurt legitimate use of the protocol.
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
Likely the setAutomation function has no time delay, allowing the vault owner to change incentives immediately before a rebalance transaction is mined.
Impact
A keeper could receive a lower reward than expected and may pay a gas fee that is not covered by the reward; the protocol stated this has no impact on legitimate users.
What the attacker needed
Vault owner controls automation settings; attacker can watch mempool; keeper calls rebalance
The fix
The project decided against fixing this, stating that a timelock would not be sufficient and might hurt legitimate use.
How it was found
- Mallory sets up her vault with high fee incentives for automation.
- Alice sees a profitable opportunity and calls rebalance().
- Mallory watches the mempool, sees Alice's rebalance call, and calls setAutomation() to lower the incentives.
- Alice's rebalance() executes with lower incentives, and Mallory then calls setAutomation() to restore the incentives.
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 vault owner sets a fee to reward anyone who rebalances their vault. A keeper watches for this and calls rebalance to earn the fee. The owner can see the keeper's transaction in the waiting area (mempool) and quickly change the fee to a lower amount before the keeper's transaction is processed, so the keeper earns less.
What is Race condition?
Parallel requests reach a state the code assumed could not happen: a coupon used twice, a limit overrun, a check skipped.