[论文解读] Vulnerability Mimicking Mutants
本文提出 VMMS,一种机器学习方法,用于识别由预训练语言模型(如 CodeBERT)生成的、在语义上模仿真实安全漏洞的代码变异体(mutants)。尽管仅占所有变异体的 3.9%,这些漏洞模仿型变异体却成功复现了 45 个分析漏洞中 55.6% 的失败行为,且 VMMS 的预测结果在 MCC 为 0.63、精确率为 0.80、召回率为 0.51 的情况下表现良好,证明了无需人工特征工程即可实现静态预测的可行性。
With the increasing release of powerful language models trained on large code corpus (e.g. CodeBERT was trained on 6.4 million programs), a new family of mutation testing tools has arisen with the promise to generate more "natural" mutants in the sense that the mutated code aims at following the implicit rules and coding conventions typically produced by programmers. In this paper, we study to what extent the mutants produced by language models can semantically mimic the observable behavior of security-related vulnerabilities (a.k.a. Vulnerability-mimicking Mutants), so that designing test cases that are failed by these mutants will help in tackling mimicked vulnerabilities. Since analyzing and running mutants is computationally expensive, it is important to prioritize those mutants that are more likely to be vulnerability mimicking prior to any analysis or test execution. Taking this into account, we introduce VMMS, a machine learning based approach that automatically extracts the features from mutants and predicts the ones that mimic vulnerabilities. We conducted our experiments on a dataset of 45 vulnerabilities and found that 16.6% of the mutants fail one or more tests that are failed by 88.9% of the respective vulnerabilities. More precisely, 3.9% of the mutants from the entire mutant set are vulnerability-mimicking mutants that mimic 55.6% of the vulnerabilities. Despite the scarcity, VMMS predicts vulnerability-mimicking mutants with 0.63 MCC, 0.80 Precision, and 0.51 Recall, demonstrating that the features of vulnerability-mimicking mutants can be automatically learned by machine learning models to statically predict these without the need of investing effort in defining such features.
研究动机与目标
- 探究基于语言模型的变异测试工具是否能够生成在测试失败行为上语义上模仿真实安全漏洞的变异体。
- 通过在执行前识别出最小数量的漏洞模仿型变异体,降低分析所有变异体的高成本。
- 开发一种无需人工特征工程的静态、基于机器学习的方法,用于预测漏洞模仿型变异体。
- 评估该预测方法在识别与真实漏洞失败相同测试的变异体方面的有效性(即漏洞证明,Proof of Vulnerability)。
提出的方法
- 本研究使用预训练的 CodeBERT 模型,通过掩码标记预测生成变异体,实现方式基于 μBERT 工具。
- 通过检查变异体在每个漏洞的漏洞证明(PoV)测试集上的失败情况,对变异体进行评估。
- 使用 Vul4J 数据集中 45 个可复现的漏洞作为失败行为的基准真实值。
- 从变异体代码上下文中自动提取特征,包括语法、语义和结构属性。
- 利用随机森林模型基于这些特征训练分类器,判断变异体是否为漏洞模仿型。
- 使用 Ochiai 系数衡量变异体与漏洞失败模式之间的相似性,以评估模型。

实验结果
研究问题
- RQ1在测试失败行为方面,语言模型生成的变异体在多大程度上能够语义上模仿真实安全漏洞?
- RQ2能否在无需人工特征工程的情况下,利用机器学习模型准确预测哪些变异体是漏洞模仿型?
- RQ3与基线方法相比,所提出的 VMMS 方法在识别漏洞模仿型变异体方面的有效性如何?
- RQ4漏洞模仿型变异体占总变异体集合的比例如何?它们代表了多少个漏洞?
主要发现
- 16.6% 的所有变异体至少在一项与对应漏洞相同的测试中失败,表明这些变异体在实践中是可检测的。
- 仅 3.9% 的总变异体集合为漏洞模仿型变异体,凸显了其稀少性,尽管其相关性显著。
- 这些漏洞模仿型变异体覆盖了所分析的 45 个漏洞中的 55.6%,显示出对真实安全问题的显著覆盖范围。
- VMMS 的 Matthews 相关系数(MCC)达到 0.63,表明预测性能中等至较强。
- 模型精确率为 0.80,意味着 80% 的预测为漏洞模仿型的变异体确实与真实漏洞在语义上相似。
- 召回率为 0.51,表明模型在数据集中识别出约一半的实际漏洞模仿型变异体。

阅读本论文
在 Nubint 阅读器中打开原文,边读边就任意段落提问。
在 Nubint 中阅读本论文本解读由 AI 根据论文原文生成,引用前请核对原文。