The price feed derives prices by simulating a trade against Uniswap pair reserves, which an attacker can shift drastically with flash loans to produce almost arbitrary prices. Wrong prices break core contract functions such as margin borrowing and liquidations.
The registerTradeAndBorrow function pays back a user's debt with the trade output but then credits the full output amount again as a deposit, so the user is credited twice. An attacker could repeatedly withdraw the extra amount until the contract's funds are drained.
Rewards are credited to a margin trader's account but the withdrawal function checks the caller against the incentive reporter role, so the trader can never withdraw. As a result, nobody can withdraw the accrued rewards.
The IsolatedMarginTrading contract lacks a default liquidationThresholdPercent, leaving it at zero. As a result, the belowMaintenanceThreshold function always returns true, allowing anyone to be liquidated immediately.
MarginSwap's internal price oracle only updates when a borrow or liquidation occurs for an account lending or borrowing that token, so for less popular tokens the price can become stale. An attacker can exploit this by making undercollateralized borrows when the Uniswap price has moved more than 10%, draining funds from the contract.
The PriceAware contract derives prices from an AMM's getAmountsOut function, whose returned values can be manipulated by an attacker using large capital or flash loans. Peg amount limits reduce but do not fully remove the impact of such manipulation.
The liquidation check in a cross-margin lending contract used an inverted comparison, so the condition for being liquidatable was reversed. As a result, healthy traders could be liquidated while under-collateralised traders could not be.
A state variable in a smart contract is declared but never initialised or updated, so it keeps its default value of zero. Calculations that use it for bucket indexes or sizes therefore either always return zero when multiplying or fail when dividing.
The owner-controlled functions that set leverage and liquidation threshold percentages could be called at any time, so a user's position could become liquidatable from one block to the next. An attacker with owner access could change these values abruptly to force liquidations.
The addHolding function fails to update the holdsToken map, so depositing the same token multiple times pushes duplicate entries into the holdingTokens array. This causes getHoldingAmounts to return the same balance multiple times, allowing an attacker to withdraw more tokens than they deposited and steal funds.
The MarginRouter contract trusted token amounts returned by a caller-supplied fake pair contract and credited them before completing the real swap, and the swap callback allowed re-entering the router. An attacker could therefore be credited several times for a single real trade and eventually drain tokens.
The contract fails to check that the input and output tokens are different, allowing an attacker to call a swap function with the same token and a fake pair contract that returns zero output. This lets the attacker withdraw funds from the contract without proper accounting, bypassing a time-lock.
The report lists several smart contract functions that appear to lack access checks, suggesting that very large input values might disrupt internal accounting and possibly lock functions or produce wrong rates. The project's response found most functions were already protected or safe by design, but agreed one function deserved an extra guard against a malicious token contract.
The liquidate function in two contracts can be called by anyone, and repeated calls by an unauthorised address increase the maintainer's failure count. Once the count exceeds a threshold, the maintainer is marked as failing and the attacker can withdraw the maintainer's cut of liquidation revenues.
Two swap functions on the MarginRouter contract lack caller authorisation and do not validate the supplied pair and token arrays. An attacker could trade on behalf of the protocol, supply self-constructed pair contracts to run arbitrary code, and reenter the protocol, potentially losing funds.
Several library and contract functions do not verify that the length of a token path matches the number of tokens, nor that the tokens actually correspond to the pair. An attacker or careless caller could set a faulty liquidation path that causes liquidation transactions to revert.
The variable lastUpdatedDay in IncentiveDistribution.sol is not initialised, so when updateDayTotals is called it computes a huge day difference and enters a very long loop that runs out of gas. Even if the loop finished, the daily distribution variable would be updated incorrectly, making the incentive distribution inaccurate or non-functional.
MA
Marginswap
High
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.