Software security testing, particularly when enhanced with deep learning models, has become a powerful approach for improving software quality, enabling faster detection of known flaws in source code. However, many approaches miss post-fix latent vulnerabilities that remain even after patches typically due to incomplete fixes or overlooked issues may later lead to zero-day exploits. In this paper, we propose $HYDRA$, a $Hy$brid heuristic-guided $D$eep $R$epresentation $A$rchitecture for predicting latent zero-day vulnerabilities in patched functions that combines rule-based heuristics with deep representation learning to detect latent risky code patterns that may persist after patches. It integrates static vulnerability rules, GraphCodeBERT embeddings, and a Variational Autoencoder (VAE) to uncover anomalies often missed by symbolic or neural models alone. We evaluate HYDRA in an unsupervised setting on patched functions from three diverse real-world software projects: Chrome, Android, and ImageMagick. Our results show HYDRA predicts 13.7%, 20.6%, and 24% of functions from Chrome, Android, and ImageMagick respectively as containing latent risks, including both heuristic matches and cases without heuristic matches ($None$) that may lead to zero-day vulnerabilities. It outperforms baseline models that rely solely on regex-derived features or their combination with embeddings, uncovering truly risky code variants that largely align with known heuristic patterns. These results demonstrate HYDRA's capability to surface hidden, previously undetected risks, advancing software security validation and supporting proactive zero-day vulnerabilities discovery.
翻译:软件安全测试,尤其是在结合深度学习模型后,已成为提升软件质量的有力手段,能够更快地检测源代码中的已知缺陷。然而,许多方法忽略了修复后仍存在的潜在漏洞,这些漏洞通常源于不完整的修复或未被发现的问题,后期可能导致零日攻击。本文提出$HYDRA$,一种混合启发式引导的深度表示架构,用于预测补丁函数中的潜在零日漏洞。该架构结合了基于规则的启发式方法与深度表示学习,以检测补丁后可能持续存在的风险代码模式。它整合了静态漏洞规则、GraphCodeBERT嵌入和变分自编码器(VAE),以揭示符号模型或神经网络模型单独使用时经常遗漏的异常。我们在无监督设置下,对来自三个不同真实世界软件项目(Chrome、Android和ImageMagick)的补丁函数评估了HYDRA。结果显示,HYDRA分别预测了Chrome、Android和ImageMagick中13.7%、20.6%和24%的函数包含潜在风险,包括启发式匹配的案例以及无启发式匹配($None$)但可能导致零日漏洞的案例。它优于仅依赖正则表达式派生特征或将其与嵌入结合的基线模型,揭示了与已知启发式模式高度一致的真实风险代码变体。这些结果证明了HYDRA在揭示隐藏的、先前未检测到的风险方面的能力,推动了软件安全验证,并支持主动的零日漏洞发现。