Dev.to Security 🔐 Cybersecurity 👁 0 📖 8 min read

A Commission Pool Paid to a Flash Loan: How PeakDeFi Rewarded a 62-Second Deposit

Originally published on PandaSecurity — Web3 security incident analysis, A Commission Pool Paid to a Flash Loan: How PeakDeFi Rewarded a 62-Second Deposit. At approximately 12:40 UTC on 4 December 2026, an attacker exe

Originally published on PandaSecurity — Web3 security incident analysis, A Commission Pool Paid to a Flash Loan: How PeakDeFi Rewarded a 62-Second Deposit.

At approximately 12:40 UTC on 4 December 2026, an attacker executed a single Ethereum transaction against the PeakDeFiFund contract (0x07cdb…00e4) that turned the fund's referral commission system against itself. The transaction flash-borrowed 50 million USDC from Morpho, deposited the full amount via depositUSDC() while registering an attacker-controlled referrer contract, let the fund's peakReferralRedeemCommissionForCycle logic pay out referral commissions from the current cycle's pool — inflated by the momentary deposit — then burned the temporary SHARE and PRT tokens, withdrew all 50 million USDC of principal, and repaid the flash loan. The fund paid 33,819.894047 USDC (~$33.8K) to the PeakReward router, which split it between the attacker's referrer and its upline. The attacker retained net proceeds of approximately 15,219 USDC plus ~1.07 ETH after gas and swaps. SlowMist's analysis showed that a nextPhase() call had set cycle 19's snapshot to the current block, allowing the freshly minted referral tokens to count toward commission weight before the withdrawal burned them — giving the attacker's referrer 99.9692% of the prior cycle's commission weight for a deposit that existed for less than one block.

This is a defensive account of a public incident, not a reconstruction of how to repeat it. The mechanism narrative comes from SlowMist's and Defimon's alert analyses and Olympix's post-mortem; we did not independently re-execute the transaction flow, and PeakDeFi had published no official statement at the time of writing.

TL;DR

  • Target: PeakDeFiFund (0x07cdb44fa1e7eceb638c12a3451a3dc9ce1400e4) on Ethereum — a DeFi asset-management fund whose deposit flow includes a referral commission payout, routed through the PeakReward router (0xf8bc0856472486c20dceeab81d5e5980d9fc302e).
  • Vector: a single-block flash loan of 50M USDC from Morpho, deposited through depositUSDC() with a self-registered referrer contract. The commission logic peakReferralRedeemCommissionForCycle paid out immediately based on the balance at redemption time, not on deposits that persisted across a cycle or block boundary.
  • Why the snapshot did not protect it: nextPhase() set cycle 19's snapshot to the current block, so referral tokens minted by the flash-loan deposit counted for commission weight in the same block they were later burned. The attacker's referrer captured 99.9692% of the cycle's commission weight.
  • Loss: the fund paid out 33,819.894047 USDC (~$33.8K) in commissions. Attacker net proceeds after gas, swaps, and loan repayment: ~15,219 USDC + ~1.07 ETH. No user principal was taken; the loss was the commission pool itself.
  • Detection: flagged the same day by DefimonAlerts and SlowMist_Team; confirmed by on-chain traces and Olympix's post-mortem. No official PeakDeFi response and no recovery bounty had been announced at cutoff.
  • What did not happen: depositors' principal in the fund was untouched. The attacker stole nothing but the reward pool — the fund's own accounting paid it out, correctly, according to rules that modeled the wrong thing.

One Transaction, Five Steps, Sixty-Two Seconds of Capital

Step Action
1 Flash-borrow 50,000,000 USDC from Morpho inside one transaction
2 Call depositUSDC() on PeakDeFiFund, depositing the full amount — the fund mints temporary SHARE and referral PRT tokens, and the attacker registers their own referrer contract (0xc7e138…ae61) as the upline
3 The commission logic peakReferralRedeemCommissionForCycle computes the referrer's share from the current balance at redemption time; because nextPhase() had set cycle 19's snapshot to this block, the freshly minted PRT counts for commission weight — the referrer captures 99.9692% of the cycle's weight
4 The fund pays 33,819.894047 USDC to the PeakReward router, which splits it between the referrer and its upline
5 Burn the temporary SHARE/PRT tokens, withdraw the full 50M USDC principal, repay the Morpho flash loan, swap part of the commission to ETH — net retention ~15,219 USDC + ~1.07 ETH

The elegance of the attack is that nothing was forced. The fund minted the right tokens, computed the right weights, and paid the right percentages. Every step followed the rules; the rules simply measured the wrong quantity — capital present instead of capital committed.

Root Cause: A Reward Model That Trusted Momentary Balance

1. The commission was paid on balance at redemption, not on time-weighted deposits

The fund's referral system exists to reward people who bring persistent capital in. But its implementation computed commissions from the referrer's balance at the moment of redemption. Any reward paid pro rata to a momentary balance is a standing invitation to flash loans: borrow the balance, claim the pro-rata share, return the balance. The gap between the incentive the protocol meant to create (persistent deposits) and the quantity it actually measured (instantaneous balance) is the entire vulnerability. This is the reward-logic cousin of the price-oracle problem: an oracle that reports the current price instead of a time-weighted one is exploitable the moment a single block can be manipulated — and here no manipulation was even needed, only scale. Like the POTS Money governance mint drain, the exploited path was a legitimate product feature — referral growth — whose measurement was disconnected from its intent.

2. nextPhase() made the snapshot contemporaneous — a cycle boundary that wasn't a boundary

Cycle snapshots are the standard defense for reward distribution: weight is fixed at phase transition, and deposits after the snapshot earn for the next cycle. But SlowMist's analysis showed that nextPhase() set cycle 19's snapshot to the current block, meaning a deposit made in that block was counted immediately for the cycle just being sealed. The boundary existed in name but not in time. A snapshot taken in the same block as the deposits it is supposed to exclude is not a snapshot; it is a live reading with extra steps. Any cycle-based reward system must enforce a minimum deposit age or take its snapshot strictly at a block boundary the depositor cannot reach — otherwise the snapshot is decoration.

3. The referrer identity was caller-controlled

The attacker registered their own contract as the referrer in the same call. The referral system had no mechanism distinguishing "a human who referred someone days ago" from "a contract the depositor just created." Combined with root causes 1 and 2, the upline hierarchy — referrer and upline splits through PeakReward — simply became two addresses the attacker owned. Referral systems accrue real marketing budgets, and their integrity depends on identity assumptions that most implementations never enforce. An unauthenticated self-registration path converts the entire referral tree into the attacker's own wallet graph.

4. Flash loans make "temporary scale" free

The 50M USDC was rented, not owned. The attacker needed no capital beyond gas — the Morpho flash loan provided the balance, the same transaction provided the claim, and the loan was repaid before the transaction ended. This is the defining constraint of modern DeFi design: any invariant that can be satisfied with borrowed capital inside one transaction must be assumed to be satisfiable by an attacker at zero cost. The SVT deflationary LP burn exploit used the same 185-round flash-loan pattern against price state; PeakDeFi's attacker used one round against reward state. The primitive is identical: rent the state, collect the payout, unwind.

Lessons for Builders and Auditors

Pay rewards on time-weighted participation, never on instantaneous balance. Any commission, rebate, or airdrop computed pro rata from a balance at claim time is flash-loanable by construction. Track cumulative participation (integrals, checkpointed weights, per-cycle accrued shares) and require deposits to persist across at least one full cycle boundary before they earn.

Make cycle boundaries real. A snapshot taken in the same block that deposits occur provides no protection. Enforce a minimum deposit age relative to the snapshot block, or transition phases in dedicated settlement transactions that no deposit path can reach.

Treat referral identity as an access-control surface. If anyone can register anything as a referrer — especially a contract — in the same transaction as the deposit, the referral tree is attacker-owned. Require referrers to be registered accounts with history, delay commission eligibility, or gate referrer registration separately from deposits.

Adversarially test every reward path with a flash-loan simulator. Our smart contract security checklist treats reward and commission logic as a first-class audit target: for each payout function, ask "what is the cheapest state that maximizes this payout within one transaction?" If the answer is "borrow 50M USDC," the design is wrong regardless of how correct the arithmetic is.

Small loss, large signal. ~$34K is a rounding error next to this year's nine-figure breaches, but the flaw class — rewards paid on momentary state — scales with TVL: the same bug in a fund holding $50M would have paid out proportionally. Reward-logic flaws are found cheaply and fixed cheaply; both the ApeChain yield state bug and this incident show that the accounting layer, not the tokens, is where modern drains live.

Key Addresses and Figures

Item Value
Chain / protocol Ethereum — PeakDeFi (PeakDeFiFund with referral commission system)
Attack date ~12:40 UTC, 4 December 2026 — single transaction, single block
Exploit transaction 0xf73b9bd1eadcbbe58695b1bf2ec84a27c360ef3bb94d58e30e6570e21f07aef7
Victim fund contract 0x07cdb44fa1e7eceb638c12a3451a3dc9ce1400e4
Attack contract 0x820bad10a48bb433b9fc06a94e32d6c1bb450c4d
Attacker EOA 0x72aee6fc4cd538001ad3d30d7b5df2ba6f5097d9
Attacker referrer contract 0xc7e138df7fbfae9c95548010a4775daa9523ae61
Vulnerable logic contract (SlowMist) 0x2fc252886160b638a235dc656ad69ae52efa5d5f
Reward router PeakReward 0xf8bc0856472486c20dceeab81d5e5980d9fc302e
Flash loan source / size Morpho — 50,000,000 USDC
Commission captured 33,819.894047 USDC (~$33.8K); referrer weight 99.9692% of cycle 19
Attacker net proceeds ~15,219 USDC + ~1.07 ETH after gas, swaps, and loan repayment
Detection DefimonAlerts and SlowMist_Team, same day (4 Dec); Olympix post-mortem
Official response None from PeakDeFi at cutoff; no recovery bounty announced

Sources

  • SlowMist_Team alert (4 Dec): full attack flow (Morpho 50M USDC flash loan → depositUSDC() with self-registered referrer → commission payout → burn → withdraw → repay); nextPhase() same-block snapshot of cycle 19; 99.9692% commission weight; vulnerable logic contract 0x2fc252…5d5f
  • DefimonAlerts alert (4 Dec): loss figure 33,819.894047 USDC; exploit tx 0xf73b9bd1…f07aef7; attacker EOA and referrer contract addresses
  • Olympix post-mortem: step-by-step commission-flow analysis; prevention framing (reward paths as flash-loan-testable surfaces)
  • Rektradar daily brief (5 Dec): consolidated timeline, explorer URLs, loss scoring, and cross-confirmation that no other monitored first-report drains occurred in the window
  • Secondary coverage (TechFlow, TokenPost, CryptoCoin.News, Gate): consistent figures and root-cause confirmation

Closing Thoughts

PeakDeFi lost $34K to a transaction in which the protocol did nothing wrong — by its own rules. It minted the right tokens, computed the right weights, paid the right split, and the flash loan walked away with the commission pool. The failure was upstream of the code: the reward model measured capital presence where its business logic required capital commitment, and a same-block snapshot turned the cycle boundary into a formality. Every rule was followed; the rules were wrong.

If your protocol pays commissions, rebates, or any reward computed from balances — or you want every payout path adversarially tested against one-transaction flash-loan strategies — talk to our team or review our audit pricing to have the reward model, not just the arithmetic, put under audit before a flash loan arbitrages the difference for you.

Cross-posted from PandaSecurity. PandaSecurity provides smart contract audits and Web3 security analysis; the original article is published on panda-security.xyz.

📰 Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.