SimSecLLM: A Similarity-Grounded LLM Framework for Smart Contract Auditing
Abstract
With the growth of Ethereum, smart contracts have become a core component of blockchain platforms. However, the widespread adoption of smart contracts raises security concerns, as their immutability and interaction with digital assets make them attractive targets for attackers. Existing detection methods often struggle to address emerging, complex attack vectors and to accurately identify specific vulnerability types. We present SimSecLLM, an auditing framework grounded in code similarity that anchors LLM reasoning to vetted secure code snippets. The framework first builds a reference corpus containing more than 35,000 distinct security-vetted functions collected from 150 widely used libraries. For each smart contract under audit, it analyzes internal functions and their call relationships, establishes a detection order via topological sorting, and incorporates callee context. It then retrieves the closest secure exemplar from the curated reference corpus, extracts code-level modifications through comparison, and leverages a fine-tuned LLM in the detection stage to reason over these changes in order to assess whether they introduce vulnerabilities and to identify their potential types. SimSecLLM was evaluated on the DAppSCAN-source dataset with 3,527 function-level samples across seven types of vulnerabilities, demonstrating superior performance over existing methods with an accuracy of 93.1 % and an F1score of 87.1 %. A case study on the Redacted Cartel vulnerability illustrates that similarity-guided analysis effectively reveals security-critical code modifications, thereby supporting the identification of vulnerability root causes.
Community
0 commentsNo discussion yet
Be the first to share a question or observation.