Graph-based RAG for Vulnerability Detection
Research Progress
Machine auditable bugs
• Bugs that can be detected automatically using static or dynamic
analysis tools
▪ Pattern-based detection
▪ No complex business logic reasoning required
• Examples
▪ Reentrancy
▪ Integer Overflow and Underflow
▪ Mishandled Exception
▪ Unprotected SELFDESTRUCT
Machine unauditable bugs
• Bugs that require human reasoning and understanding of
business logic.
▪ Complex control flow
▪ Cross-function dependencies
▪ Business logic vulnerabilities
• Examples
▪ Price oracle manipulation
▪ Access Control Vulnerability
▪ Business Logic Vulnerability
▪ Atomicity Violation
Relevant papers
• Review for Vulnerability [Link]
Research gaps
• Most tools detect common bugs but struggle with exploitable
bugs (e.g., price oracle manipulation)
▪ Oyente, ReDefender, CONFUZZIUS, ByteEye, PropertyGPT, SCALM
• Some tools target exploitable bugs but only use a small dataset
for evaluation
▪ DeepDesc (210 contracts are affected by exploitable bugs)
• Some tools could detect bugs in smart contracts but don’t provide
the explanation
▪ Oyente, ReDefender, CONFUZZIUS, ByteEye, PropertyGPT, DeepDesc,
SmartInv
Research questions
• To what extent can graph-based or context-aware approaches
detect complex exploit scenarios in smart contracts?
• How does the performance of vulnerability detection tools change
when evaluated on large-scale real-world smart contract
datasets?
• How can detection tools generate meaningful explanations for
detected smart contract vulnerabilities?
Our proposed methodology
• Collect the dataset including machine unaditable bugs
• Convert their call graphs into embeddings using Node2Vec,
Graph2Vec, .etc
• Compute the similarity between malicious call graphs and the call
graph of the given contract
• Using RAG to get relevant call graphs and them fuse them and the
given contract into the input of a LLM ⇒ Use the LLM to find the
type of vulnerability and lines of code containing vulnerabilities