[Paper Review] Smart Learning to Find Dumb Contracts (Extended Version)
DLVA is a deep learning-based vulnerability analyzer for Ethereum smart contracts that directly analyzes bytecode without requiring source code. It uses a novel Smart Contract to Vector (SC2V) embedding, a Sibling Detector for similar contracts, and a Core Classifier with neural networks to achieve 92.7% accuracy in detecting 29 vulnerabilities—outperforming Slither and 9 other tools with 0.2-second analysis time and a 10–1,000x speedup over formal methods.
We introduce the Deep Learning Vulnerability Analyzer (DLVA) for Ethereum smart contracts based on neural networks. We train DLVA to judge bytecode even though the supervising oracle can only judge source. DLVA's training algorithm is general: we extend a source code analysis to bytecode without any manual feature engineering, predefined patterns, or expert rules. DLVA's training algorithm is also robust: it overcame a 1.25% error rate mislabeled contracts, and--the student surpassing the teacher--found vulnerable contracts that Slither mislabeled. DLVA is much faster than other smart contract vulnerability detectors: DLVA checks contracts for 29 vulnerabilities in 0.2 seconds, a 10-1,000x speedup. DLVA has three key components. First, Smart Contract to Vector (SC2V) uses neural networks to map smart contract bytecode to a high-dimensional floating-point vector. We benchmark SC2V against 4 state-of-the-art graph neural networks and show that it improves model differentiation by 2.2%. Second, Sibling Detector (SD) classifies contracts when a target contract's vector is Euclidian-close to a labeled contract's vector in a training set; although only able to judge 55.7% of the contracts in our test set, it has a Slither-predictive accuracy of 97.4% with a false positive rate of only 0.1%. Third, Core Classifier (CC) uses neural networks to infer vulnerable contracts regardless of vector distance. We benchmark DLVA's CC with 10 ML techniques and show that the CC improves accuracy by 11.3%. Overall, DLVA predicts Slither's labels with an overall accuracy of 92.7% and associated false positive rate of 7.2%. Lastly, we benchmark DLVA against nine well-known smart contract analysis tools. Despite using much less analysis time, DLVA completed every query, leading the pack with an average accuracy of 99.7%, pleasingly balancing high true positive rates with low false positive rates.
Motivation & Objective
- To develop a vulnerability detection tool for Ethereum smart contracts that operates directly on bytecode, bypassing the need for source code.
- To extend the capabilities of source-code-only analyzers like Slither to work on bytecode using deep learning.
- To achieve high accuracy and speed in vulnerability detection, especially for contracts without available source code.
- To overcome limitations of traditional formal methods by reducing analysis time from minutes to under 0.2 seconds per contract.
Proposed method
- SC2V maps Ethereum bytecode to high-dimensional floating-point vectors using a hybrid of unsupervised and supervised neural networks trained on Slither-labeled data.
- The Sibling Detector classifies contracts based on Euclidean distance in the vector space, labeling those close to labeled contracts in the training set.
- The Core Classifier uses a separate neural network to classify contracts not handled by the Sibling Detector, trained on the same labeled dataset.
- DLVA combines SC2V, Sibling Detector, and Core Classifier into an ensemble model that leverages both similarity and deep learning for robust detection.
- The model is trained end-to-end using only Slither’s labels on source code, enabling transfer of knowledge from source to bytecode without manual feature engineering.
- DLVA is benchmarked against 10 off-the-shelf ML models and 9 existing tools, with performance measured on accuracy, false positive rate, and analysis time.
Experimental results
Research questions
- RQ1Can a deep learning model trained on source code labels accurately detect vulnerabilities in bytecode without access to source code?
- RQ2How does a neural network-based vectorization of bytecode compare to state-of-the-art graph neural networks in capturing vulnerability-relevant patterns?
- RQ3Can a hybrid approach combining vector similarity (Sibling Detector) and deep learning (Core Classifier) outperform standalone models in vulnerability detection?
- RQ4To what extent can a model trained on limited labeled source code generalize to a broader set of bytecode contracts, especially those without source code?
- RQ5Does a deep learning-based analyzer outperform traditional formal methods and existing static analysis tools in both speed and accuracy?
Key findings
- DLVA achieves an overall accuracy of 92.7% in predicting Slither’s labels for 29 vulnerabilities, with a false positive rate of 7.2%.
- The Core Classifier (CC) achieves 80.0% accuracy on the 'hard' 44.3% of contracts not handled by the Sibling Detector, outperforming the average of 10 off-the-shelf ML models by 11.3%.
- DLVA’s CC reduces the size of the error set (misclassified contracts) by an average of 36% compared to individual ML models and by 30% compared to a voting meta-competitor.
- DLVA completes all queries on 100% of contracts, achieving a 99.7% average accuracy across nine benchmark tools, with a 0.6% false positive rate and 0.2-second average analysis time.
- DLVA surpasses Slither in every metric except True Positive Rate (by 0.7%), despite Slither requiring source code and DLVA working solely on bytecode.
- The SC2V model improves model differentiation by 2.2% on average and 1.2% over the best baseline when compared to four state-of-the-art graph neural networks.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.