Skip to content
Business logic Audit finding Intermediate

Changing a strategy can be bricked

The vault's setStrategy function requires the strategy to have zero invested assets, but anyone can send a tiny amount of aUST to the strategy, making investedAssets non-zero and preventing the strategy from being replaced. An attacker could repeatedly grief the protocol by sending 1 wei of aUST, forcing the protocol to redeem and wait, and since EthAnchor does not accept redeems below 10 aUST, the protocol would need to add more funds to redeem the griefer's dust.

kenzo Follow

Originally disclosed on Code4rena

Submitted by kenzo, also found by danb and harleythedog

A vault wouldn’t let the strategy be changed unless the strategy holds no funds.

Since anybody can send funds to the strategy, a griefing attack is possible.

Impact

Strategy couldn’t be changed.

Proof of Concept

setStrategy requires strategy.investedAssets() == 0. (Code ref) investedAssets contains the aUST balance and the pending redeems: (Code ref)

uint256 aUstBalance = _getAUstBalance() + pendingRedeems;

So if a griefer sends 1 wei of aUST to the strategy before it is to be replaced, it would not be able to be replaced. The protocol would then need to redeem the aUST and wait for the process to finish - and the griefer can repeat his griefing. As they say, griefers gonna grief.

Recommended Mitigation Steps

Consider keeping an internal aUST balance of the strategy, which will be updated upon deposit and redeem, and use it (instead of raw aUST balance) to check if the strategy holds no aUST funds.

Another option is to add capability for the strategy to send the aUST to the vault.

ryuheimat (Sandclock) confirmed

CloudEllie (C4) commented:

Warden kenzo requested that I add the following:

“Additionally, impact-wise: EthAnchor does not accept redeems of less than 10 aUST. This means that if a griefer only sends 1 wei aUST, the protocol would have to repeatedly send additional aUST to the strategy to be able to redeem the griefer’s aUST.”

The original report as published on Code4rena, by kenzo. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

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 vault uses the strategy's raw aUST balance (including pending redeems) to determine if it holds no funds, rather than tracking deposits internally, allowing external transfers to manipulate the check.

Impact

The strategy could not be changed, and the protocol would need to redeem the aUST and wait, with the griefer able to repeat the attack; additionally, because EthAnchor does not accept redeems of less than 10 aUST, the protocol would have to repeatedly send additional aUST to the strategy to redeem the griefer's aUST.

What the attacker needed

Anyone can send aUST to the strategy; strategy is about to be replaced

The fix

The strategy should keep an internal aUST balance updated upon deposit and redeem, and use that instead of the raw aUST balance to check if it holds no funds; alternatively, the strategy could be allowed to send the aUST to the vault.

How it was found

  1. A griefer sends 1 wei of aUST to the strategy before it is to be replaced.
  2. The strategy's investedAssets becomes non-zero, so setStrategy fails.
  3. The protocol must redeem the aUST and wait for the process to finish.
  4. The griefer can repeat the attack.

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 is a smart contract that holds funds and uses a strategy to invest them. To change the strategy, the vault checks that the old strategy has no funds left. But because anyone can send a tiny amount of a token to the strategy, an attacker can make that check fail, blocking the change. This is a griefing attack: the attacker does not steal anything but causes trouble.

What is Business logic?

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.

More by kenzo

View all

53 more disclosed reports, best first.

More from Sandclock contest

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.