Skip to content
Business logic Audit finding Beginner

The is_liquidation field in transfer_internal is not properly differentiated.

The transfer_internal function in the smart contract always sets the is_liquidation flag to 1, even for regular transfers. This causes all emitted events to be marked as liquidation transfers, so off-chain monitoring cannot distinguish between normal and liquidation transfers.

shaflow1 Follow

Originally disclosed on Immunefi

Informational View original
  • Disclosed after under an hour

#46867 [SC-Insight] The `is_liquidation` field in `transfer_internal` is not properly differentiated.

Submitted on Jun 5th 2025 at 14:46:02 UTC by @shaflow1 for IOP | Paradex

Description

Brief/Intro

In the transfer_internal function, there exists an is_liquidation field designed to distinguish between regular transfers and liquidation transfers. This field triggers events for off-chain monitoring. However, in the current system, all transfers incorrectly have is_liquidation = 1, failing to make this critical distinction. As a result, all emitted events are erroneously marked as liquidation transfers.

Vulnerability Details

Rust
        fn transfer_internal(
            ref self: ComponentState<TContractState>,
            sender: ContractAddress,
            recipient: ContractAddress,
            token_address: ContractAddress,
            amount: felt252,
            is_liquidation: felt252,
        ) {

In the transfer_internal function, there exists an is_liquidation field designed to distinguish between regular transfers and liquidation transfers.

Rust
        fn _transfer(
            ref self: ComponentState<TContractState>,
            sender: ContractAddress,
            recipient: ContractAddress,
            token_address: ContractAddress,
            amount: felt252, // 8位
        ) {
            ...
            // Transfer the amount to recipient
            self.transfer_internal(sender, recipient, token_address, amount, 1);
        }

        fn account_transfer_partial(
            ref self: ContractState,
            account: ContractAddress,
            receiver: ContractAddress,
            account_share: felt252,
            amount_collateral: felt252,
        ) -> felt252 {
                ...
                self
                    .token
                    .transfer_internal(
                        account, receiver, self.getSettlementTokenAsset(), token_transfer.into(), 1,
                    );
                // Fast transfer mode, collateral only
            } else {
                self
                    .token
                    .transfer_internal(
                        account, receiver, self.getSettlementTokenAsset(), amount_collateral, 1,
                    )
            }
        }

However, in non-liquidation transfers such as account_transfer_partial and regular transfer operations, the is_liquidation field is incorrectly set to 1 as well.

Impact Details

Since all transfer events have is_liquidation = 1, off-chain systems cannot use this field to distinguish between liquidation transfers and regular transfers.

References

https://github.com/tradeparadex/audit-competition-may-2025/blob/0eb81b26a67666c399b4e16b39a96c19848ab7fd/paraclear/src/paraclear/paraclear.cairo#L1517 https://github.com/tradeparadex/audit-competition-may-2025/blob/0eb81b26a67666c399b4e16b39a96c19848ab7fd/paraclear/src/token/token.cairo#L499

Proof of Concept

Proof of Concept

  1. When users transfer assets via the transfer function
  2. The TokenAssetBalanceUpdate event incorrectly marks all transfers with is_liquidation = 1, causing off-chain monitoring systems to potentially misinterpret normal transfers as liquidation events

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

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 is_liquidation parameter is hardcoded to 1 in all calls to transfer_internal, including regular transfers, instead of being set based on the transfer type.

Impact

Off-chain systems cannot use the is_liquidation field to distinguish between liquidation transfers and regular transfers, which could lead to misinterpretation of events.

What the attacker needed

None

The fix

The is_liquidation parameter should be set correctly: 1 for liquidation transfers and 0 for regular transfers, instead of always passing 1.

How it was found

  1. A user calls the transfer function to move assets.
  2. The transfer_internal function is called with is_liquidation set to 1.
  3. The TokenAssetBalanceUpdate event is emitted with is_liquidation = 1.

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 smart contract has a flag that is supposed to say whether a transfer is a liquidation (forced sale) or a normal transfer. The code always sets this flag to 1, so every transfer looks like a liquidation. Off-chain systems that watch these events get confused because they cannot tell normal transfers from liquidations.

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 shaflow1

View all

14 more disclosed reports, best first.

More from Paradex

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.