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

Old router retains unlimited approval when setRouter() is implemented

Summary

When setRouter() function is implemented to allow updating the router in the StrategyMainnet contract, the old router retains its unlimited token approval. This oversight can lead to significant risks if the old router is later compromised or misused, as it retains the ability to transfer all approved tokens (underlying) from the strategy.

Vulnerability Details

When changing the router using setRouter(), the old router’s token approval is not reset to zero. This creates a residual risk as the old router retains access to the strategy’s funds indefinitely.

Impact

If old Router is exploited, all approved underlying tokens could be drained from the strategy.

Tools Used

manual

Recommendations

Ensure the setRouter() function revokes the approval of the old router before setting a new one.

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

Appeal created

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

Old router approval is not revoked after an update

inallhonesty Lead Judge 10 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.