Summary
The setRouter and addRoute functions in the contract accept external inputs without proper validation or safeguards. This oversight permits malicious or erroneous configurations that can halt the strategy's operations. A misconfigured or malicious router can prevent essential functions like claimAndSwap, leading to operational halts, financial discrepancies, and user trust erosion.
Technical Details
The setRouter function allows the Manager to set any address as the router without validation. If the router contract reverts during operations (e.g., token transfers), the strategy becomes inoperative. Similarly, the addRoute function can accept invalid or malicious routes, compounding the risk of operational disruptions.
Router Misconfiguration: Setting a router to a malicious or broken contract halts core operations like claimAndSwap.
Trust Erosion: Users unable to realize yields or withdraw funds lose confidence in the protocol.
Financial Discrepancies: Failed operations disrupt fund accounting and yield distributions.
Attack Scenarios
Setup: A malicious Manager sets the router to a contract that reverts on swapExactTokensForTokens calls.
Execution: Any subsequent calls to claimAndSwap fail, as the router cannot execute swaps.
Impact: The strategy halts, preventing yield generation and affecting user withdrawals.
Setup: A malicious or compromised Manager uses addRoute to introduce a route with invalid or malicious parameters.
Execution: When the invalid route is used during swaps, transactions fail or misdirect funds.
Impact: Users experience failed transactions, financial losses, or reduced yields.
Setup: A router is set that contains gas-heavy operations, causing transactions to exceed block gas limits.
Execution: Any interaction with the router fails due to excessive gas consumption.
Impact: The strategy becomes unusable, and users are unable to withdraw or manage their funds.
impact
Operational Risk: Halting critical functions like claimAndSwap disrupts yield generation and fund management.
Financial Risk: Users may experience reduced yields or losses due to operational failures.
Reputational Risk: The protocol's integrity is undermined, resulting in user attrition and negative market perception.
Recommendations
Maintain a whitelist of approved router addresses.
Enforce validation to ensure the new router address matches a pre-approved entry:
Protect critical functions like setRouter and addRoute with multi-signature authentication, reducing the risk of unilateral malicious changes.
Apply a delay between proposing a new router and its activation to allow for review and rollback if malicious intent is detected.
Proof of Concept (PoC)
Deploy the StrategyOp contract.
Call setRouter with a contract that always reverts on token transfers.
Attempt to execute claimAndSwap.
Observe the failure due to the router’s reversion.
Implement router whitelisting and validation.
Retry the attack with the malicious router.
Observe the transaction revert with a validation error, preventing the router change.
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.