Towards combining chain-of-thought and code static analysis for buffer overflow vulnerability detection
摘要
With the widespread use of system software (such as operating systems, compilers, etc.), buffer overflow vulnerabilities have become one of the most common types of vulnerabilities. Due to their dynamics, diversity, and inherent complexity, detecting buffer overflow vulnerabilities has always been a major challenge in the field of software security. To address this issue, this study proposes a buffer overflow vulnerability detection method based on dependency analysis and LLM Chain-of-Thought (COT), named GPTDetector. By performing static analysis on C/C++ programs, GPTDetector can track the data dependencies and control dependencies of specific sensitive information (i.e., threat code) and generate carefully designed prompts for vulnerability detection, thereby helping LLMs infer and identify potential buffer overflow vulnerabilities. Experimental results show that GPTDetector significantly outperforms traditional models in detecting vulnerabilities in the source code of real-world projects, with an F1 score increased by 7.3%-14.6%.