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

Possible Drainage After Changing Routers

Summary

When creating a strategy in the constructor of StrategyArb and StrategyOp a router address is set when a call to _initStrategy is made. The router is given an infinite approval for the underlying token. The router then can be changed by the management role in the setRouter function. However, the problem is that the approval for the old router is not reset. This can cause serious issues if the previous router was found to be vulnerable.

Vulnerability Details

https://github.com/Cyfrin/2024-12-alchemix/blob/82798f4891e41959eef866bd1d4cb44fc1e26439/src/StrategyArb.sol#L42-L45

https://github.com/Cyfrin/2024-12-alchemix/blob/82798f4891e41959eef866bd1d4cb44fc1e26439/src/StrategyOp.sol#L48-L51

The setRouter function does not reset the approval of the old router giving it a possibility for malicious action.

constructor(
address _asset,
address _transmuter,
string memory _name
) BaseStrategy(_asset, _name) {
transmuter = ITransmuter(_transmuter);
require(transmuter.syntheticToken() == _asset, "Asset does not match transmuter synthetic token");
underlying = ERC20(transmuter.underlyingToken());
asset.safeApprove(address(transmuter), type(uint256).max);
_initStrategy();
}
/**
* @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);
}
function setRouter(address _router) external onlyManagement {
router = _router;
underlying.safeApprove(router, type(uint256).max);
}

Impact

A possible impact is full drainage of the given contracts.

Tools Used

Manual Review

Recommendations

Reset the approval of the old router when a new one is set.

Updates

Appeal created

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

Old router approval is not revoked after an update

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