AI code failure: Stop idolizing AI; Claude's coding caused a DeFi platform to lose $1.78 million

DEFI-1,35%
OP-5,86%
WELL-5,31%
LINK-3,95%

Author: ChainAnalysis Crypto Laboratory

1. Background: Oracle Configuration Hidden Risks

The incident began with a governance proposal (MIP-X43), which enabled a new Chainlink oracle configuration on Moonwell markets on Base and Optimism networks. (Note: An oracle is a tool that fetches real-time data before submitting it to the blockchain.)

In lending protocols like Moonwell, users deposit assets such as cbETH as collateral to borrow other tokens. If the market drops and the collateral value falls below the debt, automated bots will liquidate the position (the user’s total funds), repay the debt, and seize the collateral at a discount.

Before the event, Moonwell’s cbETH market had large funds and high collateralization, but the oracle testing was insufficient, missing a multiplication step, which caused severe price errors and sharply increased risk.

2. Analysis: AI Mistakenly Wrote a Piece of Code

This incident is the industry’s first on-chain security breach caused by Vibe Coding (AI-assisted coding), centered on a low-level yet fatal oracle configuration bug.

1. Cause of the vulnerability

The root cause was an incorrect valuation of cbETH assets by the oracle. cbETH is a highly liquid staked token whose value includes accumulated staking rewards. Normally, 1 cbETH can be exchanged for about 1.12 ETH.

Therefore, the correct USD price calculation should be:

cbETH USD Price = (cbETH to ETH exchange rate) × (ETH USD price)

For example: If 1 cbETH ≈ 1.12 ETH, and 1 ETH ≈ $2200, then the true value of 1 cbETH should be about $2464.

However, in the code generated by AI tool Claude, due to lack of proper logical validation, the code directly pointed the cbETH price source to cbETHETH_ORACLE. This data source only provides the exchange rate (1.12), not the USD price of ETH.

This omission of the critical multiplication step caused the program to treat the “exchange rate” as the “USD value.” An asset worth over $2400 was incorrectly marked as $1.12, undervaluing it by over 99.9%, with a price difference of nearly 2000 times.

2. Attack restitution

The severe underestimation of assets led the system to mistakenly consider many normal users’ collateral positions as “under-collateralized.” The exploitation process was highly efficient and automated:

On February 16, 2026, at 2:01 AM UTC+8: MIP-X43 proposal was executed, activating the misconfigured cbETH oracle on Base.

On-chain liquidation bots monitored profit opportunities, quickly borrowing small amounts of USDC via flash loans at minimal cost to repay debt (since the system believed 1 cbETH was worth just over $1), thus gaining liquidation rights.

After seizing high-value cbETH collateral, the bots immediately sold it on DEX at market prices for profit. Multiple bots cycled rapidly within minutes, collectively seizing 1,096.317 cbETH.

This attack was not a premeditated hack but the result of liquidation bots executing absurd code. Since there was no traditional “thief,” where did the $1.78 million vanish to? The answer depends on the subsequent fund flow.

3. Fund Flow: No Hacker, Only Arbitrageurs

Since there was no traditional hacker, where did the $1.78 million evaporate to?

Where did the money go?

Answer: To the behind-the-scenes arbitrageurs deploying the liquidation bots.

These bots are not spontaneous; they are written and deployed on-chain by real programmers or quant teams (MEV searchers). When the system, due to AI missing a multiplication sign, “legally undervalued” assets worth over $2400 as just over $1, the hunting bots instantly seized the opportunity.

They automatically repaid the seemingly small debt, snatched high-value collateral, and resold it at market prices. Ultimately, the nearly $1.78 million profit flowed into the personal crypto wallets of the bot owners. They exploited the system bug to legally and compliantly withdraw millions.

In this incident, 11 assets suffered losses, with specific amounts as follows:

After the incident, Moonwell’s team quickly paused lending and liquidation functions, and rapidly submitted a new proposal to reconfigure the oracle parameters. To restore trust, the protocol used treasury funds to cover the $1.78 million bad debt and fully compensated the affected users.

4. AI in Charge: Efficiency or Security Risk?

After the event, most opinions blamed “Claude wrote the fatal bug,” but objectively, blaming AI for the $1.78 million loss is somewhat unfair.

This bug was nothing complex—just a simple configuration error: missing a multiplication.

Honestly, even a human programmer could make such a mistake.

The real issue was that the project’s review process was essentially nonexistent. Before launch, no one manually checked whether the “price logic” was reasonable. If you give correct instructions, AI can help you write clear, error-proof test cases.

The biggest lesson from this incident is not “AI can’t write code,” but that humans, in pursuit of speed, neglected the most critical review step.

No matter how good or fast AI is, it has no concept of real money and cannot be held responsible. AI can never replace humans; it’s just a powerful tool. Humans must use AI, not let AI call the shots.

5. Final Words: When AI Writes Code, Humans Must Stay Vigilant

The Moonwell incident is not complicated—no top hackers, no advanced exploits, not even complex attacks. It was simply an AI coding error, overlooked by humans.

But in the blockchain world, a single code oversight can mean millions of dollars in real assets. In DeFi, code is law; once written on-chain, it’s executed without hesitation. As more projects rely on “Vibe Coding,” code audits and risk controls should become the last line of defense.

Technology can become more automated, but security must never be automated.

Disclaimer: The information on this page may come from third parties and does not represent the views or opinions of Gate. The content displayed on this page is for reference only and does not constitute any financial, investment, or legal advice. Gate does not guarantee the accuracy or completeness of the information and shall not be liable for any losses arising from the use of this information. Virtual asset investments carry high risks and are subject to significant price volatility. You may lose all of your invested principal. Please fully understand the relevant risks and make prudent decisions based on your own financial situation and risk tolerance. For details, please refer to Disclaimer.

Related Articles

Kelp DAO Hacked for $292 Million: LayerZero Cross-Chain Bridge Attacked with Forged Messages, Biggest DeFi Event of 2026

Kelp DAO was hacked on April 19. The attacker used LayerZero’s cross-chain bridge to forge messages, releasing 116,500 rsETH, for losses of about $292 million, making it the largest DeFi event of 2026. This incident highlights security vulnerabilities in cross-chain bridges, triggering a sharp market reaction; related protocols also urgently froze assets, facing further liquidation risk.

ChainNewsAbmedia1h ago

Kelp DAO Cross-Chain Bridge Exploited, 116,500 rsETH Worth $292M Stolen

Kelp DAO's cross-chain bridge was exploited, resulting in the theft of 116,500 rsETH worth about $292 million, the largest DeFi attack of 2026. Multiple protocols have taken protective measures, and Kelp DAO is investigating the incident with experts.

GateNews2h ago

KelpDAO's Liquid Staking Token Faces Over $100M Exploitation

Gate News message, according to onchain data, KelpDAO's liquid staking token has been exploited for over $100 million. The incident involves KelpDAO's liquid staking token infrastructure.

GateNews7h ago

Chainalysis Details 'Shadow Crypto Economy' Exposure as Grinex Suspends Operations

Grinex’s shutdown is intensifying scrutiny of crypto laundering tactics, as fund movements suggest behavior inconsistent with typical enforcement actions. Chainalysis analysis highlights patterns that raise questions about whether the activity aligns with a conventional external hack or

Coinpedia9h ago

Rhea Finance Suffers a $18.4 Million Loss After an Oracle Attack: ZachXBT Warns, Tether Freezes 4.34 Million USDT, and the Attacker Returns Some Funds

Rhea Finance suffered an oracle manipulation attack on the NEAR Protocol, with losses reaching $18.4 million—double the initial estimate. The attacker manipulated the pricing of a fake token, causing collateral valuations to be incorrect. Tether froze about $4.34 million in USDT; the attacker returned roughly $3.5 million. To date, more than $7.8 million has been recovered, highlighting the importance of oracle security.

ChainNewsAbmedia17h ago

eth.limo DNS Under Attack, Vitalik Urges Users to Pause Access and Switch to IPFS

Vitalik Buterin warned on April 18 about an attack on the DNS registrar for eth.limo, urging users to avoid accessing vitalik.eth.limo and related pages. He recommended using IPFS as an alternative until the issue is resolved.

GateNews18h ago
Comment
0/400
No comments