基于大语言模型(LLM)的代码审计:通过推断和评估开发者假设实现
LLM-based Code Auditing by Inferring and Evaluating Developer Assumptions
AI总结:
本研究提出基于大语言模型的Creed方法,通过推断评估开发者安全信念检测代码漏洞,在真实基准上实现了优于现有工具的效果-工作量权衡。
摘要:
当我们看到空指针检查时,便可知开发者认为该指针可能未被初始化;若后续使用同一指针却未进行空指针检查,可视为开发者信念的违背,最终可能是漏洞。我们开发了这种信念引导的漏洞检测(VD)程序分析方法。例如,当认证函数对错误用户名和错误密码返回相同错误时,审计人员可推断开发者认为这两种情况无法区分,以此缓解用户枚举攻击,该信念符合标准安全实践,是合理的;但若存在函数调用导致两种情况的响应时间出现差异,则与该信念矛盾,这种矛盾会暴露时序侧信道,而语法分析工具会遗漏此类问题。现有静态分析工具难以处理这类缺陷,因为它们要求缺陷可通过通用语法模式表达。我们的信念引导方法可检测这类难以察觉的特定领域高级语义安全缺陷。给定一个函数,我们的方法Creed会推断开发者与安全相关的信念,评估每个信念的合理性,并推导其被违背的条件。与现有基于机器学习的VD技术不同,Creed可解释每个问题的根本原因、症状及可被利用的条件。为解决评估中的上下文依赖问题,我们引入两种基于解释的VD指标:召回率量化方法正确解释已知漏洞的有效性,开销量化检查其报告的工作量。在近期真实世界漏洞基准上,Creed检测语义和语法漏洞的效果优于现有基于解释的VD工具,实现了最佳的效果-工作量权衡。
英文摘要:
When we see a null pointer check, we know that the developer believes that the pointer may not be initialized. If the same pointer is later used without a null pointer check, we may consider this a violation of the developer's belief and ultimately a bug. We develop such a belief-guided program analysis for vulnerability detection (VD). For example, when an authentication function returns the same error for both, a wrong user name and a wrong password, an auditor may infer that the developer believes that both cases are indistinguishable, mitigating a user enumeration attack. This belief is reasonable, as it follows standard security practice. Yet, a function call inducing a difference in response time for both cases, contradicts this belief. This contradiction uncovers a timing side-channel that syntactic analysis tools would miss. Existing static analysis tools struggle with this type of flaw because they require them to be expressible by general, syntactic patterns. Our belief-guided approach detects such domain-specific, high-level semantic security flaws that remain elusive. Given a function, our approach, Creed, infers the developer's security-related beliefs, evaluates how reasonable each one is, and derives the conditions under which it is violated. In contrast to existing ML-based VD techniques, Creed explains the root cause, the symptoms, and the conditions under which each issue is exploitable. To address the context-dependency problem in the evaluation, we introduce two measures for explanation-based VD: recall quantifies how effectively an approach correctly explains a known vulnerability, and overhead quantifies the effort of inspecting its reports. On a recent real-world vulnerability benchmark, Creed detects both semantic and syntactic vulnerabilities more effectively than existing explanation-based VD tools, achieving the best effectiveness-effort trade-off.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。