A vulnerability exists in the OperatorVCS.sol contract of the stake.link platform, specifically within the removeVault function. This function lacks proper access control mechanisms, allowing any address to invoke it. Consequently, unauthorized users can remove vaults without proper authorization, potentially disrupting the staking ecosystem and compromising user funds.
removeVaultExplanation:
Access Control Lacking: The removeVault function is marked as public without any access control modifiers such as onlyOwner. This omission allows any address to call the function.
Functionality Impact: Once a vault is queued for removal via the queueVaultRemoval function, any user can execute removeVault to permanently remove the vault from the system. This action adjusts the totalDeposits and totalPrincipalDeposits, potentially affecting the staking pool's integrity and the distribution of rewards.
queueVaultRemovalExplanation:
Access Control Lacking: Similar to removeVault, the queueVaultRemoval function lacks access control modifiers, enabling any address to queue a vault for removal, provided the vault is already marked as removed.
Functionality Impact: Unauthorized users can queue any eligible vault for removal, which they can subsequently remove without authorization, leading to potential exploitation of the staking system.
Explanation:
vm.prank(attacker): Simulates the action of the attacker by impersonating their address.
queueVaultRemoval(0): The attacker queues the first vault in the vaults array for removal.
Explanation:
removeVault(0): The attacker invokes the removeVault function to execute the removal of the previously queued vault.
Outcome: The vault is removed from the vaults array, and associated deposits and rewards are adjusted accordingly, potentially leading to financial discrepancies and operational disruptions.
Financial Loss: Unauthorized removal of vaults can lead to the loss of staked funds and accrued rewards, directly impacting users' investments and trust in the platform.
Operational Disruption: The removal of vaults can disrupt the staking ecosystem, affecting reward distribution mechanisms and overall platform stability.
Erosion of Trust: Exploitation of this vulnerability undermines user confidence in the security and reliability of the stake.link platform, potentially deterring future participation.
Manual Review
Implement Access Control on Critical Functions:
Restrict removeVault:
Explanation: Adding the onlyOwner modifier ensures that only the contract owner can invoke the removeVault function, preventing unauthorized removals.
Restrict queueVaultRemoval:
Explanation: Similarly, restricting queueVaultRemoval ensures that only authorized entities can queue vaults for removal, maintaining the integrity of the removal process.
Enhance Access Control Mechanisms:
Use Role-Based Access Control (RBAC): Implementing RBAC allows for more granular permission settings, enabling different levels of access for various functions based on roles.
Explanation: By defining roles such as REMOVAL_ROLE, the contract can delegate specific permissions to designated addresses, enhancing security.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.