Skip to content
Access control Audit finding Intermediate

Configurator Can Manipulate Critical Parameters to Force Mass Liquidations and Drain Protocol Funds

The configurator role can set critical financial parameters such as margin requirements, liquidation fees, and trading fees without any upper bounds. A malicious configurator could set extreme values to make all user positions instantly unhealthy and then liquidate them, extracting excessive penalties and fees to drain the protocol.

Catchme Follow

Originally disclosed on Immunefi

Informational View original
  • Disclosed after under an hour

#47295 [SC-Insight] Configurator Can Manipulate Critical Parameters to Force Mass Liquidations and Drain Protocol Funds

Submitted on Jun 12th 2025 at 11:33:20 UTC by @Catchme for IOP | Paradex

Description

Brief/Intro

The Paraclear protocol grants the CONFIGURATOR_ROLE unrestricted power to modify critical financial parameters including margin requirements, liquidation fees, and trading fees without any upper bounds validation. A malicious configurator can exploit this to set extreme parameter values (e.g., 1000% margin requirements, 100% liquidation fees) that instantly make all user positions unhealthy, then liquidate them through the insurance fund to extract maximum penalties and trading fees, effectively draining the entire protocol.

Vulnerability Details

1. Unrestricted Parameter Control

The configurator role has unlimited power to modify critical parameters with no upper bounds:

Liquidation Fee - No Upper Limit:

CAIRO
// paraclear/src/paraclear/paraclear.cairo:427-430
fn setLiquidationFee(ref self: ContractState, fee: felt252) {
    self._assert_only_configurator();
    self.Paraclear_liquidation_fee.write(fee);  // No validation whatsoever!
}

Margin Parameters - No Upper Limit:

CAIRO
// paraclear/src/perpetual/future.cairo:154-167
fn update_perpetual_asset(ref self: ComponentState<TContractState>, new_asset: PerpetualAsset) {
    self.assert_only_role(roles::CONFIGURATOR_ROLE);
    assert!(new_asset.market != 0, "Synthetic: Can't update asset with unset market");
    // No validation on margin_params.imf_base, imf_factor, mmf_factor
    self.Paraclear_perpetual_asset.write(new_asset.market, new_asset);
}

Trading Fees - No Upper Limit:

CAIRO
// paraclear/src/account/account.cairo:290-295
fn set_global_fee_rate(...) {
    let net_fee = maker_fee + taker_fee;
    assert!(
        net_fee.try_into().unwrap() >= 0_i128, 
        "Negative total fee rate is not allowed"  // Only checks non-negative!
    );
}

2. Margin Calculation Impact

The margin requirement calculation directly uses these unvalidated parameters:

CAIRO
// paraclear/src/perpetual/future.cairo:792-804
fn future_margin_requirement(
    self: @PerpetualAssetBalance,
    imf_base: i128,           // Directly used without bounds checking
    mmf_factor: i128,
    margin_check_type: felt252,
    mark_price: i128,
) -> i128 {
    let current_value_abs = abs_128(self.get_value(mark_price));
    let margin_fraction = self.future_margin_fraction(imf_base, mmf_factor, margin_check_type);
    mul_128(current_value_abs, margin_fraction)  // Can result in extreme values
}

3. Health Check Vulnerability

Account health is determined by comparing account value to margin requirements:

CAIRO
// paraclear/src/account/account.cairo:612-616
fn excess_balance(self: @AccountState, margin_check_type: felt252) -> i128 {
    self.account_value() - self.margin_requirement(margin_check_type)
}

When imf_base is set to extreme values (e.g., 10x normal), all accounts become immediately liquidatable.

4. Liquidation Penalty Extraction

The liquidation penalty is calculated as:

CAIRO
// paraclear/src/paraclear/paraclear.cairo:1386-1387
let liquidation_fee = self.getLiquidateFee();
let liq_penalty_full = mul_128(margin_requirement, liquidation_fee.try_into().unwrap());

With extreme parameters:

  • margin_requirement = position_value × 1000% = 10× position value
  • liquidation_fee = 100%
  • liq_penalty_full = 10× position value

5. Contradicts Official Documentation

The official Paradex documentation states:

  • "The Liquidation Fee is set to 70%"
  • "Partial Liquidation of unhealthy accounts and attempts to minimise impact on the user's assets"

However, the code allows unlimited fee manipulation, violating these safety guarantees.

Impact Details

  1. Parameter Manipulation:

    • Set imf_base to 1000% (normal: 1-5%)
    • Set liquidation fee to 100% (documented: 70%)
    • Set trading fees to 50% (normal: 0.1%)
  2. Mass Liquidation Trigger:

    • All user positions instantly become unhealthy (excess_balance < 0)
    • Insurance fund can liquidate any account
  3. Profit Extraction:

    For a user with $10,000 position:
    - New margin requirement: $10,000 × 1000% = $100,000
    - Liquidation penalty: $100,000 × 100% = $100,000
    - Additional trading fees during settlement: $10,000 × 50% = $5,000
    

References

Proof of Concept

Proof of Concept

PoC

paraclear/src/paraclear/tests/test_paraclear_liquidations.cairo

Rust
use crate::tests::test_utils::{
    ADMIN, CONFIGURATOR, EXECUTOR, INSURANCE_FUND, NO_ROLE_ADDRESS, STATE_PUBLISHER,
    setup_paraclear, setup_paraclear_with_oracle,
};

#[test]
fn test_poc_configurator_manipulates_critical_parameters() {
    let (_, paraclear_dispatcher) = setup_paraclear();
    
    // Check initial liquidation fee (should be 0 in test setup)
    let initial_fee = paraclear_dispatcher.getLiquidateFee();
    assert(initial_fee == 0, 'fee should be 0');
    
    start_cheat_caller_address(paraclear_dispatcher.contract_address, CONFIGURATOR());
    
    // 1. Set extreme liquidation fee (1000% instead of documented 70%)
    // Documentation claims "The Liquidation Fee is set to 70%" but code has NO validation
    let extreme_liquidation_fee = 1000000000; // 1000% in 8-decimal format
    paraclear_dispatcher.setLiquidationFee(extreme_liquidation_fee);
    
    // 2. Test even more extreme values to show lack of bounds checking
    let absurd_fee = 50000000000; // 50000% - completely unreasonable
    paraclear_dispatcher.setLiquidationFee(absurd_fee);
    
    stop_cheat_caller_address(paraclear_dispatcher.contract_address);
    
    // 3. Verify extreme parameters were stored without any validation
    let final_fee = paraclear_dispatcher.getLiquidateFee();
    assert(final_fee == absurd_fee, 'fee set without bounds checking');
    
    // Impact: With 50000% liquidation fee, any liquidation would extract 500x more
    // than the normal fee, enabling complete protocol fund drainage
    // This completely violates the documented guarantee of 70% max fee
}

The original report as published on Immunefi, by Catchme. 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 lack of upper bound validation on critical financial parameters set by the configurator role.

Impact

A malicious configurator could force mass liquidations and extract excessive penalties and fees, potentially draining the entire protocol.

What the attacker needed

Malicious configurator role

How it was found

  1. Set an extreme liquidation fee using the setLiquidationFee function.
  2. Set even more extreme values to demonstrate lack of bounds checking.
  3. Verify that the extreme parameters were stored without validation.

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 smart contract system, a special role called the configurator can change important numbers like how much collateral users need or what fees are charged. The problem is that there are no limits on how high these numbers can be set. A dishonest configurator could set them extremely high, causing all users' positions to appear unsafe, and then take large fees when liquidating them, stealing funds.

What is Access control?

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.

More by Catchme

View all

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

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.