Skip to content
This repository has been archived by the owner on Mar 3, 2024. It is now read-only.

0x70C9 - M - Vault doesn't get removed from _vaultsByType, thus it can never be added again #745

Closed
sherlock-admin2 opened this issue Aug 30, 2023 · 0 comments
Labels
Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label Medium A valid Medium severity issue Reward A payout will be made for this issue

Comments

@sherlock-admin2
Copy link
Contributor

sherlock-admin2 commented Aug 30, 2023

0x70C9

false

M - Vault doesn't get removed from _vaultsByType, thus it can never be added again

Summary

The removeVault function inside LMPVaultRegistry is encharged of removing a given vault address from the different lists and mappings. The other function from the pair is addVault, which in turn adds a given vault as long as it is not already there in the lists. There is an issue in removeFunction which makes it impossible for a removed vault to be added again.

Vulnerability Detail

Function removeVault forgets to remove the vault address from the set _vaultsByType[vaultType]. Therefore, if one tries to add a previously removed vault back to the registry, it will fail in the following code inside addVault:

if (!_vaultsByType[vaultType].add(vaultAddress)) revert VaultAlreadyExists(vaultAddress);

Impact

Vaults that were previously removed can never again be added to the registry.

Tool used

Manual Review

Recommendation

Add the vault address removal from the _vaultsByType[vaultType] set.

Duplicate of #674

@github-actions github-actions bot added Medium A valid Medium severity issue Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label labels Sep 11, 2023
@sherlock-admin sherlock-admin changed the title Zealous Marmalade Cobra - M - Vault doesn't get removed from _vaultsByType, thus it can never be added again 0x70C9 - M - Vault doesn't get removed from _vaultsByType, thus it can never be added again Oct 3, 2023
@sherlock-admin sherlock-admin added the Reward A payout will be made for this issue label Oct 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate A valid issue that is a duplicate of an issue with `Has Duplicates` label Medium A valid Medium severity issue Reward A payout will be made for this issue
Projects
None yet
Development

No branches or pull requests

2 participants