Currently, smart contract vulnerabilities (SCVs) have emerged as a major factor threatening the transaction security of blockchain. Existing state-of-the-art methods rely on deep learning to mitigate this threat. They treat each input contract as an independent entity and feed it into a deep learning model to learn vulnerability patterns by fitting vulnerability labels. It is a pity that they disregard the correlation between contracts, failing to consider the commonalities between contracts of the same type and the differences among contracts of different types. As a result, the performance of these methods falls short of the desired level. To tackle this problem, we propose a novel Contrastive Learning Enhanced Automated Recognition Approach for Smart Contract Vulnerabilities, named Clear. In particular, Clear employs a contrastive learning (CL) model to capture the fine-grained correlation information among contracts and generates correlation labels based on the relationships between contracts to guide the training process of the CL model. Finally, it combines the correlation and the semantic information of the contract to detect SCVs. Through an empirical evaluation of a large-scale real-world dataset of over 40K smart contracts and compare 13 state-of-the-art baseline methods. We show that Clear achieves (1) optimal performance over all baseline methods; (2) 9.73%-39.99% higher F1-score than existing deep learning methods.
翻译:当前,智能合约漏洞已成为威胁区块链交易安全的主要因素。现有最先进方法依赖深度学习缓解这一威胁,将每个输入合约视为独立实体,通过拟合漏洞标签学习模式。遗憾的是,这些方法忽视了合约间的相关性,未能考虑同类合约的共性与异类合约的差异,导致性能未达预期。针对该问题,我们提出新型对比学习增强的智能合约漏洞自动识别方法Clear。具体而言,Clear采用对比学习模型捕捉合约间的细粒度关联信息,基于合约关系生成关联标签以指导模型训练,最终融合关联信息与合约语义检测漏洞。基于超40,000个智能合约的大规模真实数据集实证评估,并与13种最先进基线方法对比,结果表明Clear在所有基线方法中取得最优性能,其F1分数较现有深度学习方法提高9.73%-39.99%。