The function that updates a position's margin balance uses percentages of the initial margin rather than the current price of the margin token. This allows a user to update their position using a stale, higher price even when the token's price has fallen.
The protocol stores data in nested structs within a Diamond proxy storage scheme, which could make future upgrades difficult or impossible without corrupting existing data. An attacker cannot directly exploit this, but future upgrades could lead to data inconsistency and improper system operation.
The redemption function checks the minimum redeem amount before deducting the fee, so the user can receive less than the specified minimum. An attacker could exploit this to receive a smaller payout than expected.
When a user partially closes a leveraged position, the settled fees are divided by the decrease quantity twice, leading to incorrect calculation of settled margin and profit/loss. This makes partial closes more profitable when fees are positive and full closes more profitable when fees are negative.
The protocol calculates a position's net value using fee values that are only updated when someone interacts with the market, so the net value can be stale. An attacker could exploit this delay to cause late liquidations, potentially leading to protocol insolvency in extreme cases.
The protocol calculates fees for long positions using the oracle's minimum price and for short positions using the maximum price, causing long orders to pay lower fees and short orders to pay higher fees. This creates an incentive imbalance where long orders are favoured.
Increasing leverage on a cross-margin position can reduce the position's initial margin to zero because the margin reduction is calculated using the current token price, which may have dropped. This allows the position to avoid paying borrowing fees and, in another case, lets isolated accounts close losing positions to recover their initial margin.
The pool's total value calculation skips stable token losses and unrealised profit and loss (uPnL) when both the stable token amount and unsettled amount are zero, which can happen after closing an isolated short position in profit. This leads to an incorrect pool value, causing unfair share minting and redemption.
When a user mints stake tokens using their portfolio vault balance, the token balance is reduced but the associated positions' from-balances are not updated. This leaves the cross available value overstated, allowing the user to open larger positions than their remaining collateral should permit.
The settle fee for cross-margin positions is processed twice in `_settleCrossAccount`, once by subtracting it and then adding it back when PnL is positive, so traders do not pay the fee. Additionally, a negative sum of PnL and settle fee can cause a cast failure and revert the decrease order.
The protocol calculates short position funding fees in USD terms but settles them using the current token price, so if a stablecoin depegs the fees are not fairly accrued. An attacker could exploit this by closing or holding positions to gain an unfair advantage when the peg fluctuates.
The mint request cancellation function only refunds tokens that came from the user's wallet, not those taken from the trading account balance. An attacker could lose tokens if a mint request funded from the trading balance is cancelled.
The pool's available liquidity calculation ignores unrealised losses from profitable short positions, so it can lend out more than it actually has. An attacker could open long positions that the pool cannot cover, leading to insolvency when shorters realise profits.
The margin reduction function did not account for the position's current profit and loss, allowing a trader to withdraw more margin than they should when the position was near liquidation. This let the trader recover funds that would otherwise be lost, reducing the expected profits of liquidity providers.
The autoReducePositions function lacks a call to set the oracle price, so it always reverts with PriceIsZero when trying to close positions. An attacker could not directly exploit this, but the risk control mechanism fails, increasing system risk in extreme market conditions.
The gas accounting in the execution fee calculation did not account for EIP-150's 63/64 rule, allowing a keeper to manipulate the gas limit and claim more execution fee than actually used, potentially draining the user's entire fee.
The protocol's pool liquidity calculation incorrectly includes unsettled funding fees, allowing a user to open a leveraged position that exceeds the pool's actual available liquidity. An attacker could exploit this to borrow more than the pool truly has, potentially causing a shortfall when positions are closed.
The createUpdatePositionMarginRequest function lacks validation that when a user pays with native ETH (isNativeToken true), the margin token must be WETH. An attacker can deposit ETH but have the request recorded with a different margin token, causing the system to later transfer that other token from the trade vault, potentially profiting or blocking other users' requests.
The protocol does not check whether a newly opened position would be immediately liquidatable. An attacker could open a position that is already liquidatable, potentially causing protocol insolvency if the liquidation loss exceeds the collateral.
Cross-margin positions that use the same token as collateral and close at a loss send the entire loss including fees from the portfolio vault to the stake token, but the fees are also recorded as unsettled and later taken again from the portfolio vault. This double counting of fees could make the portfolio vault insolvent.
The function `updatePositionFromBalanceMargin()` incorrectly returns early when the position's initial margin equals the margin from balance and the amount is negative, so it fails to reduce the margin from balance. This allows users to withdraw assets without reducing their position margin, enabling them to utilise more tokens than they deposited.
The batchUpdateAccountToken function lacks access control, allowing anyone to set arbitrary token balances for any account. An attacker could inflate their balance and withdraw all funds from the portfolio vault.
The pool's value calculation omits accrued but unsettled funding fees, so when a position is closed and those fees are added to the pool's unsettled amount, the pool value spikes without a corresponding change in share supply. An attacker could sandwich a closing position to exploit the temporarily inflated pool value when minting or redeeming shares.
The stake pool's LP vault may not hold enough tokens to cover redemptions because deposits made with isCollateral=true are sent to the portfolio vault instead. An attacker can deposit with isCollateral=true to inflate their LP share, then redeem from the LP vault, causing other LP holders' redemptions to revert due to insufficient balance.
The function that updates the 'from balance' margin of other positions when one is closed incorrectly uses the original amount for each position instead of the remaining amount, causing over-increment of 'from balance' values. This can make cross-account values incorrect, reducing available margin or increasing borrowing power.
The protocol uses an outdated liability value when updating pool settlement after repaying a user's debt, leading to inaccurate accounting. This can cause users to be overcharged fees.
The reward calculation used the account's token balance instead of the staked amount, so an attacker could transfer stake tokens between accounts to inflate rewards. This allowed claiming rewards multiple times for the same stake.
The gas fee processing function incorrectly calculates the loss fee when the actual execution fee exceeds the user's provided fee, always resulting in zero loss fee. This means keepers' excess gas losses are never recorded, causing them to lose funds over time.
The contract tracks total collateral per token by only increasing it on deposits and never decreasing it on withdrawals, so the tracked total eventually exceeds the collateral cap and blocks further deposits of that token. An attacker could not directly exploit this, but normal usage would cause a denial of service for deposits.
EL
Elfi
Medium
Instant results are busy. Press Enter to search every report.
No direct matches. Search every report above, or try a bug class like IDOR or SSRF.