#46643 [SC-Low] `destroyAgent` in `AgentsCreateDestroy` is prone to DOS
Description
Brief/Intro
Vulnerability Details
function destroyAgent(
address _agentVault,
address payable _recipient
)
internal
onlyAgentVaultOwner(_agentVault)
{
AssetManagerState.State storage state = AssetManagerState.get();
Agent.State storage agent = Agent.get(_agentVault);
// destroy must have been announced enough time before
require(agent.status == Agent.Status.DESTROYING, "destroy not announced");
require(block.timestamp > agent.destroyAllowedAt, "destroy: not allowed yet");
// cannot have any minting when in destroying status
assert(agent.totalBackedAMG() == 0);
// destroy pool
agent.collateralPool.destroy(_recipient);
// destroy agent vault
IIAgentVault(_agentVault).destroy(_recipient);
// remove from the list of all agents
uint256 ind = agent.allAgentsPos;
if (ind + 1 < state.allAgents.length) {
state.allAgents[ind] = state.allAgents[state.allAgents.length - 1];
Agent.State storage movedAgent = Agent.get(state.allAgents[ind]);
movedAgent.allAgentsPos = uint32(ind);
}
state.allAgents.pop();
// delete agent data
AgentSettingsUpdater.clearPendingUpdates(agent);
Agent.deleteStorage(agent);
// notify
emit IAssetManagerEvents.AgentDestroyed(_agentVault);
}Impact Details
References
Proof of Concept
Proof of Concept
Previous#46592 [SC-High] The return value of redeemFromAgent/redeemFromAgentInCollateral in the selfCloseExitTo is not checkedNext#46677 [SC-Insight] Wrong comment in _getFAssetRequiredToNotSpoilCR
Was this helpful?