Summary
The StrategyOp contract has a critical over sight where token approvals for the old router are not revoked when a new router is set using the setRouter function. The oversight allows the old router to retain unlimited access to the strategy’s tokens (underlying), even after a new router is configured. If the old router is compromised or malicious, this can lead to unauthorized transfers or fund drains. Which can be common case by using couple routers by time.
revoking approvals for the previous router is a must before setting a new one and adopting safer approval patterns to minimize exposure.
Technical Details
The setRouter function updates the router address and grants unlimited approval to the new router but does not revoke approvals for the old router:
During initialization, the contract approves unlimited tokens (underlying) to the router for swaps:
If the setRouter function is later called, a new router is approved without resetting or revoking the approval for the old router.
This leaves both the old and new routers with unlimited access to the strategy’s tokens.
Exploitation Scenarios
Initial Setup: The router is set to Router A with unlimited approval.
Router Update: The Manager updates the router to Router B using setRouter. Router A still retains approval.
Attack: A malicious actor exploits Router A to drain the strategy’s tokens:
Result: The attacker drains all tokens (underlying) via the old router, resulting in a complete asset loss.
Both Router A (old) and Router B (new) have unlimited approvals.
Unmonitored or accidental function calls to Router A result in unauthorized swaps or transfers.
Result: Tokens are unintentionally misused, reducing user funds and disrupting operations.
Proof of Concept (PoC)
Reproduction:
Deploy the contract and initialize the router using _initStrategy.
Update the router using setRouter but without revoking the old router’s approval.
Simulate an attacker exploiting the old router to transfer tokens:
Observe the unauthorized transfer of tokens via the old router.
Financial Impact:
The old router’s access to tokens enables complete fund drains or misuse.
Example: If the strategy holds 15,000 WETH (~$30M at $2,000/WETH), a compromised router can transfer the entire balance.
Reputational Impact:
Users lose trust in the protocol due to mismanagement of token approvals.
Operational Impact:
Fund drains disrupt strategy operations, requiring immediate intervention.
Root Cause Analysis
Approval Mismanagement:
The setRouter function updates the router address but does not revoke approvals for the previous router.
Unrestricted Approvals:
Approvals are set to type(uint256).max without constraints, allowing unlimited token transfers.
Mitigation Recommendations
Revoke approvals for the old router before granting approval to the new router:
Approve only the necessary token amount for specific transactions:
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.