OAK — OnChain Attack Knowledge

Worked example · 2026-07

DeFiTuna — a zero-collateral leveraged position, swapped through an attacker-made pool, rounded to zero value and passed the health check, leaving a ~$570K USDC lending-pool deficit — DeFiTuna (Solana) — 2026-07-16

Loss
$569,601 USDC per CertiK; about $570K per BlockSec; $580,000 is the figure DeFiTuna gave, reported by Crypto Briefing. The USDC lending pool was left with a matching deficit. On 2026-07-28 DeFiTuna said withdrawals were open for affected lenders and that losses were socialized across all USDC lending pool depositors.
OAK Techniques observed
OAK-T9.016 (Contract Accounting / State-Invariant Flaw — primary, per CertiK and BlockSec. The position was valued at zero after a rounding step, and the health check treated a zero total as healthy without requiring zero debt. See techniques/T9.016-contract-accounting-state-invariant-flaw.md). Rounding was a trigger; OAK does not tag the rounding-attack Technique, whose page describes share-price manipulation in vaults, because no opened page describes that pattern here.
Attribution
unattributed. CertiK lists nine attacker addresses and no identity. No named individual or group is linked in the opened pages.
Key teaching point
A solvency check must fail closed: a position with outstanding debt is never healthy, whatever its computed value, and the pool the swap actually runs through must be validated, not only the normal market pool. BlockSec states the fix as "A zero-value position with outstanding debt is never healthy." Here the price-deviation check inspected a different pool from the one the swap used, and the health check then accepted a zero total.

Summary

DeFiTuna is a Solana protocol with lending and leveraged spot positions. On 2026-07-16 an attacker created a nearly empty TUNA/USDC Fusion pool, placed two limit orders in it, and opened a spot position with zero collateral that borrowed about 569,601 USDC from the lending pool. The borrowed USDC was swapped through a Jupiter route into the attacker's pool and returned about 0.000494 TUNA. The position was valued at under one unit, truncated to zero, and is_healthy() accepted it. The attackers then withdrew the USDC from their limit-order positions (CertiK, BlockSec). DeFiTuna disclosed the loss and said it had identified and mitigated the attack vector.

Timeline (UTC)

Stages: Flaw (health check), Preparation (fake pool, limit orders), Take (zero-collateral borrow, swap, withdrawal), Money (bridge, Railgun), Response. The only time given is CertiK's attack-transaction timestamp, which the page does not say is UTC.

When What happened OAK
Before 2026-07-16 (undisclosed) compute_total_and_debt() rounds its result down and to_num::<u64>() drops the fractional part, so a value of about 0.91 becomes 0. is_healthy() treats a zero total as healthy without requiring zero debt (CertiK; BlockSec). Whether the code is what Sec3 audited is unknown (SigintZero). T9.016
2026-07-16 before the attack (times undisclosed) The attacker creates a nearly empty TUNA/USDC Fusion pool and places two sell-side limit orders totalling 0.001052 TUNA at tick about 208,640. CertiK says the pool's initial price was close to the oracle price; BlockSec says on-chain evidence shows an extreme initial price (about 1.149 billion USDC per TUNA) and flags this as at odds with the project's statement. Funding of the attacker addresses is undisclosed. —
2026-07-16 05:48:12 (timezone not stated) Attack transaction: the attacker calls Open_and_increase_tuna_spot_position_jupiter with zero collateral and borrows about 569,601 USDC net of fees. The pre-swap check validates the normal market pool, not the attacker's pool. The swap returns 494 raw units of TUNA, the position is valued at zero and passes is_healthy() (CertiK). BlockSec analyses a different transaction and notes that several attack transactions were executed. T9.016
2026-07-16 Each of two attackers withdraws about 284,280.48 USDC from the malicious limit-order positions (CertiK). —
After 2026-07-16 (dates undisclosed) Funds from two attacker addresses are bridged from Solana to Ethereum through Mayan; 140 ETH is deposited into Railgun. As of 2026-07-20 the wallet below still held 291,696 DAI and 5 ETH (CertiK). T7.003
2026-07-16 DeFiTuna discloses the loss, says the attack vector was identified and mitigated and that it is working to recover the funds (Crypto Briefing, SigintZero). response
2026-07-28 DeFiTuna opens withdrawals for affected lenders and socializes losses across all USDC lending pool depositors (DeFiTuna on X). response

Key addresses (all as printed by CertiK):

Root-cause evidence

  • Technique: OAK-T9.016
  • Source: https://www.certik.com/blog/defituna-incident-analysis; https://blocksec.com/blog/web3-security-barnbridge-defituna-exploits
  • Source type: security-firm
  • Confidence: corroborated
  • Evidence: CertiK and BlockSec, two independent firms, describe the same chain: zero-collateral borrow, swap through an attacker-created pool, value rounded to zero, health check accepting the zero total. BlockSec states "The health check logic treated total == 0 as a healthy state without requiring debt == 0." They differ on the fake pool's initial price and on the loss figure ($569,601 vs about $570K vs DeFiTuna's $580K). DeFiTuna has not published a post-mortem in the pages opened. Neither firm's page was independently checked on-chain by OAK.

Public references

Techniques demonstrated (1)

More incidents