Part 2

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

Redeem should not be executable if the creditCapacity is less than 0

Summary

Currently, users can redeem from a vault even when its credit capacity is below zero. This can lead to an uncontrolled increase in debt, reducing the vault’s available credit and causing potential insolvency issues.

Vulnerability Details

In the current implementation of redeem, there is no check to prevent redemption when totalCreditCapacity is zero or negative. This means:

  1. A user can still withdraw assets from a vault even when it has no credit capacity left.

  2. Each redemption reduces the creditCapacity, causing it to go negative.

  3. If this continues, the system's debt will increase while the vault’s available credit remains lower than expected.

Impact

  • Negative credit capacity – The vault can end up with a debt larger than its available credit.

  • Potential insolvency risk – If multiple users exploit this issue, the vault may no longer be able to honor redemptions.

  • Misleading liquidity assumption – The system might assume that a vault has available credit, when in reality, it does not.

Tools Used

  • Manual review

Recommendations

To prevent users from redeeming when the vault is out of credit, add a pre-check before allowing redemption.

Suggested Fix

Modify the redeem function to verify totalCreditCapacity before proceeding:

if (vault.getTotalCreditCapacityUsd() <= 0) {
revert Errors.InsufficientCreditCapacity();
}

Placing this check at the beginning of the function ensures that redemptions only occur when the vault has sufficient credit capacity.

Updates

Lead Judging Commences

inallhonesty Lead Judge
5 months ago
inallhonesty Lead Judge 4 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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