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

Protocol funds can be compromised due to not removing router approval

Summary

Protocol funds can be compromised due to not revoking the previous router's approval when setting a new one.

Vulnerability Details

In the constructors of StrategyOp.sol and StrategyArb.sol, the strategy is initialized and an approval to the router is set to type(uint256).max.

function _initStrategy() internal {
router = 0xa062aE8A9c5e11aaA026fc2670B0D65cCc8B2858;
underlying.safeApprove(address(router), type(uint256).max);
}

If the admins decide to set a new router, a max approval is once again made to the new router, but the previous one is not revoked.

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

This can be problematic. In a worst case scenario where the router is compromised due to a vulnerability, or anything really, the Alchemix contract's funds will be at risk since the approval to the compromised router cannot be revoked, even if a new router is set. Furthermore, the Alchemix contracts cannot be paused, and the emergency withdraw func is currently commented out on both StrategyArb.sol and StrategyOp.sol

Impact

If the initial router is compromised, the Alchemix contract's max approval will remain and the funds can be at risk. I believe the likelihood is low, but the impact can be critical, hence, medium severity.

Tools Used

Manual Review

Recommendations

Revoke previous router's approval when setting a new one. Also adding pausability to the contract will be helpful for such cases.

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.