Data Flow-driven and Attention Mechanism-enabled Smart Contract Vulnerability Detection for Secure and Green Blockchain-based Service Networks
Abstract
In recent years, applying smart contract to Blockchain-based Service Networks (BSNs) has been considered as one of the most promising solution to boost the integration and adoption of Blockchain in big businesses. However, smart contract are especially vulnerable to attack due to poor coding. Although many existing vulnerability detection tools are restricted by rigorous rules that are defined by the experts in advance, these tools are observed to have a high false positive rate in practice. Thus we propose a vulnerability detection framework for smart contract based on the attention mechanism and data flow. The code of smart contract is transformed to a data flow according to the abstract syntax tree that is built from the code. The data flow we built with smart contract code could represent the relationships of code semantic logic. Source code, data flow, and the tags of smart contract code are used as datasets to mask processing. Then, we construct a bidirectional multi-layer transformer architecture based on the attention mechanism to train our dataset. After training, we can get the label of whether there is a vulnerability in the final smart contract. Finally, the model we proposed reaches state-of-the-art results in the practical experiments of smart contract vulnerability detection with 92.54%, 81.79%, and 86.84% in the results Accuracy, Recall, and F1score, respectively.
Community
0 commentsNo discussion yet
Be the first to share a question or observation.