Skip to content
Business logic Audit finding Intermediate

Failed auction period still update `sharesPerToken` like it is succeed

A failed auction still records a non-zero sharesPerToken for the previous period, so bondETH holders can claim coupon shares for a period that produced no coupon. This lets early claimers drain the distributor, leaving later holders unable to claim.

056Security Follow with 0rpse, 0x23r0 and 31 others

Originally disclosed on Sherlock

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

Found by

056Security, 0rpse, 0x23r0, 0x52, 0xEkko, 0xShahilHussain, 0xadrii, 0xlucky, 0xmystery, Abhan1041, Adotsam, Aymen0909, ChainProof, Hueber, MysteryAuditor, Pablo, SamuelTroyDomi, Schnilch, ZoA, bladeee, bretzel, carlitox477, dobrevaleri, farismaulana, future, moray5554, novaman33, phn210, robertauditor, shui, silver_eth, sl1, y4y, zxriptor

Summary

The way bondETH holder get the coupon (USDC) is through the auction where protocol would auction amount of underlying asset for coupon to be later distributed to bondETH holder of current period. But the BondToken::increaseIndexedAssetPeriod would always push the default value of sharesPerToken to the previous period to globalPool.previousPoolAmounts array when new auction start, regardless if the previous auction is succeed or not.

Root Cause

When auction is succeed, the coupon collected would later be sent to pool, and then pool would distribute and allocate the amount into distribute contract, and if it fails no coupon is sent to the pool thus making no amount to distribute and allocated to distribute contract and any previous bid can be claimed.

Auction.sol#L336-L350:

Solidity
  function endAuction() external auctionExpired whenNotPaused {
    if (state != State.BIDDING) revert AuctionAlreadyEnded();

    if (currentCouponAmount < totalBuyCouponAmount) {
      state = State.FAILED_UNDERSOLD;
    } else if (totalSellReserveAmount >= (IERC20(sellReserveToken).balanceOf(pool) * poolSaleLimit) / 100) {
        state = State.FAILED_POOL_SALE_LIMIT;
    } else {
      state = State.SUCCEEDED;
      Pool(pool).transferReserveToAuction(totalSellReserveAmount);
      IERC20(buyCouponToken).safeTransfer(beneficiary, IERC20(buyCouponToken).balanceOf(address(this)));
    }

    emit AuctionEnded(state, totalSellReserveAmount, totalBuyCouponAmount);
  }

regardless, anyone can call Pool::startAuction to start new auction. and this is problematic because inside the function the bondToken.increaseIndexedAssetPeriod(sharesPerToken) is called.

Pool.sol#L530-L571

Solidity
  function startAuction() external whenNotPaused() {
.
.
.

    // Increase the bond token period
@>  bondToken.increaseIndexedAssetPeriod(sharesPerToken);
.
.
.
  }

when this function called, the previous failed auction data would then get pushed into the previousPoolAmounts array:

BondToken.sol#L217-L229

Solidity
  function increaseIndexedAssetPeriod(uint256 sharesPerToken) public onlyRole(DISTRIBUTOR_ROLE) whenNotPaused() {
    globalPool.previousPoolAmounts.push(
      PoolAmount({
        period: globalPool.currentPeriod,
        amount: totalSupply(),
@>      sharesPerToken: globalPool.sharesPerToken
      })
    );
    globalPool.currentPeriod++;
    globalPool.sharesPerToken = sharesPerToken;

    emit IncreasedAssetPeriod(globalPool.currentPeriod, sharesPerToken);
  }

the sharesPerToken of previous period is updated by using default value of globalPool.sharesPerToken (docs said it would be equal to 2.5 USD) even though there are no coupon get sent into distributor contract.

but nonetheless, the user can still claim the shares of 2 period even though there are no new coupon token inside the distributor contract. and the claim function would then have liquidity problem

Distributor.sol#L78-L110

Solidity
  function claim() external whenNotPaused nonReentrant {
    BondToken bondToken = Pool(pool).bondToken();
    address couponToken = Pool(pool).couponToken();

    if (address(bondToken) == address(0) || couponToken == address(0)){
      revert UnsupportedPool();
    }

    (uint256 currentPeriod,) = bondToken.globalPool();
    uint256 balance = bondToken.balanceOf(msg.sender);
@>  uint256 shares = bondToken.getIndexedUserAmount(msg.sender, balance, currentPeriod)
                              .normalizeAmount(bondToken.decimals(), IERC20(couponToken).safeDecimals());

    if (IERC20(couponToken).balanceOf(address(this)) < shares) {
      revert NotEnoughSharesBalance();
    }
   
    // check if pool has enough *allocated* shares to distribute
    if (couponAmountToDistribute < shares) {
      revert NotEnoughSharesToDistribute();
    }

    // check if the distributor has enough shares tokens as the amount to distribute
    if (IERC20(couponToken).balanceOf(address(this)) < couponAmountToDistribute) {
      revert NotEnoughSharesToDistribute();
    }

    couponAmountToDistribute -= shares;    
    bondToken.resetIndexedUserAssets(msg.sender);
    IERC20(couponToken).safeTransfer(msg.sender, shares);
    
    emit ClaimedShares(msg.sender, currentPeriod, shares);
  }

notice that shares would be increased by adding the failed auction sharePerToken amount

Internal Pre-conditions

No response

External Pre-conditions

No response

Attack Path

  1. auction 0 start -> end successfully and 50 USD coupon is sent to be claimed in distributor contract
  2. each holder can claim 2.5 USD per bondETH in this period
  3. auction 1 start -> end with undersold, no new usd coupon sent to distributor contract
  4. each holder can claim 2.5 + 2.5 USD per bondETH held in this period if they held for 2 period
  5. alice held since period 0, and have 10 bondETH. she can claim 10 * 5 = 50 USD
  6. bob held since period 0, and have 10 bondETH. he cant claim because distributor contract now have 0 USD

Impact

holder of bondETH token can not claim shares if they late. discrepancy in the can be claimed amount vs actual coupon token held inside distributor contract would make not enough coupon to be claimed for all bondETH holder

PoC

No response

Mitigation

when auction fails, consider to update the sharesPerToken for the failed period auction to 0.

Discussion

sherlock-admin2

The protocol team fixed this issue in the following PRs/commits: https://github.com/Convexity-Research/plaza-evm/pull/157

The original report as published on Sherlock, by 056Security. 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 increaseIndexedAssetPeriod function always pushes the current globalPool.sharesPerToken (a default value) into previousPoolAmounts when starting a new auction, even if the previous auction failed and no coupon was added.

Impact

BondETH holders who claim later may be unable to claim their shares because the distributor does not have enough coupon tokens to cover all claims.

What the attacker needed

A failed auction period; bondETH held across periods; claiming before others

The fix

The protocol team fixed this issue by updating the sharesPerToken for a failed auction period to zero.

How it was found

  1. Auction 0 starts and ends successfully, sending 50 USD coupon to the distributor.
  2. Each holder can claim 2.5 USD per bondETH for that period.
  3. Auction 1 starts and ends with undersold, so no new coupon is sent to the distributor.
  4. Each holder can claim 2.5 + 2.5 USD per bondETH if they held for both periods.
  5. Alice, who held 10 bondETH since period 0, claims 10 * 5 = 50 USD.
  6. Bob, who also held 10 bondETH since period 0, cannot claim because the distributor now has 0 USD.

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.

When an auction fails, no coupon (USDC) is added to the pool for that period. But the code still records a default share amount for that period, so users can claim shares that do not exist. The first people to claim get paid, and later people cannot claim because the distributor runs out of money.

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 056Security

View all

13 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.