基于LLM伪标签的自演进静态分析
Self-Evolving Static Analysis via LLM Pseudo-Labeling
AI总结:
该研究提出SESA框架,利用两个LLM智能体迭代演进Joern查询,在OWASP基准测试中F1达0.742,可检测真实项目的CVE,将静态分析规则维护转为自动迭代过程。
摘要:
安全漏洞常常逃过静态分析的检测,并非因为它们无法被检测,而是因为尚未为当前代码编写对应的检测规则。新的框架、API和编码习惯不断产生这类漏洞,导致开发者只能发现漏洞并手动编写新规则。我们提出SESA框架,该框架中,大型语言模型(LLM)智能体从无规则开始,迭代演进一组可读且可审计的Joern查询。该智能体仅从第二个LLM评论者处接收反馈,该评论者检查已标记和未标记的代码,以识别可能的误报和疑似漏报,且无法访问真实标签。随后智能体利用此反馈修改其查询。在Python的OWASP基准测试中,SESA在8次独立运行中达到平均F1值0.742,远高于5种广泛使用工具的默认配置,且在使用SESA从未见过的真实标签进行调优后,其性能可与其中最强的工具相当。在真实Python项目的试点中,从漏洞引入前的代码生成的查询检测到19个后续CVE中的10个,包括同一仓库编写的规则检测到的9个。生成的检测器是一组可执行、人类可读的查询,工程师可独立检查、修改和运行。这些结果表明,LLM智能体可将静态分析规则维护从手动编写过程转变为自动发现与修复的迭代过程。
英文摘要:
Security bugs often slip past static analysis not because they are impossible to detect, but because detection rules have not yet been written for the code in front of us. New frameworks, APIs, and coding idioms continually create such gaps, leaving developers to discover failures and manually encode new rules. We present SESAA, a framework in which an Large Language Model (LLM) agent starts from no rules and iteratively evolves a set of readable and auditable joern queries. The agent receives feedback only from a second LLM critic, which inspects flagged and unflagged code to identify likely false alarms and suspected misses, without access to ground-truth labels. The agent then uses this feedback to revise its queries. On the OWASP Benchmark for Python, SESAA reaches a mean F1 of 0.742 across 8 independent runs, well above the default configurations of five widely used tools and comparable to the strongest of them once it is tuned with access to ground-truth labels that SESAA never sees. In a pilot on real-world Python projects, queries induced from code available before a vulnerability was introduced detect 10 of 19 subsequent CVEs, including 9 detected by rules written for the same repository. The resulting detector is a set of executable, human-readable queries that engineers can inspect, modify, and run independently. These results suggest that LLM agents can turn static-analysis rule maintenance from a manually authored process into an iterative process of automated discovery and repair.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。