Skip to content
Business logic Audit finding Intermediate

Calling the transferReserveToAuction will revert due to increase in currentPeriod

The auction contract stores its address under the current period, but then increments the period, so when the auction later calls transferReserveToAuction, the pool looks up the new period and finds no auction address, causing the call to revert. This prevents the auction from ending and the reserve tokens from being transferred.

056Security Follow with 0x23r0, 0x52 and 47 others

Originally disclosed on Sherlock

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

Found by

056Security, 0x23r0, 0x52, 0xAadi, 0xEkko, 0xPhantom2, 0xadrii, 0xc0ffEE, 0xrex, 4th05, Artur, Aymen0909, BADROBINX, ChainProof, Goran, Hueber, Kenn.eth, Kyosi, Mill, MysteryAuditor, POB, Pablo, Schnilch, Strapontin, Uddercover, Vidus, X0sauce, ZoA, alphacipher, bladeee, bretzel, carlitox477, dobrevaleri, elolpuer, elvin.a.block, evmboi32, farismaulana, i3arba, jimpixjed, jprod15, momentum, mxteem, novaman33, oxelmiguel, pashap9990, phoenixv110, rudhra1749, shiazinho, shui, shushu, silver_eth, sl1, stuart_the_minion, tinnohofficial, tusharr1411, tvdung94, wellbyt3, x0lohaclohell, y4y, zhenyazhd

Summary

The auction contract calls the transferReserveToAuction function to pull the reserve tokens.

However, an issue occur that will prevent the auction contract from calling the function.

Root Cause

During auction creation, the currentPeriod is used to store the auction address in the auctions mapping, however, the currentPeriod is then increased to another value, meaning when we quote the current period again, it will return 2 if it was 1 prior to the incraese

Solidity

  552:@>    auctions[currentPeriod] = Utils.deploy(
        address(new Auction()),
        abi.encodeWithSelector(
          Auction.initialize.selector,
          address(couponToken),
          address(reserveToken),
          couponAmountToDistribute,
          block.timestamp + auctionPeriod,
          1000,
          address(this),
          poolSaleLimit
        )
      );

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

Internal Pre-conditions

Can happen in normal operation.

External Pre-conditions

none

Attack Path

  1. User or anyone starts the auction and the auction address is stored in the auctions mapping
  2. After some time, the auction succeed and the transferReserveToAuction is called to transfer the reserve token to the auction contract.
  3. Since the currentPeriod has now increased , quoting the bondToken.globalPool() will return the increased value, meaning the mapping will return zero address because there's no address saved to it, so comparing it with the msg.sender will revert because the caller auctionaddress != address(0)

Impact

The call to the transferReserveToAuction will fail and ending the auction will not take place.

PoC

No response

Mitigation

This can be mitigated by subtracting 1 from the quoted currentPeriod in the transferReserveToAuction

Solidity
  function transferReserveToAuction(uint256 amount) external virtual {
       (uint256 currentPeriod, ) = bondToken.globalPool();
+     uint256  previousCurrentPeriod = currentPeriod - 1;
      address auctionAddress = auctions[previousCurrentPeriod ];
      require(msg.sender == auctionAddress, CallerIsNotAuction());
    
      IERC20(reserveToken).safeTransfer(msg.sender, amount);
  }

just like it happened in the distribute function.

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

Impact

The call to transferReserveToAuction will fail, so the auction cannot end and the reserve tokens are not transferred.

What the attacker needed

None

The fix

The issue was fixed by subtracting 1 from the current period when looking up the auction address in transferReserveToAuction, as was already done in the distribute function.

How it was found

  1. A user starts an auction, and the auction address is stored in the auctions mapping under the current period.
  2. After some time, the auction succeeds and calls transferReserveToAuction to transfer the reserve tokens.
  3. Because the current period has increased, the pool looks up the new period in the auctions mapping and gets the zero address.
  4. The check comparing the caller to the zero address fails, so the call reverts.

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 starts, the pool saves the auction's address under a number called the current period. But right after saving, it increases that number. Later, when the auction tries to get its reserve tokens, the pool looks up the new number, finds nothing, and rejects the request. So the auction can never finish.

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.