CMF-Vul: Advancing automated vulnerability detection via contrastive multimodal fusion and challenge-driven representation learning
摘要
Automated vulnerability detection remains challenging due to heterogeneous vulnerability cues and the diversity of source code representations. This paper presents CMF-Vul, a contrastive multimodal fusion framework that systematically integrates token-level semantics, program dependence graphs (PDGs), and rendered PDG images for function-level vulnerability detection. CMF-Vul performs cross-modal alignment and employs an instance-wise gated fusion module to adaptively weight modalities for each function, mitigating the variability of evidence across vulnerability patterns. To address the extreme sparsity of vulnerability signals and the high similarity between vulnerable and benign code, we propose Challenge-Driven Representation Learning (CDRL): (i) semantic-preserving positive generation via program transformations and (ii) multimodal hard-negative mining with adaptive contrastive weighting to emphasize boundary-adjacent confusable negatives in a unified embedding space. Extensive experiments on three public benchmarks (FFmpeg&Qemu, Big-Vul, and SARD) demonstrate that CMF-Vul consistently outperforms representative state-of-the-art baselines, and achieves a better precision-recall balance, particularly under noisy and imbalanced settings. Ablation studies further validate the effectiveness of both the proposed multimodal fusion and contrastive optimization components. Our implementation and scripts are publicly available.