A large-scale empirical study of low-level function use in Ethereum smart contracts and automated replacement

被引:4
|
作者
Xi, Rui [1 ]
Pattabiraman, Karthik [1 ]
机构
[1] Univ British Columbia UBC, Dept Elect & Comp Engn, Rm 4048,Fred Kaiser Bldg,2332 Main Mall, Vancouver, BC V6T 1Z4, Canada
来源
SOFTWARE-PRACTICE & EXPERIENCE | 2023年 / 53卷 / 03期
基金
加拿大自然科学与工程研究理事会;
关键词
Ethereum blockchain; smart contract; source-to-source transformation; static analysis;
D O I
10.1002/spe.3163
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
The Ethereum blockchain stores and executes complex logic via smart contracts written in Solidity, a high-level programming language. The Solidity language (in its early versions) provides features to exercise fine-grained control over smart contracts, whose usage is discouraged by later-released Solidity documentation, but nonetheless supported in later versions for backward compatibility. We define these features as low-level functions. However, the high-volume of transactions and the improper use of low-level functions lead to security exploits with heavy financial loss. Consequently, the documentation suggests secure alternatives to the use of low-level functions. In this article, we first perform an empirical study on the use of low-level functions in Ethereum smart contracts. We study a smart contract dataset consisting of over 2,100,000 real-world smart contracts. We find that low-level functions are widely used and that the majority of these uses are gratuitous. We then propose GoHigh, a source-to-source transformation tool to eliminate low-level function-related vulnerabilities, by replacing low-level functions with secure alternatives. Our experimental evaluation on the dataset shows that GoHigh successfully replaces all low-level functions with 4.9% fewer compiler warnings. Further, no unintended side-effects are introduced in 80% of the contracts, and the remaining 20% are not verifiable due to their external dependency. GoHigh saves more than 5% of the gas cost of the contract. Finally, GoHigh takes 7 s on average per contract.
引用
收藏
页码:631 / 664
页数:34
相关论文
共 44 条
  • [1] When They Go Low: Automated Replacement of Low-level Functions in Ethereum Smart Contracts
    Xi, Rui
    Pattabiraman, Karthik
    2022 IEEE INTERNATIONAL CONFERENCE ON SOFTWARE ANALYSIS, EVOLUTION AND REENGINEERING (SANER 2022), 2022, : 995 - 1005
  • [2] Large-Scale Empirical Study of Inline Assembly on 7.6 Million Ethereum Smart Contracts
    Liao, Zhou
    Song, Shuwei
    Zhu, Hang
    Luo, Xiapu
    He, Zheyuan
    Jiang, Renkai
    Chen, Ting
    Chen, Jiachi
    Zhang, Tao
    Zhang, Xiaosong
    IEEE TRANSACTIONS ON SOFTWARE ENGINEERING, 2023, 49 (02) : 777 - 801
  • [3] Large-Scale Study of Vulnerability Scanners for Ethereum Smart Contracts
    Sendner, Christoph
    Petzi, Lukas
    Stang, Jasper
    Dmitrienko, Alexandra
    45TH IEEE SYMPOSIUM ON SECURITY AND PRIVACY, SP 2024, 2024, : 2273 - 2290
  • [4] A Large-Scale Empirical Study on Control Flow Identification of Smart Contracts
    Chen, Ting
    Li, Zihao
    Zhang, Yufei
    Luo, Xiapu
    Wang, Ting
    Hu, Teng
    Xiao, Xiuzhuo
    Wang, Dong
    Huang, Jin
    Zhang, Xiaosong
    2019 13TH ACM/IEEE INTERNATIONAL SYMPOSIUM ON EMPIRICAL SOFTWARE ENGINEERING AND MEASUREMENT (ESEM 2019), 2019, : 106 - 116
  • [5] Self-Admitted Technical Debt in Ethereum Smart Contracts: A Large-Scale Exploratory Study
    Ebrahimi, Amir Mohammad
    Oliva, Gustavo A.
    Hassan, Ahmed E.
    IEEE TRANSACTIONS ON SOFTWARE ENGINEERING, 2023, 49 (09) : 4304 - 4323
  • [6] Finding Unchecked Low-Level Calls with Zero False Positives and Negatives in Ethereum Smart Contracts
    Gill, Puneet
    Ray, Indrani
    Takami, Alireza Lotfi
    Tripunitara, Mahesh
    FOUNDATIONS AND PRACTICE OF SECURITY, FPS 2022, 2023, 13877 : 305 - 321
  • [7] Performances of Low-level Audio Classifiers for Large-scale Music Similarity
    Osmalskyj, Julien
    Van Droogenbroeck, Marc
    Embrechts, Jean-Jacques
    21ST INTERNATIONAL CONFERENCE ON SYSTEMS, SIGNALS AND IMAGE PROCESSING (IWSSIP 2014), 2014, : 91 - 94
  • [8] The South America Low-Level Jet: form, variability and large-scale forcings
    Jones, Charles
    Mu, Ye
    Carvalho, Leila M. V.
    Ding, Qinghua
    NPJ CLIMATE AND ATMOSPHERIC SCIENCE, 2023, 6 (01)
  • [9] The South America Low-Level Jet: form, variability and large-scale forcings
    Charles Jones
    Ye Mu
    Leila M. V. Carvalho
    Qinghua Ding
    npj Climate and Atmospheric Science, 6
  • [10] Attributing the behavior of low-level clouds in large-scale models to subgrid-scale parameterizations
    Neggers, R. A. J.
    JOURNAL OF ADVANCES IN MODELING EARTH SYSTEMS, 2015, 7 (04) : 2029 - 2043