Skip to content
Business logic Audit finding Intermediate

Controller: Strategy migration will fail

The controller's strategy migration calls a withdraw function that the strategy may have blacklisted, causing the migration to revert. An attacker cannot directly exploit this, but it prevents the protocol from migrating strategies.

hickuphh3 Follow

Originally disclosed on Code4rena

Submitted by hickuphh3, also found by rayn

Controller.sol#L95 StrategyPUSDConvex.sol#L266

The controller calls the withdraw() method to withdraw JPEGs from the contract, but the strategy might blacklist the JPEG asset, which is what the PUSDConvex strategy has done.

The migration would therefore revert.

Proof of Concept

Insert this test into StrategyPUSDConvex.ts.

it.only("will revert when attempting to migrate strategy", async () => {
  await controller.setVault(want.address, yVault.address);
  await expect(controller.setStrategy(want.address, strategy.address)).to.be.revertedWith("jpeg");
});

Recommended Mitigation Steps

Replace _current.withdraw(address(jpeg)); with _current.withdrawJPEG(vaults[_token]).

spaghettieth (JPEG’d) confirmed and commented:

The proposed migration steps would modify the intended behaviour, which is to withdraw JPEG to the controller and not the vault. A correct solution would be replacing _current.withdraw(address(jpeg)) with _current.withdrawJPEG(address(this)).

spaghettieth (JPEG’d) resolved and commented:

Fixed in jpegd/core#6.


The original report as published on Code4rena, by hickuphh3. 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

Impact

Strategy migration would fail, preventing the protocol from switching strategies.

What the attacker needed

Strategy has blacklisted JPEG token

The fix

The controller should call a dedicated withdrawJPEG function that sends the JPEG to the controller instead of using the generic withdraw.

How it was found

  1. Set the vault for the want token to the yVault address.
  2. Attempt to set the strategy to the new strategy address.
  3. The transaction reverts with the message 'jpeg'.

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 smart contract strategy is like a plugin that manages funds. The controller tries to move funds from one strategy to another, but the old strategy has blocked a certain token (JPEG), so the move fails. This is a bug because the migration should work even if the token is blocked.

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 hickuphh3

View all

43 more disclosed reports, best first.

More from JPEG'd 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.