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

Approval of Router Not Revoked When the Router Is Changed

Summary

When the router is updated to a new address, existing underlying token approvals for the previous router are not revoked. This can potentially lead to security issues, as the old router retains the ability to transfer tokens, even though it is no longer in active use.

Vulnerability Details

When the strategy contract is deployed a router is set and approved to spend type(uint).max (all) of the strategy's underlying token.
The vulnerability arises from the contract’s failure to remove approvals for a previous router when the router is replaced with a new one. Hence underlying token approvals granted to the old router persist indefinitely leaving room for misuse, especially if the old router is compromised or malicious.

function setRouter(address _router) external onlyManagement {
//@audit -- The approval of the former router is not removed when a new one is set
router = _router;
underlying.safeApprove(router, type(uint256).max);
}

Impact

The vulnerability can result in unauthorized access to users’ tokens. This could lead to a loss of users funds if the old router is exploited since the old router still has approval to transfer the strategies funds.

Tools Used

Manual Review

Recommendations

Implement logic to revoke existing token approvals for the old router when updating to 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.