The Visor._removeNft iterates over all nfts.
Anyone can add to this array by depositing NFTs, see Visor.onERC721Received.
Other occurences that makes an unbounded iteration over arrays:
Visor.getBalanceLocked
Visor.getNftIdByTokenIdAndAddr
HyperVisor.isValidVault
HyperVisor.calculateTotalStakeUnits
Impact
The transactions can fail if the arrays get to big and the transaction would consume more gas than the block limit.
This will then result in a denial of service for the desired functionality and break core functionality.
Recommended Mitigation Steps
Keep the arrays small by setting a max size or make it possible to process the arrays in chunks in several transactions if possible.
Handle
cmichel
Vulnerability details
Vulnerability Details
The
Visor._removeNft
iterates over allnfts
. Anyone can add to this array by depositing NFTs, seeVisor.onERC721Received
.Other occurences that makes an unbounded iteration over arrays:
Visor.getBalanceLocked
Visor.getNftIdByTokenIdAndAddr
HyperVisor.isValidVault
HyperVisor.calculateTotalStakeUnits
Impact
The transactions can fail if the arrays get to big and the transaction would consume more gas than the block limit. This will then result in a denial of service for the desired functionality and break core functionality.
Recommended Mitigation Steps
Keep the arrays small by setting a max size or make it possible to process the arrays in chunks in several transactions if possible.