When updating the router through the setRouter function, approvals to the old router are not revoked. This means that previous routers maintain their authorization to spend the contract's tokens even after being replaced.
The setRouter function in StrategyOp.sol updates the router address and approves the new router without revoking the approval from the previous router:
If a previous router becomes compromised or has vulnerabilities, it maintains the authorization to spend an unlimited amount of underlying tokens (WETH) from the contract, even after being replaced. This could lead to the loss of all contract funds. The vulnerability is present in all three contracts (StrategyOp.sol, StrategyMainnet.sol, and StrategyArb.sol)
It is particularly critical given the use of infinite approvals (type(uint256).max)
Manual code review
Static analysis
Proof of Concept
Contract is deployed with Router A which receives approval for type(uint256).max
Management upgrades to Router B via setRouter
Router B receives approval for type(uint256).max
Router A still maintains approval for type(uint256).max
If Router A is compromised, it can spend all underlying tokens of the contract
Implement approval revocation as shown above
Add events to track router changes
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.