Domenico Cotroneo, Roberta De Luca, Pietro Liguori
{"title":"DeVAIC:人工智能生成代码的安全评估工具","authors":"Domenico Cotroneo, Roberta De Luca, Pietro Liguori","doi":"10.1016/j.infsof.2024.107572","DOIUrl":null,"url":null,"abstract":"<div><h3>Context:</h3><p>AI code generators are revolutionizing code writing and software development, but their training on large datasets, including potentially untrusted source code, raises security concerns. Furthermore, these generators can produce incomplete code snippets that are challenging to evaluate using current solutions.</p></div><div><h3>Objective:</h3><p>This research work introduces <em>DeVAIC</em> (Detection of Vulnerabilities in AI-generated Code), a tool to evaluate the security of AI-generated Python code, which overcomes the challenge of examining incomplete code.</p></div><div><h3>Methods:</h3><p>We followed a methodological approach that involved gathering vulnerable samples, extracting implementation patterns, and creating regular expressions to develop the proposed tool. The implementation of <em>DeVAIC</em> includes a set of detection rules based on regular expressions that cover 35 Common Weakness Enumerations (CWEs) falling under the OWASP Top 10 vulnerability categories.</p></div><div><h3>Results:</h3><p>We utilized four popular AI models to generate Python code, which we then used as a foundation to evaluate the effectiveness of our tool. <em>DeVAIC</em> demonstrated a statistically significant difference in its ability to detect security vulnerabilities compared to the state-of-the-art solutions, showing an <span><math><msub><mrow><mi>F</mi></mrow><mrow><mn>1</mn></mrow></msub></math></span> Score and Accuracy of 94% while maintaining a low computational cost of 0.14 s per code snippet, on average.</p></div><div><h3>Conclusions:</h3><p>The proposed tool provides a lightweight and efficient solution for vulnerability detection even on incomplete code.</p></div>","PeriodicalId":54983,"journal":{"name":"Information and Software Technology","volume":"177 ","pages":"Article 107572"},"PeriodicalIF":3.8000,"publicationDate":"2024-09-16","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"https://www.sciencedirect.com/science/article/pii/S0950584924001770/pdfft?md5=4b13436df2c73b1417f75ea09a77256f&pid=1-s2.0-S0950584924001770-main.pdf","citationCount":"0","resultStr":"{\"title\":\"DeVAIC: A tool for security assessment of AI-generated code\",\"authors\":\"Domenico Cotroneo, Roberta De Luca, Pietro Liguori\",\"doi\":\"10.1016/j.infsof.2024.107572\",\"DOIUrl\":null,\"url\":null,\"abstract\":\"<div><h3>Context:</h3><p>AI code generators are revolutionizing code writing and software development, but their training on large datasets, including potentially untrusted source code, raises security concerns. Furthermore, these generators can produce incomplete code snippets that are challenging to evaluate using current solutions.</p></div><div><h3>Objective:</h3><p>This research work introduces <em>DeVAIC</em> (Detection of Vulnerabilities in AI-generated Code), a tool to evaluate the security of AI-generated Python code, which overcomes the challenge of examining incomplete code.</p></div><div><h3>Methods:</h3><p>We followed a methodological approach that involved gathering vulnerable samples, extracting implementation patterns, and creating regular expressions to develop the proposed tool. The implementation of <em>DeVAIC</em> includes a set of detection rules based on regular expressions that cover 35 Common Weakness Enumerations (CWEs) falling under the OWASP Top 10 vulnerability categories.</p></div><div><h3>Results:</h3><p>We utilized four popular AI models to generate Python code, which we then used as a foundation to evaluate the effectiveness of our tool. <em>DeVAIC</em> demonstrated a statistically significant difference in its ability to detect security vulnerabilities compared to the state-of-the-art solutions, showing an <span><math><msub><mrow><mi>F</mi></mrow><mrow><mn>1</mn></mrow></msub></math></span> Score and Accuracy of 94% while maintaining a low computational cost of 0.14 s per code snippet, on average.</p></div><div><h3>Conclusions:</h3><p>The proposed tool provides a lightweight and efficient solution for vulnerability detection even on incomplete code.</p></div>\",\"PeriodicalId\":54983,\"journal\":{\"name\":\"Information and Software Technology\",\"volume\":\"177 \",\"pages\":\"Article 107572\"},\"PeriodicalIF\":3.8000,\"publicationDate\":\"2024-09-16\",\"publicationTypes\":\"Journal Article\",\"fieldsOfStudy\":null,\"isOpenAccess\":false,\"openAccessPdf\":\"https://www.sciencedirect.com/science/article/pii/S0950584924001770/pdfft?md5=4b13436df2c73b1417f75ea09a77256f&pid=1-s2.0-S0950584924001770-main.pdf\",\"citationCount\":\"0\",\"resultStr\":null,\"platform\":\"Semanticscholar\",\"paperid\":null,\"PeriodicalName\":\"Information and Software Technology\",\"FirstCategoryId\":\"94\",\"ListUrlMain\":\"https://www.sciencedirect.com/science/article/pii/S0950584924001770\",\"RegionNum\":2,\"RegionCategory\":\"计算机科学\",\"ArticlePicture\":[],\"TitleCN\":null,\"AbstractTextCN\":null,\"PMCID\":null,\"EPubDate\":\"\",\"PubModel\":\"\",\"JCR\":\"Q2\",\"JCRName\":\"COMPUTER SCIENCE, INFORMATION SYSTEMS\",\"Score\":null,\"Total\":0}","platform":"Semanticscholar","paperid":null,"PeriodicalName":"Information and Software Technology","FirstCategoryId":"94","ListUrlMain":"https://www.sciencedirect.com/science/article/pii/S0950584924001770","RegionNum":2,"RegionCategory":"计算机科学","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"Q2","JCRName":"COMPUTER SCIENCE, INFORMATION SYSTEMS","Score":null,"Total":0}
引用次数: 0
摘要
背景:人工智能代码生成器正在为代码编写和软件开发带来革命性的变化,但它们在大型数据集(包括潜在的不信任源代码)上的训练引发了安全问题。此外,这些生成器可能会生成不完整的代码片段,使用当前的解决方案对其进行评估具有挑战性。方法:我们采用了一种方法论方法,包括收集易受攻击的样本、提取实现模式和创建正则表达式来开发拟议的工具。DeVAIC的实现包括一套基于正则表达式的检测规则,这些规则涵盖了OWASP十大漏洞类别下的35个常见弱点枚举(CWE)。与最先进的解决方案相比,DeVAIC 在检测安全漏洞的能力方面具有显著的统计学差异,其 F1 分数和准确率均达到 94%,同时保持了较低的计算成本(平均每个代码片段 0.14 秒)。
DeVAIC: A tool for security assessment of AI-generated code
Context:
AI code generators are revolutionizing code writing and software development, but their training on large datasets, including potentially untrusted source code, raises security concerns. Furthermore, these generators can produce incomplete code snippets that are challenging to evaluate using current solutions.
Objective:
This research work introduces DeVAIC (Detection of Vulnerabilities in AI-generated Code), a tool to evaluate the security of AI-generated Python code, which overcomes the challenge of examining incomplete code.
Methods:
We followed a methodological approach that involved gathering vulnerable samples, extracting implementation patterns, and creating regular expressions to develop the proposed tool. The implementation of DeVAIC includes a set of detection rules based on regular expressions that cover 35 Common Weakness Enumerations (CWEs) falling under the OWASP Top 10 vulnerability categories.
Results:
We utilized four popular AI models to generate Python code, which we then used as a foundation to evaluate the effectiveness of our tool. DeVAIC demonstrated a statistically significant difference in its ability to detect security vulnerabilities compared to the state-of-the-art solutions, showing an Score and Accuracy of 94% while maintaining a low computational cost of 0.14 s per code snippet, on average.
Conclusions:
The proposed tool provides a lightweight and efficient solution for vulnerability detection even on incomplete code.
期刊介绍:
Information and Software Technology is the international archival journal focusing on research and experience that contributes to the improvement of software development practices. The journal''s scope includes methods and techniques to better engineer software and manage its development. Articles submitted for review should have a clear component of software engineering or address ways to improve the engineering and management of software development. Areas covered by the journal include:
• Software management, quality and metrics,
• Software processes,
• Software architecture, modelling, specification, design and programming
• Functional and non-functional software requirements
• Software testing and verification & validation
• Empirical studies of all aspects of engineering and managing software development
Short Communications is a new section dedicated to short papers addressing new ideas, controversial opinions, "Negative" results and much more. Read the Guide for authors for more information.
The journal encourages and welcomes submissions of systematic literature studies (reviews and maps) within the scope of the journal. Information and Software Technology is the premiere outlet for systematic literature studies in software engineering.