HPDA: An enhanced GNN-based software vulnerability detection approach by hybrid-scale perception and data augmentation
摘要
As software systems become increasingly complex, the demand for the research of vulnerability detection technologies also grows. Recently, vulnerability detection methods based on graph neural networks (GNN) have demonstrated commendable generalization performance. However, they encounter challenges when dealing with large-scale code graphs and complex vulnerability patterns. Moreover, the limited availability of training samples further restricts the generalization capabilities of models. To address these issues, we propose HPDA, a novel GNN-based vulnerability detection approach that integrates Hybrid-scale Perception and Data Augmentation. This method begins by developing a hybrid-scale perception model for vulnerability detection, utilizing a global attention mechanism to address the limitations of graph neural networks in capturing global information. This model then serves as the reward model in a reinforcement learning framework, guiding the training of our data augmentation model specifically crafted for code graphs. Finally, we use the data augmentation model to expand the training set, thereby improving the generalization performance of the vulnerability detection model. The experimental results show that HPDA outperforms other baseline methods and exhibits higher flexibility in practical application scenarios. HPDA achieved an average relative improvement of 29.17% in F1 score and 32.92% in Recall compared to the state-of-the-art methods on three datasets.