Sharwa Margin Trading's $32.9K Loss and How Olympix Would Have Prevented It
Sharwa.Finance had already been through this once. In October 2025, attackers took about $147,000 from the Arbitrum margin-trading protocol by bending a pool price that its trade router trusted, according to Verichains' analysis of that incident. Six and a half months later, at 10:17:07 UTC on May 1, 2026, a single Arbitrum transaction paid 32,850.89 USDC to a new attacker, and the alert that followed described the same family of flaw in a different corner of the code.
Options as Collateral
Sharwa is a portfolio margin protocol. Traders open a margin account, post almost any asset as collateral, and trade leveraged positions and options from one account, while lenders supply the liquidity those positions borrow. Part of that collateral can be a Hegic option, an options contract represented as an NFT, which the protocol has to value in dollars before it decides how much a trader can borrow against it.
Valuing an option means pricing whatever it pays out, and Sharwa turned that payout into a stablecoin figure through a price quote. According to the Defimon alert on the incident, that quote was a spot read from a low-liquidity pool, with no time-weighted average and no Chainlink fallback behind it. The alert names the oracle contract that produced it, 0x729c...826f, and the MarginTrading contract that relied on it, 0xadc9...2cf7.
A Price Anyone Could Move for a Moment
A spot quote reports what a pool would pay right now, given the reserves sitting in it at that instant. In a deep pool that number barely moves. In a shallow one, a single large trade shifts it a long way, and the shift lasts for exactly as long as the trader wants, inside one transaction. Any contract that reads the quote in that window sees the distorted number as if it were the market.
That's the property Sharwa's collateral check depended on. DefiLlama classifies the May 1 incident as oracle manipulation through spot price manipulation, and Defimon puts the cause in one line: the price came from a spot quote on a thin pool, with nothing to compare it against.
One Transaction, Borrowed and Returned
The on-chain record on Arbiscan shows the shape of the attack. The attacker's wallet, 0x4551...C681, called a contract it controlled, which borrowed 22,000 USDC in a flash loan from the Balancer Vault and pushed it into a USDC.e and USDC pool, getting back less than 10 USDC.e in return. That trade hit the kind of low-liquidity pool Defimon identifies as the price source.
With the price skewed, the attacker's contract opened a Sharwa margin account, which Arbiscan records as a newly minted margin-account NFT, and the attacker moved a Hegic option NFT into the system. Defimon reports that the attacker sent the Hegic option to their own contract and used the token's receive callback to pull roughly 33,000 USDC out of the MarginTrading contract. On-chain, 15,368.66 USDC, 4.52 WETH and 0.094 WBTC left three pool contracts during the transaction and passed through Sharwa's contracts to the attacker's contract.
To close out, the attacker's contract swapped the WETH and WBTC to USDC on Uniswap, sold its USDC.e back into the same thin pool for 37,349.97 USDC, repaid the 22,000 USDC flash loan to Balancer, and sent the remaining 32,850.89 USDC to the attacker's wallet. The flash loan came back in full, so what the attacker kept came out of Sharwa's liquidity.
The Second Lesson in the Same Codebase
The October 2025 incident ran on the same idea through a different door. Verichains describes how the attacker took a flash loan from Morpho, moved a Uniswap V3 pool, and then traded through Sharwa's FacadeTradeRouter, which asked a Uniswap quoter what a swap would return and trusted the answer. SolidityScan's write-up of that attack noted that no check confirmed the position was still solvent after the swap ran at the manipulated rate.
After October, Sharwa recovered about 40,000 USDT of the first attacker's haul with Binance's help, according to SolidityScan. The May attacker found the same kind of trust in a spot price, this time in the path that valued Hegic options rather than the one that sized swaps. DefiLlama's figures show the protocol's total value locked falling from about $49,200 at the end of April 2026 to under $4,000 at the end of May.
How Olympix Would Have Caught the Spot-Price Read
Olympix reads a margin protocol as states, transitions and entry points, and the state that matters most here is the account's health, the relationship between the value of its collateral and what it owes. Every path that changes either side of that relationship is one the engine maps, and Sharwa's collateral valuation sits on all of them.
Olympix's static analysis would have surfaced the signal at the oracle: a collateral price taken from a single pool's spot quote, with no time-weighted average, no freshness or deviation guard, and no second source to compare against. Thin liquidity made the attack cheap, and the missing guard in the code is what made it possible. That signal narrows the search from every path in the protocol, to the feasible ones, to the few where an attacker can influence the collateral price and borrow in the same transaction.
BugPoCer would have worked from the system outward with Counterexample-Guided Invariant Refutation, starting from the invariant a lending system lives by: no account should be able to withdraw more value than its collateral is really worth, and no single transaction should be able to leave lenders short. It would have tried to break that rule with the tools any attacker has, a flash loan, a pool trade and a margin account. The counterexample it would have returned is the May 1 drain in compact form, a sequence that moves the pool, values the option at the distorted price, borrows against it and unwinds at a profit, packaged with the minimal conditions and a generated Forge test that replays it in development.
Because Olympix runs at every merge and before release, that test would have stood against the Hegic valuation path the day it was added, and against the October 2025 router path before it.
A Price Check Worth Two Incidents
Sharwa lost money twice to the same root idea, a price the protocol treated as truth that an attacker could rewrite for the length of one transaction. Builders taking any asset as collateral need every valuation path tested against a manipulated pool, including the exotic ones like option NFTs. To see how Olympix tests the oracle and collateral paths in your own contracts and returns a runnable counterexample when one breaks, book a technical walkthrough.
On-Chain References
Exploit tx: 0x05cf...4dad
Attacker wallet: 0x4551...C681
Attack contract: 0x7E3C...D377
MarginTrading contract (per Defimon): 0xadc9...2cf7
Vulnerable oracle (per Defimon): 0x729c...826f
Block: 458233156
More post-mortems
See every post-mortem →See what Olympix finds on your own code
Send us a repo that's already been audited, and we'll run Olympix at the same commit and show you what comes back.




