Exactly Protocol Lost $7.3M. The Code Worked. The Assumptions Didn’t.
Exactly Protocol Lost $7.3M. The Code Worked. The Assumptions Didn’t.
May 22, 2025
Exactly Protocol didn’t break because of complex logic. It broke because one contract took malicious input and treated it like gospel.
On August 18, 2023, a vulnerability in the DebtManager contract allowed attackers to drain over $7 million from users on Optimism. The exploit hinged on two things: a fake market contract and a forged permit.
Both were passed into the leverage() function.
Neither was validated.
The code executed. The money moved.
That’s all it took.
The attacker hijacked _msgSender, reentered through a fake Market contract, and rerouted user assets into a Uniswap pool they controlled. Then they leveraged a flaw in share accounting to degrade collateral and liquidate more.
The protocol didn’t panic. The transaction didn’t fail.
The bug wasn’t buried. It was baked into the assumptions.
The DebtManager was built to help users leverage and deleverage positions with a single transaction. But it made a critical mistake: it assumed the data coming in (the permit, the market address) would always be legitimate.
It wasn’t.
Here’s how the exploit unfolded:
A fake Market contract was passed into leverage().
A forged permit tricked the contract into acting on behalf of a victim.
The fake Market called back into crossDeleverage(), now operating as the victim.
Funds were withdrawn from real Markets and funneled into attacker-controlled pools.
Health Factors were manipulated. Positions were liquidated. The process repeated.
The exploit wasn’t clever.
It was precise.
It knew the contract would trust whatever it was handed.
The Exploit Path
Here’s how the attacker drained $7.3M without ever breaching the core protocol logic.
Malicious Market Injection. The attacker passed a fake Market address to leverage a contract they controlled.
Permit Hijack. They supplied a forged permit, allowing the contract to operate on behalf of another user (the victim).
Deposit Reentrancy. Inside the fake Market’s deposit() function, they executed a reentrancy attack, calling back into DebtManager.crossDeleverage().
Fund Drain via Real Market. The reentrant call targeted the real USDC market, draining funds from the victim and routing them into an attacker-controlled UniswapV3 LP.
Loop + Liquidate. The attacker manipulated victim Health Factors, used fixed pool borrow manipulation to trigger slight under-collateralization, then performed partial liquidations to extract more.
Copycat Phase. Roughly three hours later, a second attacker (tiffa.eth) replicated the process for an additional ~$260K in damage.
What Olympix Revealed and Why It Matters for Prevention
After the exploit, the DebtManager.sol contract was run through Olympix.
The results were immediate and damning.
While the attacker used just one unchecked parameter to drain $7.3 million, Olympix surfaced multiple critical issues throughout the contract.
Two detectors stood out:
🔥 Unverified Parameters in Low-Level Calls
Olympix flagged every instance where user-supplied inputs were passed into low-level external calls without validation. That included the exact vulnerability used in the exploit — a fake Market contract injected directly through leverage(). The detector didn’t just find the exploited path. It revealed a broader pattern: external inputs trusted without question.
🔥 Potential Reentrancy Detectors
Reentrancy warnings were triggered across the contract, including in crossDeleverage(), the same function used by the attacker’s fake Market to reenter and drain funds. These weren’t generic warnings. They pointed directly to logic capable of being hijacked mid-execution.
Olympix saw what the test suite didn’t:
Trust boundaries with no enforcement.
Execution paths with no protection.
And while this was a postmortem scan, it proved what could’ve been caught earlier.
With mutation testing in place, the exploit path could have been simulated:
Malicious Market injection
_msgSender impersonation
Reentrant callbacks from deposit()
Permit logic bypass
If the test suite passed those scenarios — and it would have — the system was vulnerable by design.
The fragility wasn’t buried. It just wasn’t tested.
Olympix revealed that reality after the fact. It should’ve been in the pipeline before.
The Frontend Mistake
Users didn’t just get drained from the contract. They got exposed by the interface.
Exactly’s web app used Permit, Permit2, and Approve to pre-authorize token usage. But the scope of those permissions was too broad. In many cases, users granted allowances beyond what was needed for a single action, enabling the attacker to spend more than anticipated.
This isn’t a backend-only problem. Frontend token approval logic must be explicit, minimal, and revocable. Otherwise, you’re opening backdoors for contracts to abuse privileges even without new approvals.
The Fallout
The exploit impacted 117 accounts, draining a total of $7.3 million from users. Losses weren’t evenly distributed; the top 10 victims accounted for 84% of the total damage, with one wallet alone losing nearly $1.8 million.
In response, Exactly Protocol paused the protocol within hours, following its emergency procedures. All Markets had their treasury fee set to 0% as a precaution while internal reviews were underway.
To rebuild trust and prevent recurrence, ABDK, one of the original auditing firms, was re-engaged for a fresh round of audits, this time including periphery contracts like DebtManager, which were previously out of scope.
The team moved quickly. But the damage was already done. And the exploit highlighted a deeper need: continuous, integration-level validation — not just code-level correctness.
What Builders Should Take From This
The Exactly exploit wasn’t an edge case, it was a reflection of how most DeFi systems are still built.
A contract that assumes safe inputs is an unsafe contract. The leverage() function trusted external parameters like permits and market addresses without validation. That trust enabled the exploit and cost users millions.
A test suite that doesn’t simulate malicious actors is incomplete. Exactly’s tests passed, but they didn’t challenge core assumptions. They never tested what happens when a fake contract is injected or when _msgSender is spoofed. That’s not coverage, it’s a false sense of security.
A UI that grants over-permissions is part of the threat model. The frontend approved token allowances too broadly, making it easier for attackers to act once the contract was compromised. Security doesn’t end at the contract — it includes every layer users interact with.
Security in DeFi isn’t about perfect code. It’s about creating systems that fail loudly, visibly, and early before money moves. Olympix is built to do exactly that. By surfacing blind spots through static analysis and mutation testing, it makes trust boundaries testable — and risk visible — before attackers find the gap.
Conclusion
Exactly didn’t fail because the code was complex — it failed because the system trusted hostile inputs without verifying them. A forged permit and a malicious market contract were all it took to impersonate users, drain real funds, and route them through attacker-controlled pools. The exploit path wasn’t hidden; it was built into the assumptions.
No test simulated the abuse. No audit caught the risk. The system executed as designed, and that design never accounted for adversarial conditions.
Olympix would have flagged the unverified external calls and reentrancy pathways. Mutation testing would have revealed that the contract couldn’t defend against forged identities or hostile market contracts. Both would have surfaced the fragility before it reached production.
They weren’t used, resulting in $7.3 million gone in minutes.
The rich text element allows you to create and format headings, paragraphs, blockquotes, images, and video all in one place instead of having to add and format them individually. Just double-click and easily create content.
A rich text element can be used with static or dynamic content. For static content, just drop it into any page and begin editing. For dynamic content, add a rich text field to any collection and then connect a rich text element to that field in the settings panel. Voila!
Headings, paragraphs, blockquotes, figures, images, and figure captions can all be styled after a class is added to the rich text element using the "When inside of" nested selector system.
Follow-up: Conduct a follow-up review to ensure that the remediation steps were effective and that the smart contract is now secure.
Follow-up: Conduct a follow-up review to ensure that the remediation steps were effective and that the smart contract is now secure.
In Brief
Remitano suffered a $2.7M loss due to a private key compromise.
GAMBL’s recommendation system was exploited.
DAppSocial lost $530K due to a logic vulnerability.
Rocketswap’s private keys were inadvertently deployed on the server.
Hacks
Hacks Analysis
Huobi | Amount Lost: $8M
On September 24th, the Huobi Global exploit on the Ethereum Mainnet resulted in a $8 million loss due to the compromise of private keys. The attacker executed the attack in a single transaction by sending 4,999 ETH to a malicious contract. The attacker then created a second malicious contract and transferred 1,001 ETH to this new contract. Huobi has since confirmed that they have identified the attacker and has extended an offer of a 5% white hat bounty reward if the funds are returned to the exchange.