Skip to content
Business logic Audit finding Advanced

Supply drain of PowerPerp tokens through liquidations

The PowerPerp token supply can be drained because liquidations burn tokens, reducing total supply and raising the token price, which makes more positions underwater and harder for long traders to close. An attacker could exploit this by triggering liquidations to strain the supply and profit from the price increase.

RaymondFam Follow

Originally disclosed on Code4rena

Submitted by RaymondFam

Contract PowerPerp that has Solmate’s ERC20.sol inherited has zero totalSupply initiated by default. And, as denoted by PowerPerp.sol, onlyExchange can mint or burn Power (Square) Perp ERC-20 tokens:

File: PowerPerp.sol#L32-L38

    function mint(address _user, uint256 _amt) public onlyExchange {
        _mint(_user, _amt);
    }

    function burn(address _user, uint256 _amt) public onlyExchange {
        _burn(_user, _amt);
    }

This could run into supply issue if the source and drain have not been routed through the right channels.

Proof of Concept

There is only one source of minting when users open long trades (Exchange.sol#L233-L245).

However, there are two channels users could burn the tokens, i.e. closing long trades (Exchange.sol#L288-L299), and liquidating positions (Exchange.sol#L333-L353).

It is apparent that the long traders hold the majority of the tokens although long term the tokens can be swapped for SUSD on the swap exchange, believing that is how MarkPrice derives from. Additionally, this should be where liquidators who are neither long nor short traders buy their Power Perp tokens from prior to profiting on the liquidable positions.

If liquidations get more frequent than expected due to collateral token dropping in price, powerPerp.burn() (Exchange.sol#L350) is going to both strain the Power Perp token supply and drive up the price. As a result, the amount of positions going underwater is going to increase too.

The chain effect continues since long traders will have difficulty closing their positions if their minted Power Perp tokens have earlier been swapped for SUSD at lower prices than now.

The situation could be worse if the scenario described above were to happen in the early phase of system launch.

Recommended Mitigation Steps

Since short traders are sent the cost deducted SUSD when opening their positions, consider having liquidators sending in the equivalent amount of cost added SUSD to the liquidity pool (just like when short traders are closing their positions) instead of having Power Perp tokens burned in _liquidate(). This will also have a good side effect of enhancing the hedging capability of the liquidity pool.

mubaris (Polynomial) confirmed


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

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 liquidation process burns PowerPerp tokens instead of having liquidators pay into the liquidity pool, which reduces supply and creates a feedback loop.

Impact

Frequent liquidations could strain the PowerPerp token supply, drive up its price, increase underwater positions, and make it difficult for long traders to close their positions.

What the attacker needed

Frequent liquidations; collateral token price drop

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.

PowerPerp tokens are like shares in a trading system. When someone is liquidated, their tokens are destroyed, which makes the remaining tokens more valuable. This can cause a chain reaction where more people get liquidated and long traders cannot close their positions.

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 RaymondFam

View all

18 more disclosed reports, best first.

More from Polynomial Protocol contest

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.