IP Library Granted Patent US 11,568,055
Granted Patent B2
US 11,568,055 · App. 16/549,019 · Granted Jan 31, 2023

System and method for automatically detecting a security vulnerability in a source code using a machine learning model

Inventors: Jeff Olson (Austin, TX); Matthew Kindy, II (Austin, TX)
Assignee: Praetorian
G06F21/577G06F16/9024G06F16/9027G06N20/00
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 11,568,055
App. No.
16/549,019
Filed
Aug 23, 2019
Granted
Jan 31, 2023
Kind
B2
Art Unit
2437
USPC
726/25
Abstract

A method for (of) automatically detecting a security vulnerability in a source code using a machine learning model, characterized in that the method includes: obtaining the source code from a client codebase, wherein the client codebase is a complete or an incomplete body of the source code for a given software program or an application; and using a machine learning (ML) model to perform a ML based analysis on an abstract syntax tree (AST) for detecting a first security vulnerability over a static source code, the machine learning based analysis comprise (i) flattening the abstract syntax tree (AST) into a sequence of structured tokens, wherein the sequence of structured tokens includes a semantic structure and a syntactic structure of the source code, (ii) implementing a natural language processing technique on the sequence of structured tokens for mapping the sequence of structured tokens to one or more integers, (iii) pre-training the machine learning model using an unlabeled source code as an input to predict a subsequent sub-token in the sequence of structured tokens and (iv) training the machine learning model on a labeled source code to predict a presence or an absence of the first security vulnerability.

Claims (44)

1. A method for (of) automatically detecting a security vulnerability in a source code using a machine learning model, wherein the method comprises:

obtaining the source code from a client codebase, wherein the client codebase is a complete or an incomplete body of the source code for a given software program or an application; and

parsing the source code into an abstract syntax tree (AST);

using a machine learning (ML) model to perform a ML based analysis on the abstract syntax tree (AST) for detecting a first security vulnerability over a static source code, the machine learning based analysis comprising:

flattening the abstract syntax tree (AST) into a sequence of structured tokens, wherein the sequence of structured tokens comprises a semantic structure and a syntactic structure of the source code,

implementing a natural language processing technique on the sequence of structured tokens for mapping the sequence of structured tokens to one or more integers, wherein the natural language processing comprises Byte Pair Encoding (BPE);

pre-training the machine learning model using an unlabeled source code as an input to predict a subsequent sub-token in the sequence of structured tokens, and

training the machine learning model on a labeled source code to predict a presence or an absence of the first security vulnerability.

2. A method according to claim 1 , wherein the method comprises detecting a second security vulnerability before compilation of the source code by performing a static analysis on a vectorized call graph.

3. A method according to claim 2 , wherein the method comprises detecting a third security vulnerability during the compilation of the source code by performing a library analysis on the vectorized call graph.

4. A method according to claim 3 , wherein the method comprises performing, using the machine learning model, a post-analysis on the first security vulnerability, the second security vulnerability, and the third security vulnerability to predict a final security vulnerability.

5. A method according to claim 4 , wherein the method comprises providing the final security vulnerability on an expert device for receiving a first input from a security expert.

6. A method according to claim 5 , wherein the method comprises processing the first input on the final security vulnerability, wherein the first input comprises a feedback associated with the final security vulnerability.

7. A method according to claim 5 , wherein the method comprises providing the first input on the final security vulnerability as training data to train the machine learning model and to improve an accuracy of the prediction of a presence of security vulnerabilities within the source code.

8. A method according to claim 4 , wherein the method comprises providing the final security vulnerability to a user on a user device.

9. A method according to claim 3 , wherein the method comprises generating a call graph by integrating the abstract syntax tree (AST) with a control and a dataflow of the source code, wherein the call graph represents calling relationships between subroutines in a computer program.

10. A method according to claim 9 , wherein the method comprises implementing an embedded technique on the call graph to generate the vectorized call graph.

11. A method according to claim 3 , wherein the library analysis is performed using a software component analysis tool.

12. A method according to claim 1 , wherein the method comprises generating a database with the source code and its associated metadata, wherein the source code comprises the unlabeled source code and the labeled source code.

13. A method according to claim 1 , wherein the abstract syntax tree (AST) is a tree representation of an abstract syntactic structure of the source code written in a programming language.

14. A method according to claim 1 , wherein the source code comprises at least one of a method, a class, a package or variable names along with comments and string literals.

15. A computer program product comprising instructions to cause the system to carry out the method of claim 1 .

16. A method according to claim 1 , wherein the method comprises:

developing an intelligent static analysis tool using natural language aspects of the source code; and

analyzing and learning an statistical model of the natural aspects of the source code enabling the machine learning model to generalize to patterns and APIs not seen during training or not known/built-in to a static analysis tool.

17. A system for (of) automatically detecting a security vulnerability in a source code using a machine learning model, wherein the system comprises:

one or more processors;

one or more non-transitory computer-readable mediums storing one or more sequences of instructions, which when executed by the one or more processors, cause:

obtaining the source code from a client codebase, wherein the client codebase is a complete or an incomplete body of the source code for a given software program or an application; and

using, a machine learning (ML) model to perform a ML based analysis on an abstract syntax tree (AST) for detecting a first security vulnerability over a static source code, the machine learning based analysis comprising:

flattening the abstract syntax tree (AST) into a sequence of structured tokens, wherein the sequence of structured tokens comprises a semantic structure and a syntactic structure of the source code,

implementing a natural language processing technique on the sequence of structured tokens for mapping the sequence of structured tokens to one or more integers, wherein the natural language processing comprises a Byte Pair Encoding (BPE); and,

pre-training the machine learning model using an unlabeled source code as an input to predict a subsequent sub-token in the sequence of structured tokens, and training the machine learning model on a labeled source code to predict a presence or an absence of the first security vulnerability.

18. A system according to claim 17 , wherein the one or more processors is configured to detect a second security vulnerability before compilation of the source code by performing a static analysis on a vectorized call graph.

19. A system according to claim 18 , wherein the one or more processors is configured to detect a third security vulnerability during the compilation of the source code by performing a library analysis on the vectorized call graph.

20. A system according to claim 19 , wherein the one or more processors is configured to perform, using the machine learning model, a post-analysis on the first security vulnerability, the second security vulnerability, and the third security vulnerability to predict a final security vulnerability.

21. A system according to claim 20 , wherein the one or more processors is configured to provide the final security vulnerability on an expert device for receiving a first input from a security expert.

22. A system according to claim 21 , wherein the one or more processors is configured to process the first input on the final security vulnerability, wherein the first input comprises a feedback associated with the final security vulnerability.

23. A system according to claim 21 , wherein the one or more processors is configured to provide the first input on the final security vulnerability as training data to train the machine learning model and to improve an accuracy of the prediction of a presence of vulnerabilities within the source code.

24. A system according to claim 19 , wherein the one or more processors is configured to generate a call graph by integrating the abstract syntax tree (AST) with a control and a dataflow of the source code, wherein the call graph represents calling relationships between subroutines in a computer program.

25. A system according to claim 24 , wherein the one or more processors is configured to implement an embedded technique on the call graph to generate the vectorized call graph.

26. A system according to claim 17 , wherein the one or more processors is configured to generate a database with the source code and its associated metadata, wherein the source code comprises the unlabeled source code and the labeled source code.

27. A system according to claim 17 , wherein the abstract syntax tree (AST) is a tree representation of an abstract syntactic structure of the source code written in a programming language.

28. A system according to claim 17 , wherein the one or more processors is configured to develop an intelligent static analysis tool using natural language aspects of the source code and analyze and learn an statistical model of the natural aspects of the source code enabling the machine learning model to generalize to patterns and APIs not seen during training or not known/built-in to a static analysis tool.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Feb 19, 2020
From: OLSON, JEFF; KINDY, MATTHEW
To: PRAETORIAN
Reel/Frame 051856/0899 →
Continuity (1)
Related Publication 20210056211A1 · Feb 25, 2021
Cited By (3)
US 12,360,745 US 12,499,241 US 12,517,812