DeFiFoundrySolidity
16,653 OP
View results
Submission Details
Severity: medium
Invalid

Lack of Implementation of Emergency Withdrawal Functionality

Description

The StrategyOp contract inherits from BaseStrategy, which includes an optional _emergencyWithdraw function intended for situations where the strategy needs to quickly withdraw funds from the yield source. This function is currently commented out and not implemented in the StrategyOp contract.

/**
* @dev Optional function for a strategist to override that will
* allow management to manually withdraw deployed funds from the
* yield source if a strategy is shutdown.
*
* @param _amount The amount of asset to attempt to free.
*
function _emergencyWithdraw(uint256 _amount) internal override {
TODO: If desired implement simple logic to free deployed funds.
EX:
_amount = min(_amount, aToken.balanceOf(address(this)));
_freeFunds(_amount);
}
*/

By not implementing this function, the strategy lacks the ability to rapidly withdraw funds in case of emergencies, such as a vulnerability in the transmuter contract or other unforeseen issues.

Impact

  • Inability to Respond to Emergencies: Without an emergency withdrawal mechanism, the strategy cannot promptly react to critical situations that require immediate action.

  • Potential Loss of Funds: Funds may become irrecoverable or suffer losses if the strategy cannot exit positions quickly.

  • Operational Risk: The strategy exposes itself and its users to higher risk during times of instability or security threats.

Proof of Concept (PoC)

  1. Scenario:

    • A critical vulnerability is discovered in the transmuter contract.

    • Immediate withdrawal of funds is necessary to prevent loss.

  2. Effect:

    • The strategy lacks an implemented _emergencyWithdraw function.

    • Management cannot withdraw funds from the transmuter promptly.

  3. Consequence:

    • Funds remain locked in the vulnerable contract.

    • Potential loss of funds or inability to prevent exploitation.

Recommendations

  • Implement Emergency Withdrawal Functionality:
    Provide a robust implementation of the _emergencyWithdraw function to enable management to withdraw funds rapidly when necessary.

    function _emergencyWithdraw(uint256 _amount) internal override {
    uint256 totalAvailable = transmuter.getUnexchangedBalance(address(this));
    uint256 amountToWithdraw = _amount > totalAvailable ? totalAvailable : _amount;
    if (amountToWithdraw > 0) {
    transmuter.withdraw(amountToWithdraw, address(this));
    }
    }
Updates

Appeal created

inallhonesty Lead Judge 8 months ago
Submission Judgement Published
Invalidated
Reason: Design choice

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.