从理论到实践:利用LLMs为CAPEC和CWE框架生成代码
From Theory to Practice: Code Generation Using LLMs for CAPEC and CWE Frameworks
AI总结:
本文提出一个基于LLMs生成CAPEC和CWE漏洞代码的数据集,通过GPT-4o、Llama和Claude模型生成高准确性的代码示例,提升安全漏洞识别与修复的效率。
摘要:
随着软件系统复杂性和规模的增加,识别和缓解安全漏洞的重要性日益提高。现有软件漏洞数据集在提供与特定漏洞描述明确关联的代码片段方面存在不足,限制了高级研究和对安全漏洞的深入理解。为此,我们提出一个新数据集,提供与CAPEC和CWE描述对应的漏洞代码片段。通过利用生成预训练变换器(GPT)模型的能力,我们开发了一种生成这些示例的稳健方法。我们的方法利用GPT-4o、Llama和Claude模型生成展示特定漏洞的代码片段。该数据集不仅增强了对代码中安全漏洞的理解,还为训练自动漏洞检测和修复的机器学习模型提供了宝贵资源。初步评估表明,由大型语言模型生成的数据集具有高准确性,可作为漏洞识别系统的可靠参考。我们发现三个模型的结果一致,代码之间的余弦相似度为0.98。最终数据集包含615个CAPEC代码片段,涵盖Java、Python和JavaScript三种编程语言,使其成为该领域最全面和多样化的资源之一。
英文摘要:
The increasing complexity and volume of software systems have heightened the importance of identifying and mitigating security vulnerabilities. The existing software vulnerability datasets frequently fall short in providing comprehensive, detailed code snippets explicitly linked to specific vulnerability descriptions, reducing their utility for advanced research and hindering efforts to develop a deeper understanding of security vulnerabilities. To address this challenge, we present a novel dataset that provides examples of vulnerable code snippets corresponding to Common Attack Pattern Enumerations and Classifications (CAPEC) and Common Weakness Enumeration (CWE) descriptions. By employing the capabilities of Generative Pre-trained Transformer (GPT) models, we have developed a robust methodology for generating these examples. Our approach utilizes GPT-4o, Llama and Claude models to generate code snippets that exhibit specific vulnerabilities as described in CAPEC and CWE documentation. This dataset not only enhances the understanding of security vulnerabilities in code but also serves as a valuable resource for training machine learning models focused on automatic vulnerability detection and remediation. Preliminary evaluations suggest that the dataset generated by Large Language Models demonstrates high accuracy and can serve as a reliable reference for vulnerability identification systems. We found consistent results across the three models, with 0.98 cosine similarity among codes. The final dataset comprises 615 CAPEC code snippets in three programming languages: Java, Python, and JavaScript, making it one of the most extensive and diverse resources in this domain.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。