Skip to content
Business logic Audit finding Intermediate

`COLLATERAL_THRESHOLD` should be set to `125%` instead of `120%`

The bond token redemption price is discontinuous at the 120% collateral threshold, jumping from at most 96 to 100. A small increase in total value locked can therefore cause a sudden loss for leverage token holders.

KupiaSec Follow with makeWeb3safe, werulez99 and 1 other

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2024-12-plaza-finance-judging/issues/895

This issue has been acknowledged by the team but won't be fixed at this time.

Found by

KupiaSec, makeWeb3safe, werulez99, zraxx

Summary

The price of BondToken depends on whether the collateralLevel is above or below 120%.

  • If collateralLevel <= 120%:

    80% of TVL is allocated for BondToken, so the price of BondToken is less than 120 * 80% = 96.

  • If collateralLevel > 120%:

    The price of BondToken is set to 100.

As you can see, when the collateralLevel moves from below to above 120%, the price of BondToken changes from <= 96 to 100, indicating that the price curve is not continuous.

To ensure continuity, 125% should be used instead of 120%.

Root Cause

The getRedeemAmount() function calculates the redeemRate based on whether the collateralLevel is above or below 120%.

  • If collateralLevel <= 120%:

    Solidity
      redeemRate = (tvl * multiplier) / assetSupply
    

    Here, multiplier is 80%, and assetSupply is the total supply of BondToken. Since the collateralLevel is less than 120%, the redeemRate will be less than 120 * 80% = 96.

  • If collateralLevel > 120%:

    Solidity
      redeemRate = 100
    

As observed, when the collateralLevel moves from below to above 120%, the redeemRate is not continuous, moves from 96 to 100 suddenly.

This means that when the collateralLevel is around 120%, a minor increase in TVL can lead to a significant price increase of BondToken, resulting in substantial losses for LeverageToken holders, even as the TVL increases.

Solidity
      function getRedeemAmount(
        ...
        
        uint256 redeemRate;
511     if (collateralLevel <= COLLATERAL_THRESHOLD) {
          redeemRate = ((tvl * multiplier) / assetSupply);
        } else if (tokenType == TokenType.LEVERAGE) {
          redeemRate = ((tvl - (bondSupply * BOND_TARGET_PRICE)) / assetSupply) * PRECISION;
515     } else {
          redeemRate = BOND_TARGET_PRICE * PRECISION;
        }
        
        // Calculate and return the final redeem amount
        return ((depositAmount * redeemRate).fromBaseUnit(oracleDecimals) / ethPrice) / PRECISION;
      }

Internal pre-conditions

External pre-conditions

Attack Path

Let's consider the following scenario:

  1. Current State of the Pool:
    • TVL: 1190
    • bondSupply: 10
    • collaterlLevel: 119%
    • TVL for BondToken: 1190 * 0.8 = 952
    • TVL for LeverageToken: 1190 * 0.2 = 238
  2. Price of Underlying Rises:
    • TVL: 1210 (due to price increase)
    • bondSupply: 10
    • collaterlLevel: 121%
    • TVL for BondToken: 100 * 10 = 1000
    • TVL for LeverageToken: 1210 - 100 = 210

As you can see, LeverageToken holders incur a loss of 238 - 210 = 28, even though the underlying price has increased.

Impact

Even though the price of the underlying increases, LeverageToken holders incur a loss.

PoC

Mitigation

For COLLATERAL_THRESHOLD, use 125% instead of 120%.

The original report as published on Sherlock, by KupiaSec. Images and videos are our own copies; raw HTML is shown as text. View it on Sherlock.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the collateral threshold is set to 120% while the multiplier is 80%, so the two pricing formulas do not meet at the boundary.

Impact

Leverage token holders can incur a loss even when the underlying price increases.

What the attacker needed

Collateral level near 120%; underlying price increase

The fix

The collateral threshold should be set to 125% instead of 120%.

How it was found

  1. Set up a pool with total value locked of 1190, bond supply of 10, and collateral level of 119%.
  2. Increase the underlying price so total value locked becomes 1210 and collateral level becomes 121%.
  3. Observe that the value allocated to leverage tokens drops from 238 to 210, a loss of 28.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

A bond token's redemption value is calculated differently depending on whether the pool's collateral is above or below a set percentage. At the 120% boundary, the value jumps sharply, so a tiny change in the pool's total value can suddenly reduce what leverage token holders can redeem.

What is Business logic?

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.

More by KupiaSec

View all

28 more disclosed reports, best first.

More from Plaza Finance

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.