Part 2

Zaros
PerpetualsDEXFoundrySolidity
70,000 USDC
View results
Submission Details
Severity: medium
Invalid

`claimFees()` function bypasses vault liveness check

Summary

In the current implementation, the Vault.update() function allows the isLive flag of a vault to be set to false, effectively marking it as inactive. However, the claimFees() function in FeeDistributionBranch contract does not check whether the vault is live before allowing users to claim their fees. This oversight can lead to significant risks and inconsistencies within the protocol.

Vulnerability Details

function update(UpdateParams memory params) internal {
Data storage self = load(params.vaultId);
--SNIP--
>> self.isLive = params.isLive;
--SNIP--
}

When set to false, it indicates that the vault is no longer active and should not process any transactions or claims.

function claimFees(uint128 vaultId) external {
// load the vault data storage pointer
// @audit-info Does not check if vault is live
>> Vault.Data storage vault = Vault.load(vaultId);
---SNIP---
// transfer the amount to the claimer
>> IERC20(weth).safeTransfer(msg.sender, amountToClaim);
---SNIP---
}

However, it does not verify if the vault is still active (i.e., if isLive is true).

Impact

  • Users may be able to claim fees from a vault that has been marked as inactive. This could result in users receiving funds from a vault that is no longer operational, undermining the intended functionality of the isLive flag.

  • Allowing claims from inactive vaults could lead to financial discrepancies within the protocol. For example, if a vault is inactive due to a security issue or maintenance, allowing fee claims could exacerbate the situation and lead to further complications.

Tools Used

Manual Review

Recommendations

function claimFees(uint128 vaultId) external {
// load the vault data storage pointer
// @audit Check if the vault is live
- Vault.Data storage vault = Vault.load(vaultId);
+ Vault.Data storage vault = Vault.loadLive(vaultId);
---SNIP---
// transfer the amount to the claimer
IERC20(weth).safeTransfer(msg.sender, amountToClaim);
---SNIP---
}
Updates

Lead Judging Commences

inallhonesty Lead Judge
5 months ago
inallhonesty Lead Judge 4 months ago
Submission Judgement Published
Invalidated
Reason: Design choice

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.