The invention relates to the field of code
vulnerability detection, in particular to a
vulnerability detection method and
system based on code block features. The method comprises the steps that firstly, a binary file is analyzed, and a
machine instruction is analyzed through a
hybrid disassembling engine; secondly, performing static linear scanning on the extracted binary file instruction, constructing a
control flow graph, dividing basic blocks, extracting an operation code sequence in the basic blocks, and constructing a cross-basic-block
data dependency graph and a
system calling sequence called by the basic blocks; secondly, using an LSH
algorithm to realize rapid filtering, performing similarity comparison on extracted
basic block features and
vulnerability feature
library features, realizing coarse-grained matching, and screening out a matching candidate set;
feature fusion is carried out on the candidate set
basic block operation code sequence, the
basic block data dependency graph and the
system calling sequence called by the basic block, GNN fine-grained matching is carried out on the fused features, and
vulnerability detection is carried out. The problems that traditional binary
vulnerability detection is poor in adaptability and low in result reliability are solved.