RAG Against the Machine: Zero-Shot Software Vulnerabilities Classification using LLMs
In an increasingly digital world, the timely detection, analysis, and mitigation of software vulnerabilities are critical to maintaining secure systems. While recent research has applied Transformer-based models to automatically identify vulnerabilities from sources such as GitHub issues, these efforts do not classify the detected vulnerabilities. Without systematic classification, it becomes difficult to prioritize issues, link them to remediation strategies, or integrate them into broader security workflows, limiting their practical impact. This paper introduces a novel approach for automated vulnerability categorization using Large Language Models (LLMs) and Retrieval-Augmented Generation (RAG) within the Common Weakness Enumeration (CWE) framework. We present a RAG-based pipeline for CWE labeling and systematically evaluate multiple retrieval strategies to assess their effectiveness and efficiency. The results demonstrate that our approach achieves competitive performance compared to prior state-of-the-art methods, despite operating entirely in a zero-shot setting without any task-specific training. Moreover, the proposed method enables accurate and cost-effective vulnerability classification, helping to reduce the gap between discovery and remediation in the vulnerability lifecycle. Overall, this work highlights the potential of retrieval-driven approaches to enhance the automation, scalability, and practicality of vulnerability management across the software ecosystem.