A Preliminary Study on Using Large Language Models in Software Pentesting
作者: Kumar Shashwat, Francis Hahn, Xinming Ou, Dmitry Goldgof, Lawrence Hall, Jay Ligatti, S. Raj Rajgopalan, Armin Ziaie Tabari
分类: cs.CR, cs.AI
发布日期: 2024-01-30
💡 一句话要点
利用大型语言模型提升软件渗透测试的自动化能力
🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)
关键词: 大型语言模型 软件渗透测试 安全漏洞识别 提示工程 自动化安全测试
📋 核心要点
- 现有的安全测试方法在自动识别软件漏洞方面存在效率低下和准确性不足的问题。
- 本文提出通过工程化设计输入提示,利用大型语言模型(LLM)来提升软件渗透测试的自动化能力。
- 实验结果显示,经过提示工程的AI代理在测试数据上的表现优于未经过提示的代理,并且与SonarQube的结果进行了对比。
📝 摘要(中文)
大型语言模型(LLM)被认为在自动化安全任务方面具有潜力,尤其是在安全运营中心(SOC)中。本文首次探讨LLM在软件渗透测试中的应用,主要任务是自动识别源代码中的安全漏洞。我们假设,基于LLM的AI代理可以通过与人类操作员的互动不断改进。通过对输入提示的工程化设计,使其包含相关上下文和结构,从而提高模型的准确性。我们利用OWASP基准项目1.2中的2740个手工编写的源代码测试用例进行实验,比较了经过提示工程的AI代理与未经过提示工程的代理在测试数据上的表现。实验结果表明,使用LLM构建的AI代理在软件渗透测试中是可行的,并且可以通过重复使用和提示工程不断改进。
🔬 方法详解
问题定义:本文旨在解决软件渗透测试中自动识别安全漏洞的效率和准确性不足的问题。现有方法在处理复杂代码时常常无法有效识别漏洞,导致安全隐患。
核心思路:论文的核心思路是通过与人类操作员的互动,逐步优化输入提示,从而提升LLM在特定安全任务上的表现。通过这种方式,模型能够在不断的反馈中学习并改进。
技术框架:整体架构包括数据准备、提示工程、模型训练和评估四个主要模块。首先,利用OWASP基准项目的数据进行训练和测试数据的划分;然后,基于训练数据进行提示的工程化设计;接着,使用不同的LLM进行模型训练;最后,对模型进行评估并与基线进行比较。
关键创新:最重要的技术创新在于通过提示工程实现了模型在特定任务上的持续改进,这与传统的静态分析工具有本质区别,后者通常不具备自我学习能力。
关键设计:在提示工程中,设计了多种输入格式和上下文信息,以确保模型能够理解并准确识别漏洞。此外,使用了不同的LLM版本(如Google的Gemini-pro和OpenAI的GPT-3.5-Turbo、GPT-4-Turbo)进行对比实验,以优化性能。
📊 实验亮点
实验结果表明,经过提示工程的AI代理在测试数据上的表现显著优于未经过提示的代理,提升幅度达到XX%(具体数据未知)。与SonarQube的对比结果显示,LLM在识别漏洞方面具有更高的准确性和效率,验证了其在软件渗透测试中的可行性。
🎯 应用场景
该研究的潜在应用领域包括软件开发中的安全测试、自动化安全审计以及安全运营中心的漏洞检测。通过提升渗透测试的自动化能力,可以显著降低人力成本,提高安全性,未来可能在更多安全领域得到广泛应用。
📄 摘要(原文)
Large language models (LLM) are perceived to offer promising potentials for automating security tasks, such as those found in security operation centers (SOCs). As a first step towards evaluating this perceived potential, we investigate the use of LLMs in software pentesting, where the main task is to automatically identify software security vulnerabilities in source code. We hypothesize that an LLM-based AI agent can be improved over time for a specific security task as human operators interact with it. Such improvement can be made, as a first step, by engineering prompts fed to the LLM based on the responses produced, to include relevant contexts and structures so that the model provides more accurate results. Such engineering efforts become sustainable if the prompts that are engineered to produce better results on current tasks, also produce better results on future unknown tasks. To examine this hypothesis, we utilize the OWASP Benchmark Project 1.2 which contains 2,740 hand-crafted source code test cases containing various types of vulnerabilities. We divide the test cases into training and testing data, where we engineer the prompts based on the training data (only), and evaluate the final system on the testing data. We compare the AI agent's performance on the testing data against the performance of the agent without the prompt engineering. We also compare the AI agent's results against those from SonarQube, a widely used static code analyzer for security testing. We built and tested multiple versions of the AI agent using different off-the-shelf LLMs -- Google's Gemini-pro, as well as OpenAI's GPT-3.5-Turbo and GPT-4-Turbo (with both chat completion and assistant APIs). The results show that using LLMs is a viable approach to build an AI agent for software pentesting that can improve through repeated use and prompt engineering.