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

Hanging approvals on old router contracts can lead to the loss of funds if routers are compromised.

Summary

The StrategyOp and StrategyArb contracts enable the owner to change the router contract by calling the setRouter function.

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

The new router will be granted maximum approval for future swaps, but the old router will retain its maximum approval, either through a previous call to setRouter or during initialization if it was the first router set. If an external router is compromised, the owner can switch to a new router. However, because the old router will still have approval, there is a risk of losing underlying token funds if some tokens remain in the contract.

/**
* @dev Initializes the strategy with the router address & approves WETH to be swapped via router
*/
function _initStrategy() internal {
router = 0xAAA87963EFeB6f7E0a2711F397663105Acb1805e;
@=> underlying.safeApprove(address(router), type(uint256).max);
}

Impact

This will be categorized as low impact because:

  1. The router must be exploitable for max approval, which is unlikely for leading industry protocols today, although it's not as uncommon as in the case of Merlin DEX: Merlin DEX Rekt.

  2. Even if the router is compromised, the strategy is not expected to directly hold underlying tokens, as they should be swapped for alETH tokens. However, any underlying tokens held, such as through donations, would be at risk.

Tools Used

Manual review.

Recommendations

Remove previous maximum approvals for old routers when setting a new router inside StrategyOp and StrategyArb.

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.