首页|期刊导航|电子学报|一种基于IR模拟执行的密码学API误用检测方法

一种基于IR模拟执行的密码学API误用检测方法OA

A Cryptographic API Misuse Detection Method Based on Intermediate Representation Simulation

中文摘要英文摘要

密码学算法是现代软件系统中保护数据机密性与完整性的核心机制.然而,密码学应用程序编程接口(Application Programming Interface,API)的误用,例如使用可预测密钥或不安全密码算法,严重影响着软件系统的安全性,可能导致软件破解、网络攻击等后果,表明了检测密码学API误用的必要性.现有密码学API误用检测研究主要通过分析API参数值来识别误用现象,根据分析方式可分为动态分析方法和静态分析方法.动态分析方法能获取运行时的参数值,但受代码覆盖率低的限制,易遗漏未触发的代码,从而导致漏报.相比之下,静态分析方法具备更高的代码覆盖率,但现有的静态检测方法在理论与实现上仍存在显著局限:它们大多依赖简单的常量传播或模式匹配,仅能识别直接赋值的简单参数形式,而难以解析经过复杂指令(如字符串拼接、编码转换等"值变化"操作)处理的目标参数,导致当密码学参数经过复杂变换时,现有静态分析方法会出现大量漏报的情况,形成分析盲区.针对上述问题,本文提出并实现了ParamScope.这是一种基于中间表示(Intermediate Representation,IR)解释模拟的Java密码学API误用静态检测方法.首先,ParamScope实现了一种"赋值驱动"的程序切片算法.该算法基于SootUp程序分析工具构建,通过引入严格的赋值模式约束,能够精准提取密码学参数的依赖路径.其次,ParamScope实现了轻量级IR解释器对切片后的路径进行模拟执行,并引入包含真实逻辑的Android核心类库,结合Java反射机制,在静态分析中实现了对复杂方法调用的语义还原.该方法具有静态分析的高覆盖率优势,同时有效解决了静态环境下复杂指令导致的参数值分析难题.实验表明,ParamScope在公开数据集上的参数值重建精确率达到97.31%,且误用检测准确率达到96.2%,优于现有的先进静态与动态工具;在真实Android应用程序中的检测实验进一步显示,ParamScope有效识别出大量被编码或隐藏的真实参数典型案例,并报告其中的误用现象,相较于现有的静态工具CogniCrypt额外检测出约27%的误用案例,且单个应用平均分析用时仅4.85 min.综上,ParamScope兼具静态分析的高覆盖率与复杂参数解析的高精准度,为密码学API误用检测提供了一种高精度、高效率的新型解决方案.

Cryptographic algorithms serve as the core mechanisms for protecting data confidentiality and integrity in modern software systems.However,the misuse of cryptographic application programming interfaces(APIs),such as using predictable keys or insecure cryptographic algorithms,severely compromises software security,leading to software cracking and network attacks,which highlights the necessity of detecting such misuses.Existing studies on cryptographic API misuse detection primarily identify such misuses by analyzing API parameter values,and can be categorized into dynamic and stat-ic methods.While dynamic approaches can retrieve precise runtime parameter values,they suffer from low code coverage,leading to false negatives caused by untriggered code paths.In contrast,static analysis offers higher code coverage,but ex-isting static methods face significant theoretical and practical limitations:they mostly rely on simple constant propagation or pattern matching,which only allow them to identify directly assigned parameters.Consequently,they struggle to resolve tar-get parameters processed by complex"value-transformation"instructions(e.g.,string concatenation or encoding conver-sion),leading to substantial blind spots and false negatives when analyzing cryptographic parameters that undergo complex transformations.To address these limitations,this paper proposes ParamScope,a static detection method for Java crypto-graphic API misuse based on intermediate representation(IR)interpretation and simulation.First,ParamScope implements an"assignment-driven"program slicing algorithm built upon the SootUp framework,which incorporates strict assignment pattern constraints to precisely extract the dependency paths of cryptographic parameters.Second,it utilizes a lightweight IR interpreter to simulate the execution of the sliced statements,and integrates core Android libraries containing actual im-plementations.By combining this with Java reflection mechanisms,it achieves the semantic restoration of complex method calls during static analysis.This approach leverages the high coverage of static analysis and effectively resolves the chal-lenge of statically analyzing parameter values derived from complex instructions.Evaluations on public datasets demon-strate that ParamScope achieves parameter value reconstruction and misuse detection accuracies of 97.31%and 96.2%re-spectively,outperforming state-of-the-art static and dynamic tools.Furthermore,experiments on real-world Android applica-tions reveal that ParamScope effectively identifies typical cases of encoded or hidden real parameters,and reports the misus-es within them.It detects approximately 27%more misuses compared to the leading static tool,CogniCrypt,with an aver-age analysis time of only about 4.85 minutes per application.In summary,ParamScope combines the high coverage of static analysis with the high precision of complex parameter resolution,thereby providing a novel,precise,and efficient solution for cryptographic API misuse detection.

何亚非;占力戈;聂宇;傅建明;彭国军

武汉大学国家网络安全学院,湖北 武汉 430072||空天信息安全与可信计算教育部重点实验室,湖北 武汉 430072武汉大学国家网络安全学院,湖北 武汉 430072||空天信息安全与可信计算教育部重点实验室,湖北 武汉 430072武汉大学国家网络安全学院,湖北 武汉 430072||空天信息安全与可信计算教育部重点实验室,湖北 武汉 430072武汉大学国家网络安全学院,湖北 武汉 430072||空天信息安全与可信计算教育部重点实验室,湖北 武汉 430072武汉大学国家网络安全学院,湖北 武汉 430072||空天信息安全与可信计算教育部重点实验室,湖北 武汉 430072

信息技术与安全科学

静态分析程序切片模拟执行Java程序分析密码学API误用检测

static analysisprogram slicingsimulation executionJava program analysiscryptographic application program interfacemisuse detection

《电子学报》 2026 (3)

1132-1146,15

国家自然科学基金(No.62272351,No.62572354) National Natural Science Foundation of China(No.62272351,No.62572354)

10.12263/DZXB.20250813

评论