评估与改进LLM生成的安全攻击检测器的鲁棒性
Evaluating and Improving the Robustness of Security Attack Detectors Generated by LLMs
AI总结:
本文提出将RAG与自排序技术集成到LLM流水线中,以提升生成攻击检测器的鲁棒性,在XSS和SQLi检测的F2-Score上取得显著提升。
摘要:
大型语言模型(LLMs)在软件开发中越来越多地用于生成实现安全要求的函数,例如攻击检测器。一个关键挑战是确保LLMs具备足够的知识来应对特定的安全要求,例如关于现有攻击的信息。为此,我们提出了一种将检索增强生成(RAG)和自排序(Self-Ranking)集成到LLM流水线中的方法。RAG通过引入外部知识源来增强输出的鲁棒性,而受自洽性(Self-Consistency)概念启发的自排序技术则生成多条推理路径并创建排序,以选择最鲁棒的检测器。我们广泛的实证研究针对LLMs生成的代码,以检测Web安全中两种普遍的注入攻击:跨站脚本攻击(XSS)和SQL注入(SQLi)。结果显示,采用RAG和自排序后检测性能有显著提升,XSS和SQLi检测的F2-Score分别提高了最高71%pt(平均37%pt)和最高43%pt(平均6%pt)。
英文摘要:
Large Language Models (LLMs) are increasingly used in software development to generate functions, such as attack detectors, that implement security requirements. A key challenge is ensuring the LLMs have enough knowledge to address specific security requirements, such as information about existing attacks. For this, we propose an approach integrating Retrieval Augmented Generation (RAG) and Self-Ranking into the LLM pipeline. RAG enhances the robustness of the output by incorporating external knowledge sources, while the Self-Ranking technique, inspired by the concept of Self-Consistency, generates multiple reasoning paths and creates ranks to select the most robust detector. Our extensive empirical study targets code generated by LLMs to detect two prevalent injection attacks in web security: Cross-Site Scripting (XSS) and SQL injection (SQLi). Results show a significant improvement in detection performance while employing RAG and Self-Ranking, with an increase of up to 71%pt (on average 37%pt) and up to 43%pt (on average 6%pt) in the F2-Score for XSS and SQLi detection, respectively.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。