I fed the vulnerable code patterns from five of the most devastating DeFi hacks into spectr-ai to see what an AI auditor would catch — and what it would miss. The results were both encouraging and humbling.
For each hack, I reconstructed the vulnerable code pattern (simplified for clarity), ran it through the AI analysis pipeline, and recorded the findings. No cherry-picking. Here is what happened.
1. The DAO — Reentrancy ($60M, June 2016)
What happened: The DAO's splitDAO function sent ETH to users before updating their balance. An attacker called the function recursively through a fallback function, draining funds repeatedly before the balance was set to zero.
The vulnerable pattern:
function withdraw(uint amount) public { require(balances[msg.sender] >= amount);
// ETH sent before state update (bool success, ) = msg.sender.call{value: amount}(""); require(success);
// State updated after external call balances[msg.sender] -= amount; }
Enter fullscreen mode
Exit fullscreen mode
What the AI found:…