EasyFlow: keep ethereum away from overflow

Jianbo Gao, Han Liu, Chao Liu, Qingshan Li, Zhi Guan, Zhong Chen

TL;DR

EASYFLOW is a security tool designed to detect integer overflow vulnerabilities in Ethereum smart contracts by performing taint analysis at the Ethereum Virtual Machine (EVM) level. Unlike static analysis tools, it monitors live transactions to identify manifested bugs and proactively generates new transactions to trigger "potential" overflows that haven't been exploited yet.

What Problem Does This Paper Address?

In the world of Ethereum, "code is law," and that law often involves moving massive amounts of money. Integer overflows—where a calculation exceeds the maximum value a variable can hold (e.g., a uint256 wrapping back to zero)—are a devastating class of vulnerabilities. A famous example is the BecToken (BEC) attack in 2018, where an overflow allowed attackers to mint an astronomical number of tokens, effectively crashing the token's value to zero.

Detecting these bugs is difficult for two main reasons:

  1. Triggering is hard: Overflows often only occur with very specific, extreme input values that aren't captured by traditional testing.
  2. False Positives: Many developers use libraries like SafeMath to catch overflows. A naive detection tool might flag these "protected" overflows as bugs, creating "noise" for developers.

Methods

EASYFLOW introduces a dynamic tracking system built directly into an extended version of go-ethereum (the most popular Ethereum client). Its approach consists of three main pillars:

  • EVM-Level Taint Analysis: The tool "taints" (marks) data coming from transaction inputs. As the EVM executes instructions like ADD, MUL, or EXP, EASYFLOW tracks how these taints propagate. If a tainted value causes an arithmetic overflow, the tool takes notice.
  • Classification Engine: It categorizes contracts into four states:
  • Safe: No overflows detected.
  • Manifested: An overflow actually happened during the transaction.
  • Well-Protected: An overflow occurred, but the contract correctly caught it (e.g., using require or SafeMath).
  • Potential: An overflow didn't happen, but the tainted inputs could have caused one if the values were different.
  • Automatic Transaction Generation: For "potential" overflows, EASYFLOW doesn't just guess. It automatically constructs new test transactions using extreme values (like MAX_UINT256) to see if the vulnerability can actually be triggered in the current state of the blockchain.

Datasets

The researchers evaluated EASYFLOW using:

  • Ethereum Mainnet Transactions: They ran the tool against real-world data to find active vulnerabilities.
  • Known Vulnerable Contracts: They used famous cases like BecToken and SMT to validate that the tool could correctly identify known exploits.
  • Example Suite: A set of ten diverse smart contracts (including Gift_Card, RedEnvelope, and HBToken) was used to demonstrate how the tool handles different protection patterns and overflow types.

Key Insights and Ideas

  • Dynamic over Static: By analyzing the EVM execution trace rather than just the source code, EASYFLOW gains a "ground truth" view of how data moves, making it more accurate than tools that might struggle with complex Solidity logic.
  • State Matters: The tool recognizes that an overflow's exploitability depends on the StateDB (the current balances and storage values on the blockchain). You can't truly know if a contract is vulnerable without considering the environment it lives in.
  • Reducing Noise via Pattern Recognition: By explicitly identifying "Protection Patterns," the authors address a major pain point in security tooling: the "crying wolf" problem. By filtering out SafeMath hits, they ensure that the reports they generate are actually actionable.

Key Results

The preliminary evaluation on the Ethereum Mainnet yielded impressive results:

  • Detection Power: Out of the transactions analyzed, EASYFLOW found 465 manifested overflows and successfully triggered 3,871 potential overflows that were previously hidden.
  • Efficiency: For most contracts, the analysis finished in under 300ms. The runtime overhead increases linearly compared to a standard Ethereum node, making it practical for real-time monitoring.
  • Accuracy: It correctly identified that contracts like BecToken were unprotected, while others like Lizun were "well-protected" despite having arithmetic that could technically overflow.

Limitations and Future Work

While EASYFLOW is highly effective for integer overflows, the authors note some areas for growth:

  • Scope: The current implementation is specialized for overflows. The authors plan to generalize the taint analysis technique to detect other types of vulnerabilities, such as re-entrancy or unauthorized access.
  • Triggering Logic: The current transaction generation uses a "straightforward" algorithm (trying 0 and Max values). Integrating more sophisticated fuzzing or symbolic execution could help find even more edge-case vulnerabilities.
  • Deployment: The tool was presented as a web service and command-line tool; future work involves making it more accessible for diverse blockchain settings.

Summary updated

Abstract

While Ethereum smart contracts enabled a wide range of blockchain applications, they are extremely vulnerable to different forms of security attacks. Due to the fact that transactions to smart contracts commonly involve cryptocurrency transfer, any successful attacks can lead to money loss or even financial disorder. In this paper, we focus on the overflow attacks in Ethereum, mainly because they widely rooted in many smart contracts and comparatively easy to exploit. We have developed EASYFLOW, an overflow detector at Ethereum Virtual Machine level. The key insight behind EASYFLOW is a taint analysis based tracking technique to analyze the propagation of involved taints. Specifically, EASYFLOW can not only divide smart contracts into safe contracts, manifested overflows, well-protected overflows and potential overflows, but also automatically generate transactions to trigger potential overflows. In our preliminary evaluation, EASYFLOW managed to find potentially vulnerable Ethereum contracts with little runtime overhead. A demo video of EASYFLOW is at https://youtu.be/QbUJkQI0L6o.
BibTeX
@inproceedings{gao2019easyflow,
  author = {Jianbo Gao and Han Liu and Chao Liu and Qingshan Li and Zhi Guan and Zhong Chen},
  title = {{EasyFlow: keep ethereum away from overflow}},
  booktitle = {ICSE (Companion Volume)},
  year = {2019},
  url = {https://openreview.net/forum?id=cqlCUxojnz},
}

Loading related content...

Figure