Abstract
Smart contracts govern billions of dollars in decentralized finance (DeFi), yet automated vulnerability detection remains challenging because many vulnerabilities are tightly coupled with project-specific business logic. We observe that recurring vulnerabilities across diverse DeFi business models often share the same underlying economic mechanisms, which we term DeFi semantics, and that capturing these shared abstractions can enable more systematic auditing. Building on this insight, we propose Knowdit, a knowledge-driven, agentic framework for smart contract vulnerability detection. Knowdit first constructs an auditing knowledge graph from historical human audit reports, linking fine-grained DeFi semantics with recurring vulnerability patterns. Given a new project, a multi-agent framework leverages this knowledge through an iterative loop of specification generation, harness synthesis, fuzz execution, and finding reflection, driven by a shared working memory for continuous refinement. We evaluate Knowdit on 12 recent Code4rena projects with 75 ground-truth vulnerabilities. Knowdit detects all 14 high-severity and 77\% of medium-severity vulnerabilities with only 2 false positives, significantly outperforming all baselines. Applied to six real-world projects, Knowdit further discovers 12 high- and 10 medium-severity previously unknown vulnerabilities, proving its outstanding performance.
Abstract (translated)
智能合约管理着去中心化金融(DeFi)中数十亿美元的资金,然而自动化漏洞检测仍极具挑战性,因为许多漏洞与项目特定的业务逻辑紧密耦合。我们观察到,不同DeFi业务模型中反复出现的漏洞往往共享相同的基础经济机制,我们将其称为DeFi语义,且捕捉这些共享抽象概念能够实现更系统化的审计。基于这一洞察,我们提出了Knowdit——一个知识驱动的智能体框架,用于智能合约漏洞检测。Knowdit首先从历史人工审计报告中构建审计知识图谱,将细粒度的DeFi语义与反复出现的漏洞模式相关联。对于新项目,多智能体框架通过共享工作记忆驱动的迭代循环——包括规范生成、harness合成、模糊测试执行与发现反思——来利用这些知识进行持续优化。我们在12个近期Code4rena项目(含75个真实漏洞)上评估Knowdit,其检测到全部14个高危漏洞及77%的中危漏洞,仅产生2个误报,显著优于所有基线方法。应用于六个真实项目时,Knowdit进一步发现了12个高危和10个中危的先前未知漏洞,证明了其卓越性能。
URL
https://arxiv.org/abs/2603.26270