Hunting in the Dark Forest: A Pre-trained Model for On-chain Attack Transaction Detection in Web3
In recent years, a large number of on-chain attacks have emerged in the blockchain empowered Web3 ecosystem. In the year of 2023 alone, on-chain attacks have caused losses of over 585 million. Attackers use blockchain transactions to carry out on-chain attacks, for example, exploiting vulnerabilities or business logic flaws in Web3 applications. A wealth of efforts have been devoted to detecting on-chain attack transactions through expert patterns and machine learning techniques. However, in this ever-evolving ecosystem, the performance of current methods is limited in detecting new on-chain attacks, due to the obsoleting of attack recognition patterns or the reliance on on-chain attack samples. In this paper, we propose a universal approach for detecting on-chain attacks even when there are few or even no new on-chain attack samples. Specifically, an in-depth analysis of the transaction characteristics is conducted, and we propose a new insight to train a generic attack transaction detecting model, i.e., transaction reconstruction. Particularly, to overcome the over-fitting in the transaction reconstruction task, we use the web-scale function comments related to transactions as supervision information, rather than expert-confirmed labels. Experimental results demonstrate that the proposed approach surpasses the supervised state-of-the-art by 13% in AUC, with just 30 known on-chain attack samples. Moreover, without any known attack samples, our method can still detect new on-chain attacks in the wild (with a precision of 61.83%). Among attacks detected in the wild, we confirm 1,692 address poisoning attacks, a new type of on-chain attack targeting token holders. Our code is available at: https://github.com/wuzhy1ng/attack_trans_detection_www25.
Authors
- Zibin Zheng (ORCID: https://orcid.org/0000-0001-7872-7718)
- Jiajing Wu (ORCID: https://orcid.org/0000-0001-5155-8547)
- Zhiying Wu (ORCID: https://orcid.org/0000-0003-4633-0008)
- Weiqiang Wang (ORCID: https://orcid.org/0000-0002-6159-619X)
- Hui Zhang (ORCID: https://orcid.org/0009-0008-8717-9184)
Institutions
- Sun Yat-sen University (CN)
Publication Details
- Published
- 2025-04-22
- DOI
- https://doi.org/10.1145/3696410.3714928
- Primary Topic
- Network Security and Intrusion Detection
- Type
- article
- Field-Weighted Citation Impact
- 0.00
Funders
- National Natural Science Foundation of China
- Natural Science Foundation of Guangdong Province
- Fundamental Research Funds for the Central Universities