Python Source Code Vulnerability Detection Based on CodeBERT Language Model
Programming language source code vulnerability mining is crucial to improving the security of software systems, but current research is mostly focused on the C language field, with little attention paid to scripting languages. Python code is currently widely used in software systems, and vulnerability detection in Python code is also very important. As an interpreted language, Python has a concise and clear grammatical structure and is closer to natural language, so Python source code vulnerability mining has greater advantages. Previous detection systems based on LSTM models have achieved certain results in detecting Python source code vulnerabilities, but due to the limitations of the model, the vulnerability dataset has low accuracy, lack of full consideration of the deep semantic features of the source code, and the vulnerability multi-classification process is relatively cumbersome and inefficient, and there is room for improvement in accuracy and recall. Therefore, this paper proposes a source code snippet multi-classification vulnerability detection system based on CodeBERT, which aims to automatically detect the security of software code snippets. First, by analyzing the differences between the new and old versions, a multi-label vulnerability dataset is constructed using diff files, and then the RoBERTa is used to obtain high-quality expressions of code keywords. Finally, the constructed multi-classification CodeBERT model is introduced for fine-tuning detection. By improving the accuracy of vulnerability datasets and introducing a high-performance model, this method has achieved significant improvements in source code vulnerability mining and vulnerability classification compared to traditional LSTM model-based detection methods. The average accuracy of the proposed model reaches 98%.
Authors
- Kunpeng Zhao (ORCID: https://orcid.org/0009-0004-2285-6720)
- Long Liu (ORCID: https://orcid.org/0000-0002-5389-5448)
- Mingze Li (ORCID: https://orcid.org/0000-0001-7721-0768)
- Shuya Duan
- Ge Qiu
- Jinyuan Zhai
Institutions
- PLA Information Engineering University (CN)
- Zhengzhou University (CN)
Publication Details
- Published
- 2024-12-20
- DOI
- https://doi.org/10.1109/acai63924.2024.10899694
- Primary Topic
- Computational Physics and Python Applications
- Type
- article
- Field-Weighted Citation Impact
- 0.00