信息网络安全 ›› 2026, Vol. 26 ›› Issue (2): 304-314.doi: 10.3969/j.issn.1671-1122.2026.02.010

• 学术研究 • 上一篇    下一篇

基于过程间字符串常量分析的Java注入漏洞检测方法

许朴1(), 孙心怡2, 朱永根3   

  1. 1.先进计算与智能工程(国家级)实验室无锡 214100
    2.江南大学信息化建设管理处无锡 214122
    3.江南计算技术研究所无锡 214083
  • 收稿日期:2025-01-04 出版日期:2026-02-10 发布日期:2026-02-23
  • 通讯作者: 许朴 cuanduo@126.com
  • 作者简介:许朴(1991—),男,江苏,工程师,硕士,主要研究方向为网络安全|孙心怡(1991—),女,江苏,工程师,硕士,主要研究方向为教育信息化|朱永根(1989—),男,江苏,工程师,本科,主要研究方向为网络安全

A Method for Detecting Java Injection Vulnerabilities Based on Interprocedure Constant String Analysis

XU Pu1(), SUN Xinyi2, ZHU Yonggen3   

  1. 1. Laboratory for Advanced Computing and Intelligence Engineering, Wuxi 214100, China
    2. Information Construction Management Division of Jiangnan University, Wuxi 214122, China
    3. Jiangnan Institute of Computing Technology, Wuxi 214083, China
  • Received:2025-01-04 Online:2026-02-10 Published:2026-02-23

摘要:

静态分析包含控制流分析、数据流分析、指针分析、污点分析等方法。这些方法能够基于抽象解释理论在不同抽象域上对程序进行分析,从而获取程序信息。这些信息可以用来辅助编译优化、程序理解、漏洞检测等。注入漏洞是由外部输入危险函数而产生的。针对注入漏洞,静态分析主要采用规则匹配和污点分析两种方案进行检测。规则匹配方案是基于语法规则模版进行漏洞匹配,其误报率较高;污点分析方案利用污点源到目标位置的可达性进行漏洞检测,其依赖污点源及传播规则的完备性。文章利用字符串常量传播算法实现程序中变量引用字符串信息分析,然后,通过字符串信息的危险函数参数分析算法实现对注入漏洞的检测。文章在开源Java静态分析框架Tai-e上实现,该方法命名为ConstStringDetect。在Juliet java v1.3和OWASP v1.2测试集上进行实验,测试CWE-078(命令注入漏洞)、CWE-089(SQL注入漏洞)和CWE-090(LDAP注入漏洞)3种注入漏洞。实验结果表明,文章方法相较于先进静态漏洞检测工具SpotBugs和CodeQL,在没有针对特定函数规则的情况下,召回率高于CodeQL,误报率远低于SpotBugs。

关键词: 静态分析, 抽象解释, 漏洞检测

Abstract:

Static analysis includes control flow analysis, data flow analysis, pointer analysis, and taint analysis. Grounded in abstract interpretation theory, these methods analyze programs across different abstract domains to extract program information for tasks such as compilation optimization and program comprehension, as well as vulnerability detection. Injection vulnerabilities, such as command injection and SQL injection, arise when external inputs reach sensitive functions. For detecting injection vulnerabilities, static analysis primarily employs two approaches: rule matching and taint analysis. The rule matching approach uses pattern-based templates to identify vulnerabilities, which tends to yield a high false positive rate. The taint analysis approach detects vulnerabilities by tracking the flow of tainted data from sources to sensitive sinks, though its effectiveness depends on the completeness of both taint sources and propagation rules. This paper employed a string constant propagation algorithm to analyze variable-referenced string information within programs, followed by a dangerous function parameter analysis algorithm based on the string information to detect injection vulnerabilities. The proposed method which named ConstStringDetect, was implemented on the open-source Java static analysis framework Tai-e. Experiments were conducted on the Juliet Java v1.3 and OWASP v1.2 benchmark suites, covering three types of injection vulnerabilities: CWE-078 (OS command injection), CWE-089 (SQL injection), and CWE-090 (LDAP injection). Compared to state-of-the-art static vulnerability detection tools such as SpotBugs and CodeQL, the method proposed in this paper achieves a higher recall rate than CodeQL and a significantly lower false positive rate than SpotBugs, even without relying on specific function rules.

Key words: static analysis, abstract interpretation, vulnerability detection

中图分类号: