Skip to content
Business logic Audit finding Intermediate

SingleStrategyController doesn’t verify that new strategy uses the same base token

The SingleStrategyController's migrate function does not check that the new strategy uses the same base token as the old one. If the owner accidentally migrates to a strategy with a different base token, the transferred funds become stuck and effectively lost.

Ruhum Follow

Originally disclosed on Code4rena

Submitted by Ruhum

When migrating from one strategy to another, the controller pulls out the funds of the old strategy and deposits them into the new one. But, it doesn’t verify that both strategies use the same base token. If the new one uses a different base token, it won’t “know” about the tokens it received on migration. It won’t be able to deposit and transfer them. Effectively they would be lost.

The migration is done by the owner. So the owner must make a mistake and migrate to the wrong strategy by accident. In a basic protocol with 1 controller and a single active strategy managing that should be straightforward. There shouldn’t be a real risk of that mistake happening. But, if you have multiple controllers running at the same time each with a different base token, it gets increasingly likelier.

According to the IStrategy interface, there is a function to retrieve the strategy’s base token: getBaseToken(). I’d recommend adding a check in the migrate() function to verify that the new strategy uses the correct base token to prevent this issue from being possible.

Proof of Concept

SingleStrategyController.sol#L51-L72

IStrategy.sol#L52

Recommended Mitigation Steps

Add require(_baseToken == _newStrategy.getBaseToken()); to the beginning of migrate().

ramenforbreakfast (prePO) confirmed and commented:

Valid claim, in addition to H-02, illustrates why we should probably not have a fixed migration function due to the complexity of such an operation.

gzeon (judge) commented:

Agree with sponsor.


The original report as published on Code4rena, by Ruhum. 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 migrate function lacks a check that the new strategy's base token matches the controller's base token.

Impact

If the owner mistakenly migrates to a strategy with a different base token, the funds could be permanently lost; the report notes this requires owner error and is more likely with multiple controllers.

What the attacker needed

Owner migrates to wrong strategy; new strategy uses different base token

The fix

Add a check in migrate() to verify that the new strategy's base token matches the expected base token.

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 controller moves funds from an old strategy to a new one during migration. It fails to check that both strategies handle the same type of token. If the owner picks a wrong strategy, the funds are sent to a contract that cannot use them, so they are lost.

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 Ruhum

View all

55 more disclosed reports, best first.

More from prePO 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.