OSEL: boosting vulnerability detection with opcode slicing-enhanced feature learning
摘要
With the widespread adoption of blockchain technology, smart contracts have been widely applied in various fields, particularly on platforms like Ethereum. Consequently, security vulnerabilities in smart contracts pose a significant threat to the reliability of blockchain-based systems and have resulted in significant economic losses. Due to the immutable nature of blockchain, smart contracts cannot be modified once deployed, rendering pre-deployment vulnerability detection critically important. Traditional detection tools leverage program analysis techniques to derive vulnerability patterns but suffer from inefficient and limited scalability. Although deep learning-based approaches have shown promising results, inherent information redundancy in raw smart contracts hinders the model’s ability to fully learn vulnerability-revealing features. To address this, we propose OSEL, an enhanced deep learning-based vulnerability detection approach. OSEL focuses on human-readable opcode disassembled from contract bytecode. Leveraging domain knowledge, it performs opcode sequence slicing while preserving semantic completeness. OSEL encodes the extracted opcode slice sets into vectors suitable for deep learning models, followed by an optimized weighting scheme to differentiate the detection contributions of individual opcodes. Finally, OSEL employs a hybrid detection model designed to learn vulnerability-revealing features from both consecutive opcodes and contract contextual information. Experimental evaluation conducted on a well-constructed smart contract dataset demonstrates OSEL ’s effectiveness, achieving an average accuracy of 0.9124, F1-score of 0.9082. OSEL outperforms traditional detection tools by average improvements of 46.98% in accuracy and 62.38% in F1-score, and surpasses deep learning-based baselines by average improvements of 7.99% in accuracy, 13.01% in F1-score, 12.03% in AUC-ROC, and 10.60% in AUC-PR. Moreover, ablation studies demonstrate the contribution of OSEL ’s key modules to detection performance.