///@notice withdraw multiple ERC721s
/// @param _assetAddresses the addresses of assets to be unlocked
/// @param _assetIDs the IDs of assets to be unlocked
/// @param _to the address where unlocked NFT will be sent
function withdrawMultipleERC721(address[] memory _assetAddresses, uint256[] memory _assetIDs, address _to) external override boughtOut {
require(msg.sender == bidder,"NibblVault: Only winner");
for (uint256 i = 0; i < _assetAddresses.length; i++) {
IERC721(_assetAddresses[i]).safeTransferFrom(address(this), _to, _assetIDs[i]);
}
}
Recommended Mitigation Steps
Implement check to ensure that _assetAddresses array and _assetIDs array are of the same length.
Lack of Re-entrancy Guard
Proof-of-Concept
When the safeTransferETH function is called, it is possible that the recipient can re-enter back to the function due to lack of re-entrancy guard.
Did not validate array length
Proof-of-Concept
The following function did not check if the
_assetAddresses
array and_assetIDs
array are of the same length.https://github.com/code-423n4/2022-06-nibbl/blob/8c3dbd6adf350f35c58b31723d42117765644110/contracts/NibblVault.sol#L504
Recommended Mitigation Steps
Implement check to ensure that
_assetAddresses
array and_assetIDs
array are of the same length.Lack of Re-entrancy Guard
Proof-of-Concept
When the
safeTransferETH
function is called, it is possible that the recipient can re-enter back to the function due to lack of re-entrancy guard.https://github.com/code-423n4/2022-06-nibbl/blob/8c3dbd6adf350f35c58b31723d42117765644110/contracts/NibblVault.sol#L398
https://github.com/code-423n4/2022-06-nibbl/blob/8c3dbd6adf350f35c58b31723d42117765644110/contracts/NibblVault.sol#L464
Recommended Mitigation Steps
Implement re-entrancy guard on the affected functions