# US 10,044,747 B2 · Method, system, and computer program product for automatically mitigating vulnerabilities in source code

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 10,044,747 B2
- Document ID: US10044747B2
- Status: Granted
- Kind: B2
- Application number: 15/465,603
- Filed: 2017-03-22
- Published: 2017-07-06
- Granted: 2018-08-07
- Earliest claimed: 2013-05-29
- Assignees: Lucent Sky Corporation
- Applicants: Lucent Sky Corporation
- Inventors: Jim Liu
- Web page: https://patentgrep.com/patent/US10044747B2

## CPC

- H04L 63/1433: {Vulnerability analysis}
- G06F 8/41: Compilation
- G06F 8/42: {Syntactic analysis}
- G06F 8/43: {Checking; Contextual analysis}
- G06F 21/53: by executing in a restricted environment, e.g. sandbox or secure virtual machine
- G06F 21/577: {Assessing vulnerabilities and evaluating computer system security}
- H04L 63/14: {for detecting or protecting against malicious traffic}
- H04L 63/1425: {Traffic logging, e.g. anomaly detection}
- H04L 63/1466: {Active attacks involving interception, injection, modification, spoofing of data unit addresses, e.g. hijacking, packet injection or TCP sequence number attacks}
- G06F 2221/033: Test or assess software
- H04L: TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION (arrangements common to telegraphic and telephonic communication H04M)
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A method for automatically mitigating vulnerabilities in a source code of an application is provided in the present invention. The method includes the following steps. First, the source code is complied, and a path graph is built according to the compiled source code. The path graph includes a plurality of paths traversing from sources to sinks, and each of the paths includes a plurality of nodes. Then, at least one tainted path is identified by enabling a plurality of vulnerability rules. Each of the at least one tainted path corresponds to a vulnerability, and each of the at least one vulnerability corresponds to a sanitization method. Then, the at least one vulnerability is determined if it is mitigable. If the at least one vulnerability is mitigable, the at least one vulnerability is mitigated automatically. Furthermore, the method may be implemented as a system and a computer program product.

## Claims

### Claim 1

A method for automatically mitigating vulnerabilities in a source code of an application via static analysis comprising:
building a path graph according to the source code, wherein the path graph comprises a plurality of paths traversing from sources to sinks, and wherein each of the paths comprises a plurality of nodes;
identifying at least one tainted path from the path graph, wherein each of the at least one tainted path corresponds to a vulnerability;
locating a target node in each of the at least one tainted path based on an existence of a tainted object and confidence of a corresponding instant-fix call comprising:
obtaining a confidence score of the instant-fixed call corresponding to the tainted object on a current node;
determining whether to set the current node as the target node according to the confidence score; and
setting a next node as the current node in response to the confidence score being not greater than a confidence threshold; and
mitigating at least one vulnerability in the target node in each of the at least one tainted path automatically.

### Claim 2 (depends on 1)

The method of claim 1, wherein the step of locating the target node in each of the at least one tainted path based on the existence of the tainted object and the confidence of the instant-fix call comprises:
applying the instant-fix call at the tainted object on a current node based on a corresponding vulnerability rule;
determining a validity of the instant-fix call; and
setting the current node as the target node in response to the instant-fix call is determined valid.

### Claim 3 (depends on 2)

The method of claim 2 further comprising:
setting a confidence score of the instant-fix call as high in response to the instant-fix call is determined valid;
writing the target node, the confidence score and an amended source code corresponding to the instant-fix call into a database.

### Claim 4 (depends on 2)

The method of claim 2 further comprising:
setting a confidence score of the instant-fix call as low and identifying a new target node in response to the instant-fix call is determined invalid;
writing the target node, the confidence score and an amended source code corresponding to the instant-fix call into a database.

### Claim 5 (depends on 2)

The method of claim 2, wherein the step of determining the validity of the instant-fix call comprises:
determining whether a copy of an amend source code corresponding to the instant-fix call is compliable;
if yes, the instant-fix call is determined to be valid; and
if no, the instant-fix call is determined to be invalid.

### Claim 6 (depends on 2)

The method of claim 2, wherein the step of determining the validity of the instant-fix call comprises:
determining whether a copy of an amend source code is legal;
if yes, the instant-fix call is determined to be valid; and
if no, the instant-fix call is determined to be invalid.

### Claim 7 (depends on 1)

The method of claim 1 further comprising:
determining whether the vulnerability is an injection including certain string constants; and
lowering the confidence score in response to the vulnerability being the injection including the certain string constants.

### Claim 8 (depends on 1)

The method of claim 1 further comprising:
determining whether the vulnerability is an injection including certain functions; and
lowering the confidence score in response to the vulnerability being the injection including the certain known functions.

### Claim 9 (depends on 2)

The method of claim 2, wherein when the current node corresponds to different vulnerabilities, the step of applying the instant-fix call at the tainted object on the current node based on the corresponding vulnerability rule comprising:
applying multiple instant-fix calls on the different vulnerabilities in the current node.

### Claim 10

A system for automatically mitigating vulnerabilities in a source code of an application comprising:
a memory;
a database;
a processor coupled to the memory and the database, wherein the processor performs an operation for automatically mitigating vulnerabilities in the source code of the application, the operation comprising:
building a path graph according to the source code, wherein the path graph comprises a plurality of paths traversing from sources to sinks, and wherein each of the paths comprises a plurality of nodes;
identifying at least one tainted path from the path graph, wherein each of the at least one tainted path corresponds to a vulnerability;
locating a target node in each of the at least one tainted path based on an existence of a tainted object and confidence of a corresponding instant-fix call comprising:
obtaining a confidence score of the instant-fixed call corresponding to the tainted object on a current node;
determining whether to set the current node as the target node according to the confidence score; and
setting a next node as the current node in response to the confidence score being not greater than a confidence threshold; and
mitigating at least one vulnerability in the target node in each of the at least one tainted path automatically.

### Claim 11 (depends on 10)

The system of claim 10, wherein the processor applies the instant-fix call at the tainted object on a current node based on a corresponding vulnerability rule, determines a validity of the instant-fix call, and sets the current node as the target node in response to the instant-fix call is determined valid.

### Claim 12 (depends on 11)

The system of claim 11, wherein the processor further sets a confidence score of the instant-fix call as high in response to the instant-fix call is determined valid and writes the target node, the confidence score and an amended source code corresponding to the instant-fix call into a database.

### Claim 13 (depends on 11)

The system of claim 11, wherein the processor further sets a confidence score of the instant-fix call as low and identifies a new target node in response to the instant-fix call is determined invalid and writes the target node, the confidence score and an amended source code corresponding to the instant-fix call into a database.

### Claim 14

A non-transitory computer-readable medium comprising a plurality of program instructions, which when executed by a computer system, cause the computer system to execute steps of:
building a path graph according to the source code, wherein the path graph comprises a plurality of paths traversing from sources to sinks, and wherein each of the paths comprises a plurality of nodes;
identifying at least one tainted path from the path graph, wherein each of the at least one tainted path corresponds to a vulnerability;
locating a target node in each of the at least one tainted path based on an existence of a tainted object and confidence of a corresponding instant-fix call comprising:
obtaining a confidence score of the instant-fixed call corresponding to the tainted object on a current node;
determining whether to set the current node as the target node according to the confidence score; and
setting a next node as the current node in response to the confidence score being not greater than a confidence threshold; and
mitigating at least one vulnerability in the target node in each of the at least one tainted path automatically.
