OAK — OnChain Attack Knowledge

Worked example · 2026-07

B² Network — an attacker takes the staking contract's upgrade authority, rewrites what the contract does, and sells 8.59M B2 into the market — B² Network (Bitcoin Layer 2) — 2026-07-23

Loss
~$3.86M — 8.59M B2 tokens removed from the network's token staking service. The attacker sold the entire position for 5,409 BNB (~$3.01M), the gap between the two figures reflecting the price impact of liquidating 8.59M tokens into available depth. Proceeds were bridged to Ethereum, swapped into ETH and USDT, and deposited into NEAR Intents and HOT Protocol. B² Network committed to fully compensating all affected users and suspended staking.
OAK Techniques observed
OAK-T9.004 (Access-Control Misconfiguration — primary, confirmed mechanism. The attacker obtained unauthorised access to the upgrade authority of the B2 token staking contract — the administrative permission governing how the contract behaves — and used it to alter the contract's logic directly. B² Network's own disclosure names the upgrade authority as the compromised control. No cryptographic primitive was broken and no user signed anything. See techniques/T9.004-access-control-misconfiguration.md). OAK-T6.005 (Proxy-Upgrade Malicious Switching — cross-referenced: the extraction ran through the upgradeability mechanism itself, which is the shape T6.005 describes, rather than through a flaw in the staking logic as written). OAK-T7.003 (Cross-Chain Bridge Laundering — bridged to Ethereum) and OAK-T7.007 (DEX Aggregator / Routing Laundering — the sale into BNB and the routing through NEAR Intents and HOT Protocol).
Attribution
pseudonymous. No named individual or group, and no public link to a tracked OAK actor. B² Network identified the attacker's wallets and made a public legal-immunity offer: returning at least 10% of the stolen funds (~$386,000) to an official address within 24 hours would be treated as qualifying for immunity. Per OAK's neutral-disposition convention, whether the offer was accepted does not change the mechanism or its classification. The method by which the upgrade authority was obtained has not been publicly disclosed — OAK records the seizure as confirmed and the entry vector as unknown rather than inferring a key compromise, phishing, or misconfigured permission.
Key teaching point
Upgradeability is a permanent, standing authorisation to replace the contract's behaviour with arbitrary behaviour, and it is worth exactly as much as everything the contract controls. B² Network's staking logic was never exploited — it was replaced. That distinction matters because the entire audit-and-review apparatus operates on the code as written, and an upgrade authority makes the code as written a temporary condition. Two controls close the gap and neither is exotic. First, the upgrade authority should be held behind a multi-party threshold and a timelock, so that seizing one credential yields nothing immediately actionable and the change is publicly visible before it takes effect. Second, an upgrade event on a contract holding user deposits should be a monitored, alerting event — upgrades are rare, deliberate, and scheduled, which makes an unscheduled one among the highest-signal-to-noise alerts a protocol can run. B² had a contract whose behaviour could be rewritten in a single transaction by a single authority, with no delay and no alarm.

Summary

B² Network is a Bitcoin Layer 2 operating a staking service for its B2 token. The staking contract was upgradeable, with an upgrade authority — an administrative permission determining how the contract operates.

On 2026-07-23, an attacker gained unauthorised access to that upgrade authority and used it to modify the contract's rules directly, extracting 8.59M B2 tokens worth approximately $3.86M.

The attacker sold the full 8.59M B2 for 5,409 BNB, realising about $3.01M — roughly $850K less than the pre-sale mark, the difference absorbed by slippage. The proceeds were then bridged to Ethereum, swapped into ETH and USDT, and deposited into NEAR Intents and HOT Protocol.

B² Network disclosed the incident publicly the same day, stating that the incident involved unauthorised access to the staking contract's upgrade authority, that $B2 staking was temporarily suspended pending additional security reviews, that the issue had been contained with no further impact expected, and that all affected users would be fully compensated. The team separately offered the attacker legal immunity in exchange for returning at least 10% (~$386,000) within 24 hours.

The incident fell inside a roughly six-hour window on 2026-07-22/23 that also contained the AFX Trade ($24.15M) and Verus ($7.54M) compromises, together accounting for more than $35M.

Timeline (UTC)

When Event OAK ref
(standing) B2 token staking contract is upgradeable; upgrade authority is a single administrative control with no publicly-described timelock or threshold (standing T9.004 / T6.005 surface)
(undisclosed, prior) Upgrade authority comes under attacker control; method not publicly disclosed T9.004 pre-positioning
2026-07-23 Attacker uses the upgrade authority to alter the staking contract's logic and extracts 8.59M B2 (~$3.86M) T9.004 / T6.005 exploitation
2026-07-23 Full position sold for 5,409 BNB (~$3.01M) T7.007
2026-07-23 Proceeds bridged to Ethereum, swapped to ETH and USDT, deposited into NEAR Intents and HOT Protocol T7.003 / T7.007
2026-07-23 B² Network discloses publicly, suspends B2 staking, states the issue is contained and all affected users will be fully compensated; offers legal immunity for return of ≥10% within 24 hours (operator response)

What defenders observed

  • Pre-event (a single authority that can rewrite the contract). Everything downstream follows from this one property. An upgrade authority reachable by one compromised credential, executing immediately, gives an attacker the full value of the contract without needing any flaw in it. Threshold control plus a timelock on upgrade authority is the standard mitigation and was absent or insufficient here (M17, M22, M34).
  • Pre-event (the audit surface and the live surface were different things). Reviewers assess deployed logic; an upgrade authority means deployed logic is provisional. Any assessment of an upgradeable contract that does not separately assess who can upgrade it and how fast has assessed only half the system.
  • At-event (an unscheduled upgrade is a near-perfect alert). Upgrades to a live staking contract are infrequent and planned. An alert on any upgrade transaction not matching a scheduled change is high-signal, low-noise, and would have fired at the moment of compromise rather than after the tokens were sold (M04, M05).
  • At-event (8.59M tokens hitting the market is the second signal). Liquidating the full position cost the attacker roughly $850K in slippage — a sale large enough to move the market is large enough to detect. Monitoring for outsized sales of one's own token from non-treasury addresses catches the extraction leg even when the seizure leg is missed.
  • Response (fast, complete disclosure with a compensation commitment). B² named the compromised control specifically — the staking contract's upgrade authority — rather than describing the event vaguely, suspended the affected service while leaving the rest of the network running, and committed to full user compensation. Naming the exact control is what lets other protocols check whether they share the exposure, and it is the part of incident response most often omitted.

Public references

Discussion

The natural OAK sibling is examples/2026-06-tesseradao-tsr-admin-key-unauthorized-mint.md, where an admin key produced an unauthorised mint a month earlier, and the pair marks out a consistent 2026 pattern: the fastest route into a protocol is increasingly the administrative control it built for itself rather than a defect in the logic it shipped. B² adds a specific and under-appreciated variant, because an upgrade authority is strictly more powerful than a mint or pause authority — it does not merely exercise a privileged function, it replaces the function set. There is no code review that constrains what a contract will do once someone else can decide what the contract is.

The compensation commitment deserves a note in its own right, and specifically what it implies about where the loss landed. B² absorbed a $3.86M event onto its own balance sheet and kept the network running, which is a solvency decision rather than a security one. OAK's convention is that fund disposition is neutral metadata — full user compensation does not make this less of an attack, and the mechanism is identical whether the treasury covers the hole or the stakers eat it. What it does change is who has an incentive to fix the upgrade-authority topology, and here that is the protocol treasury, which is generally the healthiest alignment available after an incident of this kind.

Techniques demonstrated (4)