arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2405.07744cs.SE
收藏

MoCo:通过代码组装对深度学习库进行模糊测试

MoCo: Fuzzing Deep Learning Libraries via Assembling Code

Pin Ji, Yang Feng, Duo Wu, Lingyue Yan, Pengling Chen, Jia Liu, Zhihong Zhao

AI总结:

针对深度学习库模糊测试在输入多样性、测试预言构建等方面的局限,提出基于代码组装的MoCo模糊测试方法,可快速定位漏洞,在三类主流DL库中检测出64个新漏洞。

摘要:

快速发展的深度学习(DL)技术已被应用于具备多种应用场景的软件系统中。然而,它们也可能带来新的安全威胁,引发潜在的严重后果,在安全关键领域中尤为突出。DL库是DL系统的底层基础,其中的漏洞会产生不可预测的影响,直接作用于DL系统的运行行为。此前针对DL库模糊测试的研究在测试输入多样性、测试预言构建以及检测精度方面仍存在局限。\n本文提出MoCo,一种通过代码组装实现的新型DL库模糊测试方法。MoCo首先对种子代码文件进行拆解,得到模板与代码块,随后采用代码块变异算子(如API替换、随机生成、边界检查)生成更多适配模板的新代码块。通过逐步将符合上下文的代码块插入模板,MoCo可生成具有代际关联的代码文件树。基于该树中的推导关系以及所应用的变异算子,我们以执行状态一致性为基础构建测试预言。由于代码组装与变异的粒度处于可控状态,而非随机发散,我们能够快速定位漏洞所在的代码行以及对应的触发条件。\n我们使用三类广泛应用的DL库(即TensorFlow、PyTorch与Jittor)开展综合实验,评估MoCo的效率与有效性。实验期间,MoCo在三个DL库中检测出64个分属四种类型的新漏洞,其中51个漏洞已得到确认,13个漏洞已被开发者修复。

英文摘要:

The rapidly developing deep learning (DL) techniques have been applied in software systems with various application scenarios. However, they could also pose new safety threats with potentially serious consequences, especially in safety-critical domains. DL libraries serve as the underlying foundation for DL systems, and bugs in them can have unpredictable impacts that directly affect the behaviors of DL systems. Previous research on fuzzing DL libraries still has limitations in the diversity of test inputs, the construction of test oracles, and the precision of detection. In this paper, we propose MoCo, a novel fuzzing testing method for DL libraries via assembling code. MoCo first disassembles the seed code file to obtain the template and code blocks, and then employs code block mutation operators (e.g., API replacement, random generation, and boundary checking) to generate more new code blocks adapted to the template. By inserting context-appropriate code blocks into the template step by step, MoCo can generate a tree of code files with intergenerational relations. According to the derivation relations in this tree and the applied mutation operators, we construct the test oracle based on the execution state consistency. Since the granularity of code assembly and mutation is controlled rather than randomly divergent, we can quickly pinpoint the lines of code where the bugs are located and the corresponding triggering conditions. We conduct a comprehensive experiment to evaluate the efficiency and effectiveness of MoCo using three widely-used DL libraries (i.e., TensorFlow, PyTorch, and Jittor). During the experiment, MoCo detects 64 new bugs of four types in three DL libraries, where 51 bugs have been confirmed, and 13 bugs have been fixed by developers.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑