#46092 [SC-Insight] AgentVault::destroy mismatch between comment documentation and contract behavior
Description
Brief/Intro
Vulnerability Details
// Used by asset manager when destroying agent.
// Completely erases agent vault and transfers all funds to the owner.@> function destroy(address payable _recipient)
external override
onlyAssetManager
nonReentrant
{
uint256 length = usedTokens.length;
for (uint256 i = 0; i < length; i++) {
IERC20 token = usedTokens[i];
uint256 useFlags = tokenUseFlags[token];
//... snippet; undelegation logic...
if ((useFlags & TOKEN_DEPOSIT) != 0) {
uint256 balance = token.balanceOf(address(this));
if (balance > 0) {
@> token.safeTransfer(_recipient, balance);
}
}
}
// transfer native balance, if any (used to be done by selfdestruct)
@> Transfers.transferNAT(_recipient, address(this).balance);
}Impact Details
References
Proof of Concept
Proof of Concept
Previous#46071 [SC-Low] Ultra-low amount of total shares in collateral poolNext#46108 [SC-Medium] Minting Cap can by bypassed while self minting
Was this helpful?