DeFiFoundrySolidity
16,653 OP
View results
Submission Details
Severity: low
Valid

Lack of Approval Revocation for Old Router When Updating Router

Summary

The setRouter function in the StrategyOp and StrategyArb contract does not revoke the approval of the old router for the underlying token (WETH). This creates a potential vulnerability where a previously approved router, if compromised or malicious, could drain all WETH from the strategy.

Vulnerability Details

In the setRouter function, the strategy updates the router address and grants approval to the new router:

function setRouter(address _router) external onlyManagement {
router = _router;
underlying.safeApprove(router, type(uint256).max);
}

However, there is no logic to revoke the approval of the old router. As a result, the old router retains unlimited approval to spend WETH from the strategy's balance. If the old router becomes compromised or behaves maliciously, it could exploit this unlimited approval to drain the WETH held by the strategy.

Impact

If a previously used router contract is compromised or intentionally malicious, it can drain all WETH from the strategy, leading to a significant loss of funds. This could result in irrecoverable financial damage to the protocol and its users.

Tools Used

Manual Review

Recommendations

To mitigate this vulnerability, revoke the approval of the old router before updating the router address. Modify the setRouter function as follows:

function setRouter(address _router) external onlyManagement {
// Revoke approval for the old router
underlying.safeApprove(router, 0);
// Update to the new router and grant approval
router = _router;
underlying.safeApprove(router, type(uint256).max);
}
Updates

Appeal created

inallhonesty Lead Judge 6 months ago
Submission Judgement Published
Validated
Assigned finding tags:

Old router approval is not revoked after an update

inallhonesty Lead Judge 6 months ago
Submission Judgement Published
Validated
Assigned finding tags:

Old router approval is not revoked after an update

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.