Ethereum
Accounting error

PeakDeFi Hack: How Olympix Would Have Prevented the $33.8K Loss

Loss
Loss
Exploit date
December 4, 2026

On December 4, 2026, at 12:40:11 UTC, a single Ethereum transaction borrowed 50 million USDC, parked it in an old PeakDeFi fund for a few calls, and left with a referral commission the fund had never earned. The fund paid out 33,819.894047 USDC, roughly $33.8K, and got every dollar of the 50 million back before the block closed. No investor had been referred, no capital had stayed, and no trading profit had been made. The referral logic simply looked at what was sitting in the fund at the moment it was asked to pay, and the attacker made sure that moment looked enormous.

The alert came from Defimon, Decurity's automated monitor, which put the loss at about $33.8K and described the bug as commission math that trusted the balance at redemption time instead of requiring deposits to persist. The on-chain transfers match that figure to the cent.

A Fund That Paid Its Affiliates

PeakDeFi launched as a decentralized asset management fund on Ethereum. Investors bought fund shares with USDC, asset managers traded the pooled capital, and the fund ran in cycles. According to PeakDeFi's investor FAQ, each trading cycle lasted 60 days with a 3-day intermission in between, and a 35% success fee on profitable cycles was split between asset managers (15%) and affiliates (20%). Affiliates could earn up to 20% commission on fund profits, spread across eight referral levels. The same documentation now labels the fund as inactive, but the contracts were still live on mainnet and still holding USDC.

Three pieces of the system matter for this incident. The fund itself, a minimal proxy at 0x07cd...00e4, took deposits, minted SHARE tokens to depositors and recorded which referrer each depositor named. A separate PeakReward contract tracked the referral tree and routed commissions up it. A Peak Referral Token, PRT, was minted to a referrer alongside a referred deposit, which is how the system kept score of who had brought what into the fund.

The design assumed that a referred deposit was real money that would sit in the fund through a cycle and share in its results. Nothing in the payout path, as Defimon describes it, checked that assumption.

One Transaction, Start to Finish

The attack contract's first call into the fund advanced it to a new phase. The fund emitted TotalCommissionPaid and ChangedPhase events and minted 84.28 SHARE to a long-standing address, 0xb902...094d, before any borrowed money had moved.

Then came the capital. The attack contract flash-borrowed 50,000,000 USDC from Morpho and deposited all of it into the fund through depositUSDC(), naming a second attacker contract, 0xc7e1...ae61, as its referrer. PeakReward emitted a Register event for that link. The fund minted about 16.7 billion SHARE to the attack contract and the same number of PRT to the referrer contract, so for a brief moment the attacker's referrer looked like the most productive affiliate PeakDeFi had ever had.

With that position in place, the commission was redeemed. Defimon traces it to peakReferralRedeemCommissionForCycle in the fund's logic contracts, which computed the referral commission from the current cycle's pool while the attacker's 50 million was still counted in it. The fund sent 33,819.894047 USDC to PeakReward, and PeakReward emitted PayCommission events and paid it out in two equal parts: 16,909.947023 USDC to the attacker's referrer contract and 16,909.947024 USDC to 0xb902...094d, the address above it in the referral tree. The referrer contract passed its share straight back to the attack contract.

Unwinding took three more steps. The attack contract burned its 16.7 billion SHARE and the matching PRT, withdrew the full 50,000,000 USDC, and repaid Morpho. It swapped 1,690.994702 USDC for 1.0677 WETH through the Uniswap V3 USDC/ETH pool, unwrapped it to ETH, and sent the remaining 15,218.952321 USDC to the attacker's wallet. Gas aside, the attacker's capital cost was zero.

Where the Money Went

The fund lost 33,819.894047 USDC, and that's the figure in the title because it's what left the victim contract. The attacker kept half of it, about $15.2K in USDC plus roughly 1.07 ETH, which lines up with Defimon's account. The other half landed on 0xb902...094d, an address with on-chain history going back to November 2020 that received both the upline commission and the SHARE minted when the phase changed. The public record doesn't say who controls it.

As of December 4, 2026, PeakDeFi hadn't posted about the incident on X or published a post-mortem, and no return of funds had been announced.

Present Isn't the Same as Committed

The commission rule PeakDeFi wanted was easy to state: a referrer earns a share of what their referrals actually contributed over a cycle. What the code paid, according to Defimon, was a share of whatever the referred balance happened to be when redemption ran. For an honest affiliate those two numbers converge, because honest deposits stay put. A flash loan breaks that convergence completely. It creates a referred balance that exists for a handful of calls inside one transaction, collects a commission sized to that balance, and then disappears.

A commission pool needs a notion of time to be safe: a snapshot taken before the cycle closes, a minimum holding period, or a rule that a deposit and a commission claim can't happen in the same block. The fund had none of them on this path, so the payout could be sized by capital that was never at risk. The source behind the fund's minimal proxy isn't verified on public explorers, which is why this post doesn't quote it.

It's the same trust-whatever-the-balance-says pattern that cost Projekt $560K, where a reward vault treated any balance increase as a paid purchase.

How Olympix Would Have Caught the Single-Block Referral

Olympix reads a contract as a set of states, transitions and entry points, then draws on the surrounding context to infer the invariants the system depends on but never writes down. For PeakDeFi, two entry points define the rule together. depositUSDC() grows the referred balance and the commission pool, and the referral redemption path pays out of that pool. Static analysis would have surfaced the signal here: a payout computed from a balance that the same caller can raise and lower inside one transaction, with no snapshot, block check or holding period standing between deposit, redemption and withdrawal.

From that signal, BugPoCer would have worked from the system outward. The invariant is simple to write down: a referrer's commission for a cycle reflects only capital that was committed to the fund for that cycle, so a deposit that is withdrawn in the same transaction earns nothing. BugPoCer searches for a sequence of calls that breaks a rule like that, and here the sequence is short. Advance the phase, deposit a large amount while naming a fresh referrer, redeem the commission, withdraw the principal. Had the team run it, BugPoCer would have returned that sequence as a counterexample, with the minimal conditions (any large temporary balance and a newly registered referrer), the state change (USDC leaving the fund while the depositor's principal comes back whole) and a generated Forge test that reproduces it. That test would have been the December 4 drain, produced in development, where the fix is a snapshot or a lock rather than a lost $33.8K.

Because Olympix runs at every merge and before release, a check like this keeps running as reward logic changes, which is exactly where commission and incentive code tends to drift away from the assumptions it was written under.

What Builders Should Take From It

Any payout sized by a balance needs an answer to one question about that balance: how long has it been there. Referral commissions, staking rewards, governance weight and fee rebates all fail the same way when the code reads a live balance that a flash loan can inflate for free. Snapshot the inputs at a point the attacker can't control, or require the capital to stay long enough to carry real risk. If your protocol pays anything out based on deposits, book a technical walkthrough to see how Olympix maps the paths into that math in your own contracts.

On-Chain References

Exploit Transaction: 0xf73b...aef7

Attacker EOA: 0x72ae...97d9

Attack Contract: 0x820b...0c4d

Attacker Referrer Contract: 0xc7e1...ae61

Victim Fund (PeakDeFiFund): 0x07cd...00e4

Commission Router (PeakReward): 0xf8bc...302e

Upline Recipient: 0xb902...094d

Flash Loan Source (Morpho): 0xbbbb...ffcb

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.