DeFiScreener: Efficient DeFi Attack Pre-screening in Smart Contracts via Historical Case Matching
Summary
DeFiScreener is an automated pre-screening framework for DeFi smart contract attacks, designed to address the limited coverage of existing security tools by leveraging historical exploit cases. It processes target project source code, building Function Call Trees (FCTs) and generating semantic embeddings for each function using a large language model (LLM). A dual-level screening process matches function embeddings against an Attack Pattern Library and employs Attack Pattern Oriented Monte Carlo Tree Search (APO-MCTS) to efficiently explore FCTs for vulnerable call sequences. Evaluated on a dataset of 207 real-world DeFi attack incidents, totaling approximately \$2.97 billion in aggregate losses, DeFiScreener achieved a remarkable 98.55% recall and 84.30% precision. It also effectively recovered 14 of 17 real-world DeFi attacks in zero-day scenarios and screened 88 DeFi attacks overlooked by state-of-the-art tools.
Key takeaway
For smart contract auditors and security engineers evaluating new DeFi protocols, DeFiScreener offers a critical proactive defense mechanism. You should integrate this historical case-matching pre-screening into your audit workflow to efficiently identify known and structurally analogous vulnerabilities, especially given the "perilous temporal asymmetry" of exploit reuse. This approach significantly expands coverage beyond specialized detectors, reducing the risk of overlooked attacks and fortifying the rapidly evolving DeFi ecosystem.
Key insights
DeFiScreener proactively identifies smart contract vulnerabilities by matching new code against historical attack patterns using LLM embeddings.
Principles
- "Perilous temporal asymmetry" drives rapid exploit reuse on similar contracts.
- Pattern-agnostic screening enhances attack type coverage beyond specialized tools.
- LLMs capture function-level semantic intent for robust vulnerability matching.
Method
DeFiScreener models function semantics via LLMs, constructs Function Call Trees, then applies dual-level screening (function embedding matching, APO-MCTS for sequences), and finally interprets findings with an LLM.
In practice
- Use LLMs for semantic code embedding in vulnerability analysis.
- Build historical attack pattern libraries for proactive defense.
- Employ Monte Carlo Tree Search for efficient sequence exploration.
Topics
- DeFi Security
- Smart Contract Auditing
- Vulnerability Detection
- Large Language Models
- Monte Carlo Tree Search
- Attack Pattern Matching
Code references
Best for: CTO, VP of Engineering/Data, Director of AI/ML, AI Security Engineer, AI Scientist, Research Scientist
Related on AIssential
See Counsel's argued verdicts on the open AI decisions leaders are weighing →
Editorial summary, takeaway, and curation by AIssential. Original article published by cs.SE updates on arXiv.org.