[论文解读] LLbezpeky: Leveraging Large Language Models for Vulnerability Detection
本文评估使用 GPT-4 结合提示工程和检索增强来检测 Ghera 基准中的 Android 漏洞,开发开源的 LLB 工具,并分析包括 Vuldroid 在内的用例研究。
Despite the continued research and progress in building secure systems, Android applications continue to be ridden with vulnerabilities, necessitating effective detection methods. Current strategies involving static and dynamic analysis tools come with limitations like overwhelming number of false positives and limited scope of analysis which make either difficult to adopt. Over the past years, machine learning based approaches have been extensively explored for vulnerability detection, but its real-world applicability is constrained by data requirements and feature engineering challenges. Large Language Models (LLMs), with their vast parameters, have shown tremendous potential in understanding semnatics in human as well as programming languages. We dive into the efficacy of LLMs for detecting vulnerabilities in the context of Android security. We focus on building an AI-driven workflow to assist developers in identifying and rectifying vulnerabilities. Our experiments show that LLMs outperform our expectations in finding issues within applications correctly flagging insecure apps in 91.67% of cases in the Ghera benchmark. We use inferences from our experiments towards building a robust and actionable vulnerability detection system and demonstrate its effectiveness. Our experiments also shed light on how different various simple configurations can affect the True Positive (TP) and False Positive (FP) rates.
研究动机与目标
- 在静态/动态分析存在局限的背景下,推动对 Android 应用有效漏洞检测的需求。
- 研究大语言模型在基本提示和额外上下文下是否能够检测 Android 漏洞。
- 设计一个以 AI 为驱动的工作流程,使用 LLM 识别、解释并修复 Android 应用中的漏洞。
提出的方法
- 使用 GPT-4 结合提示工程和 Retrieval Augmented Generation (RAG) 来分析 Ghera 基准中的 Android 应用。
- 迭代优化提示,以比较基本提示与漏洞摘要的效果。
- 实现一个 Python 包(LLB),提供 CLI,使用多个扫描器(GHERA、VULDROID)运行扫描并附上专家评注。
- 对 WebView 信息暴露场景以及 Vuldroid 的多漏洞应用进行用例研究,以评估检测与修复指导。
实验结果
研究问题
- RQ1RQ1:在基本提示技术下,LLMs 能否检测 Android 漏洞?与现有工具相比如何?
- RQ2RQ2:哪些输入与上下文(知识库、API 使用、权限、端点、跨语言组件)有助于 LLMs 发现漏洞?
- RQ3RQ3:检索增强生成(RAG)如何影响检测准确性和效率?
- RQ4RQ4:一种由 AI 驱动的工作流程如何为开发者提供可操作的修复指导与支持?
主要发现
- LLMs 即使在最小提示上下文下也能标记不安全的应用,但在初始设置中对安全应用的错误分类尤为显著。
- 提供简短的漏洞摘要可提高真正例并减少推理时间,在实验2中达到66.38%的 TP 率。
- 带有选择性文件请求的检索增强方法可以带来效率提升,但若过度使用摘要可能产生歧义性(幻觉)结果。
- LLB 工具包支持使用多种扫描器进行扫描,并支持对扫描后分析的专家评注,生成示例报告。
- 在 Vuldroid 的用例研究中,LLB 正确识别了 8 个种子漏洞中的 6 个;漏识别的两个原因是缺少用于基于文件分析的相关片段。
- 用例示例显示 LLB 能解释漏洞并提出修复建议,例如通过 WebView 的信息暴露漏洞及其修复说明。
阅读本论文
在 Nubint 阅读器中打开原文,边读边就任意段落提问。
在 Nubint 中阅读本论文本解读由 AI 根据论文原文生成,引用前请核对原文。