Skip to main content
QUICK REVIEW

[论文解读] How well does LLM generate security tests?

Ying Zhang, Wenjia Song|arXiv (Cornell University)|Oct 1, 2023
Web Application Security VulnerabilitiesComputer Science被引用 12
一句话总结

该研究使用 ChatGPT-4.0 为具有易受攻击库的应用程序生成概念验证安全测试,显示在55个任务中有24个可利用的测试,并且优于 SIEGE 和 TRANSFER。

ABSTRACT

Developers often build software on top of third-party libraries (Libs) to improve programmer productivity and software quality. The libraries may contain vulnerabilities exploitable by hackers to attack the applications (Apps) built on top of them. People refer to such attacks as supply chain attacks, the documented number of which has increased 742% in 2022. People created tools to mitigate such attacks, by scanning the library dependencies of Apps, identifying the usage of vulnerable library versions, and suggesting secure alternatives to vulnerable dependencies. However, recent studies show that many developers do not trust the reports by these tools; they ask for code or evidence to demonstrate how library vulnerabilities lead to security exploits, in order to assess vulnerability severity and modification necessity. Unfortunately, manually crafting demos of application-specific attacks is challenging and time-consuming, and there is insufficient tool support to automate that procedure. In this study, we used ChatGPT-4.0 to generate security tests, and to demonstrate how vulnerable library dependencies facilitate the supply chain attacks to given Apps. We explored various prompt styles/templates, and found that ChatGPT-4.0 generated tests for all 55 Apps, demonstrating 24 attacks successfully. It outperformed two state-of-the-art security test generators -- TRANSFER and SIEGE -- by generating a lot more tests and achieving more exploits. ChatGPT-4.0 worked better when prompts described more on the vulnerabilities, possible exploits, and code context. Our research will shed light on new research in security test generation. The generated tests will help developers create secure by design and secure by default software.

研究动机与目标

  • 通过展示库中的漏洞如何传播到受依赖的应用来促使减轻供应链攻击。
  • 评估大型语言模型是否能生成可执行的安全测试,展示利用路径。
  • 将LLM生成的测试与最前沿的测试生成器进行比较,以评估有效性和实用性。

提出的方法

  • 构建一个包含 55 \u00124 App-Lib 对的数据集,其中应用程序依赖于易受攻击的库版本。
  • 为 ChatGPT 设计多轮提示(默认和变体),以生成模仿典型利用的安全测试。
  • 阶段性评估:将生成的测试集成到应用中,编译并运行测试以验证行为和利用。
  • 使用三项指标(App-Lib 测试适用性、测试可编译性、以及实际利用漏洞的能力)来评估结果。
  • 将 ChatGPT 的结果与两种工具 SIEGE 和 TRANSFER 在同一数据集上进行比较。
  • 分析成功/失败因素,确定在提示信息中最影响结果的信息元素。
Figure 1. Our default usage of ChatGPT to generate security tests
Figure 1. Our default usage of ChatGPT to generate security tests

实验结果

研究问题

  • RQ1RQ1:ChatGPT 为具有易受攻击 Lib 的应用生成安全测试的有效性如何?
  • RQ2RQ2:提示设计(包含的信息)如何影响 ChatGPTŸs 性能在测试生成中的表现?
  • RQ3RQ3:ChatGPT –s 性能与现有的安全测试生成工具(SIEGE、TRANSFER)相比如何?

主要发现

  • ChatGPT 为所有 55 条提示生成了测试;其中 26 条可编译运行,经过小幅修正后有 14 条可编译,总计 40 条可编译测试。
  • 24 条可编译的测试成功利用了已知漏洞,展示了概念验证的利用。
  • ChatGPT 在包含 55 个应用的数据集上优于 TRANSFER(利用了 4 个漏洞)和 SIEGE(未利用漏洞)。
  • 如果没有 Lib 的特定漏洞测试,生成的测试都无法利用漏洞,强调提示中对漏洞上下文的详细重要性。
  • 包含更多关于漏洞、利用和代码上下文的描述性信息的提示提高了性能,其中漏洞测试元素尤为关键。
  • 某些生成的测试未能编译(55中有 15 条),往往是因为工具 mocks 或缺失/错误的程序实体,显示自动测试综合的局限性。
Figure 2. Our prompt template
Figure 2. Our prompt template

阅读本论文

在 Nubint 阅读器中打开原文,边读边就任意段落提问。

在 Nubint 中阅读本论文

本解读由 AI 根据论文原文生成,引用前请核对原文。