The invention relates to a hook function-based static memory
vulnerability mining method, which comprises the following steps of S1, performing operations such as
lexical analysis and the like on a
source code through a Clang
compiler LLVM, S2, using the LLVM as a generator of a back-end code, and generating an IR, S3, generating a
control flow graph CFG and a program
dependency graph PDG based on the IR, S4, generating a code attribute graph CPG based on AST, CFG and PDG, and S5, selecting OverflowDB or Neo4J for a
graph database, the method comprises the steps of S1, analyzing code features of a hook function, S6, searching for a proper DSL attribute relation according to the analyzed code features to operate a
graph database, S7, using Function Access to develop a queried Checker according to the code features of the hook function, S8, finding a static scanning tool supporting a
stain scanning model, S9, generating a configuration format matched with a current tool, and S9, executing the step S9. And S10, starting mining according to the hook configuration, the
stain model of the static tool and the
stain Checker supported by the stain. The problems of high
false alarm and
low income of current
memory problems are solved, and the
system integrity risk is reduced and the
system robustness is enhanced through
deep mining.