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

Token approvals should be cleared when adding a new router

Summary

When admin wants to add a new router to the contract it gives an approval for a token. In that case any previous approvals should be deleted.

Vulnerability Details

In StrategyArb and StrategyOp contracts an admin can add a new router at any time by calling setRouter:

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

In the same time that contract gives an ultimate approval for underlying token for a new router.

There may only be one router in the contract, as it rewrites the state variable when it is updated. So any time a new router is set up, the token approvals for the previous router should be deleted.

Impact

Unexpected consequences for the router that is not used with unlimited token appovals.

Tools Used

Manual review.

Recommendations

Clear approvals for the previous router when adding a new one.

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.