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

Unsafe Router Approval Management in setRouter Function Allowing Multiple Routers To Spend Starategy's Tokens

Summary

The setRouter function in both StrategyOp and StrategyArb contracts approves the new router without first revoking approval from the old router address, creating a potential security risk where multiple routers maintain approval to spend the strategy's tokens.

Vulnerability Details

When updating the router address, the contracts grant unlimited approval to the new router without first revoking approval from the previous router.
This can be seen in StrategyArb::setRouter

function setRouter(address _router) external onlyManagement {
router = _router;
underlying.safeApprove(router, type(uint256).max); // Approves new without revoking old
}

And StarategyOp::setRouter

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

This means that when the router is updated:

  1. The old router retains its unlimited approval

  2. The new router gets unlimited approval

  3. This accumulates with each router change

Impact

  • Multiple router contracts maintain simultaneous unlimited approval to spend the strategy's underlying tokens

  • If a previous router becomes compromised, it could still drain funds from the strategy

  • Each router change increases the attack surface by adding another approved spender

  • Malicious or compromised previous routers could front-run or manipulate transactions

Tools Used

  • Manual review

Recommendations

Implement proper approval management by revoking approval from the old router before approving the new one:

function setRouter(address _router) external onlyManagement {
// revoke approval from old router
underlying.safeApprove(_router, 0);
// update router address
router = _router;
// approve new router
underlying.safeApprove(router, type(uint256).max);
}

This ensures that only the current router has approval at any given time, significantly reducing the security risk surface.

Updates

Appeal created

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

Old router approval is not revoked after an update

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