arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2507.11092cs.SE
收藏

MT4DP:基于蜕变测试的深度学习代码搜索模型数据投毒攻击检测

MT4DP: Data Poisoning Attack Detection for DL-based Code Search Models via Metamorphic Testing

Gong Chen, Wenjie Liu, Xiaoyuan Xie, Xunzhu Tang, Tegawendé F. Bissyandé, Songqiang Chen

AI总结:

本文提出MT4DP框架,通过引入语义等价蜕变关系(SE-MR),利用源查询与后续查询的排名方差检测深度学习代码搜索模型的数据投毒攻击,显著提升了检测效果。

摘要:

近期,多项研究表明数据投毒攻击对基于深度学习(DL-based)的代码搜索模型构成了严重的安全威胁。攻击者将精心制作的恶意模式注入训练数据,误导代码搜索模型在训练期间学习这些模式。在使用受感染的代码搜索模型进行推理时,一旦恶意模式被触发,模型倾向于将漏洞代码的排名提升。然而,现有的针对基于深度学习的代码搜索模型的数据投毒攻击检测方法仍然效果不佳。为了解决这一关键安全问题,我们提出了MT4DP,一个通过蜕变测试检测基于深度学习的代码搜索模型数据投毒攻击的框架。MT4DP引入了一种新颖的语义等价蜕变关系(SE-MR),旨在检测针对基于深度学习的代码搜索模型的数据投毒攻击。具体而言,MT4DP首先从搜索查询中识别高频词作为潜在的投毒目标,并将其对应的查询作为源查询。对于每个源查询,MT4DP生成两个语义等价的后续查询,并检索其源排序列表。然后,根据代码片段与后续查询之间的语义相似度,对每个源排序列表进行重新排序。最后,计算源列表与重排列表之间的方差,以揭示对SE-MR的违反并警告数据投毒攻击。实验结果表明,MT4DP显著增强了对基于深度学习的代码搜索模型数据投毒攻击的检测能力,在平均F1分数上比最佳基线高出191%,在平均精确率上高出265%。我们的工作旨在促进对缓解基于深度学习的代码搜索模型数据投毒威胁的有效技术的进一步研究。

英文摘要:

Recently, several studies have indicated that data poisoning attacks pose a severe security threat to deep learning-based (DL-based) code search models. Attackers inject carefully crafted malicious patterns into the training data, misleading the code search model to learn these patterns during training. During the usage of the poisoned code search model for inference, once the malicious pattern is triggered, the model tends to rank the vulnerability code higher. However, existing detection methods for data poisoning attacks on DL-based code search models remain insufficiently effective. To address this critical security issue, we propose MT4DP, a Data Poisoning Attack Detection Framework for DL-based Code Search Models via Metamorphic Testing. MT4DP introduces a novel Semantically Equivalent Metamorphic Relation (SE-MR) designed to detect data poisoning attacks on DL-based code search models. Specifically, MT4DP first identifies the high-frequency words from search queries as potential poisoning targets and takes their corresponding queries as the source queries. For each source query, MT4DP generates two semantically equivalent follow-up queries and retrieves its source ranking list. Then, each source ranking list is re-ranked based on the semantic similarities between its code snippets and the follow-up queries. Finally, variances between the source and re-ranked lists are calculated to reveal violations of the SE-MR and warn the data poisoning attack. Experimental results demonstrate that MT4DP significantly enhances the detection of data poisoning attacks on DL-based code search models, outperforming the best baseline by 191% on average F1 score and 265% on average precision. Our work aims to promote further research into effective techniques for mitigating data poisoning threats on DL-based code search models.

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

↑