#47257 [SC-Insight] Lack of position quantity limit for a single account.
Description
Brief/Intro
Vulnerability Details
fn _create_asset_balance(
ref self: ComponentState<TContractState>,
account: ContractAddress,
market: felt252,
amount: felt252,
cost: felt252,
current_funding: felt252,
) -> PerpetualAssetBalance {
// Get current tail of synthetic asset balances
let tail_market = self.Paraclear_perpetual_asset_balance_tail.read(account);
// Create balance for new market
let new_balance = PerpetualAssetBalance {
market: market,
amount: amount,
cost: cost,
cached_funding: current_funding,
prev: tail_market,
next: 0 // UNSET in Cairo 1
};
// Write balance to storage
self.Paraclear_perpetual_asset_balance.write((account, market), new_balance);
// Set new tail
self.Paraclear_perpetual_asset_balance_tail.write(account, market);
if tail_market.is_non_zero() {
// Write updated tail balance to storage
self
.Paraclear_perpetual_asset_balance
.entry((account, tail_market))
.next
.write(market);
}
new_balance
}Impact Details
References
Proof of Concept
Proof of Concept
Previous#47198 [SC-Critical] The operator can perform unauthorized fund transfers.Next#47291 [SC-Insight] Serveal bugs in function set_prices_and_funding_snapshot
Was this helpful?