Skip to main content
QUICK REVIEW

[Paper Review] Towards Safer Smart Contracts: A Sequence Learning Approach to Detecting Security Threats

Wesley Joon-Wie Tann, Xing Han|arXiv (Cornell University)|Nov 16, 2018
Advanced Malware Detection TechniquesComputer Science46 references74 citations
TL;DR

The paper presents an LSTM-based approach to detect smart contract security threats at the Ethereum opcode level, achieving near 99% test accuracy and outperforming a symbolic tool (Maian) on 620k contracts.

ABSTRACT

Symbolic analysis of security exploits in smart contracts has demonstrated to be valuable for analyzing predefined vulnerability properties. While some symbolic tools perform complex analysis steps, they require a predetermined invocation depth to search vulnerable execution paths, and the search time increases with depth. The number of contracts on blockchains like Ethereum has increased 176 fold since December 2015. If these symbolic tools fail to analyze the increasingly large number of contracts in time, entire classes of exploits could cause irrevocable damage. In this paper, we aim to have safer smart contracts against emerging threats. We propose the approach of sequential learning of smart contract weaknesses using machine learning---long-short term memory (LSTM)---that allows us to be able to detect new attack trends relatively quickly, leading to safer smart contracts. Our experimental studies on 620,000 smart contracts prove that our model can easily scale to analyze a massive amount of contracts; that is, the LSTM maintains near constant analysis time as contracts increase in complexity. In addition, our approach achieves $99\%$ test accuracy and correctly analyzes contracts that were false positive (FP) errors made by a symbolic tool.

Motivation & Objective

  • Motivate safer smart contracts amid rising deployed contracts and irreversible exploits on Ethereum.
  • Propose a machine learning alternative to symbolic analysis for rapid threat detection.
  • Evaluate scalability and detection accuracy on a large Ethereum contract dataset.
  • Show that the LSTM can match or surpass existing symbolic tools in vulnerability detection.

Proposed method

  • Model a two-class threat detection problem using LSTM on Ethereum opcode sequences.
  • Represent opcodes with embeddings to capture semantic relationships between instructions.
  • Train and evaluate on a large dataset (620,000 contracts) with balanced classes via SMOTE and resampling.
  • Use binary cross-entropy loss for binary classification and an embedding-based input representation of opcode sequences.
  • Compare performance against the Maian symbolic-analysis tool and report metrics such as accuracy, F1, and FP-recovery.

Experimental results

Research questions

  • RQ1Can an LSTM model detect security threats in Ethereum smart contracts from opcode sequences?
  • RQ2How does the LSTM-based method compare to symbolic analysis tools like Maian in terms of accuracy and scalability?
  • RQ3Can the model recover false positives identified by symbolic tools and detect new threat patterns over time?
  • RQ4How scalable is the approach when analyzing large volumes of contracts as dataset size grows?
  • RQ5What role does opcode embedding play in capturing semantic relationships relevant to vulnerabilities?

Key findings

  • The LSTM model achieves around 99% test accuracy on the evaluation set.
  • It attains an F1 score of approximately 86% on vulnerability detection.
  • The approach detects up to about 92.86% of challenging contracts that Maian labeled as false positives.
  • The LSTM runs with near-constant analysis time as contract complexity grows, enabling scalable analysis of large contract populations.
  • The LSTM can serve as a competitive alternative to symbolic analysis tools for safer smart contracts.

Better researchstarts right now

From reading papers to final review, dramatically reduce your research time.

No credit card · Free plan available

This review was created by AI and reviewed by human editors.