| Memory related vulnerability is a kind of software vulnerability that mostly exists at the kernel of the system and has a high risk factor.This kind of vulnerability often causes denial of service attack,computer performance degradation,program crash and other hazards.Its representative vulnerabilities include memory leak,use after free and double free and so on.In order to efficiently detect memory class vulnerabilities,a memory related vulnerability detection method based on feature slice and Bi-GRU is proposed in this thesis.The main contents of this thesis are as follows:Firstly,in order to reduce the code irrelevant to the characteristics of memory related vulnerabilities and improve the efficiency of detection,this thesis uses graph structure as the intermediate representation of the code.In this process,the construction methods of code slice based on graph structure are proposed: Firs step,extract the control dependency and data dependency in the program,construct the program dependency graph(PDG).This process will generate the structure feature code slice.The second step,To improve the PDG,extract the characteristics of the close combination of memory related vulnerabilities and pointers.In the end,construct the pointer related program dependency graph(P-PDG).Combined with P-PDG,the source program is analyzed inter-procedurally,and the inter-procedural semantic feature slice will be generated.Secondly,aiming at the problem that neural network can not directly identify and deal with text type,a semantic feature vector generation algorithm is proposed.In order to convert the slice of text type into the form of digital sequence,Word2 vec is used to train the words contained in the slice of inter-procedural semantic feature code.A corpus containing memory related vulnerability structure and semantic features will be generated.The semantic feature vector can be obtained by mapping the code line in the program to be detected with the corpus.Thirdly,combining memory related vulnerability detection with deep learning,a memory related vulnerability detection model based on Bi-GRU recurrent neural network is constructed.Input the semantic feature vector and its corresponding tag into the detection model,and the model will automatically learn the characteristics of memory related vulnerabilities and give feedback on whether the code contains memory related vulnerabilities.Finally,six kinds of memory related vulnerability codes in Juliet data set are selected to evaluate the performance of the model,and compared with other memory related vulnerability detection methods.Experiment show that using this method to detect memory vulnerabilities greatly reduces the labor cost,shortens the detection time,and performs well under the evaluation indexes such as detection accuracy,recall rate,false positive rate and false positive rate. |