The invention provides a cross-language
vulnerability detection method and
system based on hierarchical heterogeneous modeling, and belongs to the technical field of
software security detection. In order to solve the technical problem that an existing single-language
vulnerability detection method cannot effectively process a multi-
programming language collaborative development
software project, a three-layer progressive modeling strategy is adopted, specifically, a language specific layer keeps independent boundary features, a language family layer achieves intra-family
knowledge sharing through soft boundary partitioning, and a basic
semantic layer captures a cross-language universal
vulnerability mode; performing cross-language
semantic alignment in combination with unified representation learning and a CWE standard; end-to-end detection is realized through a pre-training
encoder, a cross-attention mechanism and a language family adapter network. The method has the advantages that the overall F1
score of 88.2% is achieved on eight
programming languages and 82 vulnerability types, the problem of sample imbalance can be effectively solved, and a unified security detection solution is provided for modern multi-language
software projects.