# US 2017/0195361 A1 · 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 2017/0195361 A1
- Document ID: US20170195361A1
- Status: Published application
- Kind: A1
- Application number: 15/465,603
- Filed: 2017-03-22
- Published: 2017-07-06
- Earliest claimed: 2013-05-29
- Assignees: Lucent Sky Corporation
- Applicants: Lucent Sky Corporation
- Inventors: Jim Liu
- Web page: https://patentgrep.com/patent/US20170195361A1

## 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; 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 compilable;
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, 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 corresponding instant-fix call comprises:
obtaining a confidence score of the instant-fixed call corresponding to the tainted object on a current node; and
determining whether to set the current node as the target node according to the confidence score.

### Claim 8 (depends on 7)

The method of claim 7 further comprising:
setting a next node as the current node in response to the confidence score being not greater than a confidence threshold.

### Claim 9 (depends on 7)

The method of claim 7 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 10 (depends on 7)

The method of claim 7 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 11 (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 12

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; and
mitigating at least one vulnerability in the target node in each of the at least one tainted path automatically.

### Claim 13 (depends on 12)

The system of claim 12, 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 14 (depends on 13)

The system of claim 13, 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 15 (depends on 13)

The system of claim 13, 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 16 (depends on 12)

The system of claim 12, wherein the processor obtains a confidence score of the instant-fixed call corresponding to the tainted object on a current node and determines whether to set the current node as the target node according to the confidence score, wherein the processor sets a next node as the current node in response to the confidence score being not greater than a confidence threshold.

### Claim 17 (depends on 1)

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 the method according to claim 1.
