kirancodes.me
To Proof Maintenance & Beyond!

LookAhead: Preventing DeFi Attacks via Unveiling Adversarial Contracts

Shoupeng Ren, Lipeng He, Tianyu Tu, Di Wu, Jian Liu, Kui Ren, Chun Chen

Abstract

The exploitation of smart contract vulnerabilities in Decentralized Finance (DeFi) has resulted in financial losses exceeding 3 billion US dollars. Existing defense mechanisms primarily focus on detecting and reacting to adversarial transactions executed by attackers that target victim contracts. However, with the emergence of private transaction pools where transactions are sent directly to miners without first appearing in public mempools, current detection tools face significant challenges in identifying attack activities effectively. Based on the fact that most attack logic rely on deploying intermediate contracts as supporting components to the exploitation of victim contracts, novel detection methods have been proposed that focus on identifying these adversarial contracts instead of adversarial transactions. However, previous state-of-the-art approaches in this direction have failed to produce results satisfactory enough for real-world deployment. In this paper, we propose L ook A head , a new framework for detecting DeFi attacks via unveiling adversarial contracts. L ook A head leverages common attack patterns, code semantics and intrinsic characteristics found in adversarial contracts to train Machine Learning (ML)-based classifiers that can effectively distinguish adversarial contracts from benign ones and make timely predictions of different types of potential attacks. Experiments on our labeled datasets show that L ook A head achieves an F1-score of 0.8966, which represents an improvement of over 44.4% compared to the previous state-of-the-art solution, with a False Positive Rate at only 0.16%.

BibTeX
@article{Ren-al:FSE25,
  author    = {Shoupeng Ren and
               Lipeng He and
               Tianyu Tu and
               Di Wu and
               Jian Liu and
               Kui Ren and
               Chun Chen},
  title     = {{LookAhead:} Preventing {DeFi} Attacks via Unveiling Adversarial Contracts},
  journal   = {{PACMSE}},
  volume    = {2},
  number    = {{FSE}},
  pages     = {1847--1869},
  year      = {2025},
}

Related papers