IP Library Granted Patent US 11,947,677
Granted Patent B2
US 11,947,677 · App. 17/011,637 · Granted Apr 2, 2024

Dynamic taint tracking in abstract syntax tree interpreters

Inventors: Daniele Bonetta (Amsterdam, NL); Alexander Jordan (Brisbane, AU); Christian Humer (Zurich, CH); Jacob Kreindl (Linz, AT)
Assignee: Oracle International Corporation
G06F21/577G06F8/427
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,947,677
App. No.
17/011,637
Granted
Apr 2, 2024
Kind
B2
Abstract

A method may include determining that a non-constant value of a variable corresponding to a variable node of the abstract syntax tree flows into an operator node in the abstract syntax tree. The method may further include adding, to the abstract syntax tree, a check taint node including functionality to: make a taint status determination that the non-constant value is tainted, and return the non-constant value to the operator node. The operator node generates a result value by executing an operator using the non-constant value. The method may further include adding, to the abstract syntax tree, a set taint node that stores, based on the taint status determination, the result value in a second tainted object, and performing, using the abstract syntax tree, a taint analysis of the source code to identify a vulnerability in the source code.

Claims (86)

1. A method comprising:

determining that a first non-constant value of a first variable corresponding to a first variable node of an abstract syntax tree flows into a first operator node in the abstract syntax tree, wherein the abstract syntax tree is generated from source code;

adding, to the abstract syntax tree between the first variable node and the first operator node, a first check taint node comprising functionality to:

make a first taint status determination that the first non-constant value is tainted,

return the first non-constant value to the first operator node, wherein the first operator node generates a first result value by executing a first operator using the first non-constant value, and

convey the first taint status determination to a first set taint node;

adding, to the abstract syntax tree, the first set taint node between the first operator node and a parent node of the first operator node,

wherein the first set taint node stores, based on the first taint status determination, the first result value in a first tainted object that identifies the first result value as tainted;

executing the abstract syntax tree, wherein executing the abstract syntax tree comprises processing the first check taint node and the first set taint node; and

while executing the abstract syntax tree, performing, using the abstract syntax tree, a taint analysis of the source code to identify a vulnerability in the source code.

2. The method of claim 1 ,

wherein the first taint status determination is based on the first non-constant value being stored in a second tainted object, and

wherein the first check taint node further comprises functionality to extract the first non-constant value from the second tainted object before returning the first non-constant value to the first operator node.

3. The method of claim 2 ,

wherein the source code is represented in a first programming language,

wherein the first operator node corresponds to an execution of a built-in operator implemented in a second programming language, and

wherein the second programming language implements an interpreter for the first programming language.

4. The method of claim 1 , wherein the first taint status determination is based on the first non-constant value being an object comprising a taint status flag indicating that the object is tainted.

5. The method of claim 1 , wherein executing the abstract syntax tree comprises:

making, by the first check taint node, a decision to perform taint propagation based on applying a policy for the first operator, wherein the policy comprises a rule that has an input qualifier specifying when, based on input to the first operator, to propagate a taint status of the inputs to results of the first operator.

6. The method of claim 1 , further comprising:

determining that a second non-constant value of a second variable corresponding to a second variable node in the abstract syntax tree flows into a second operator node in the abstract syntax tree, wherein the second non-constant value has a first type; and

adding, to the abstract syntax tree, a second check taint node comprising functionality to:

make a second taint status determination that the second non-constant value is tainted,

detect an implicit call to a function to convert the second non-constant value to a second type,

send the second non-constant value to the function, wherein the function generates a converted value having the second type using the second non-constant value, and

return the converted value to the second operator node in the abstract syntax tree, wherein the second operator node generates a second result value by executing a second operator using the converted value.

7. The method of claim 1 , further comprising:

observing that non-constant values of a second variable have been untainted during a series of executions of the abstract syntax tree; and

in response to observing that the non-constant values of the second variable have been untainted, replacing a second check taint node, added for the second variable, with an empty instrumentation node that returns a non-constant value of the first variable to the first operator node without making a taint status determination.

8. A system comprising:

a hardware computer processor;

a repository configured to store source code and an abstract syntax tree generated from the source code;

a taint propagation instrumenter, executing on the hardware computer processor and configured to:

determine that a first non-constant value of a first non-constant variable corresponding to a first variable node of the abstract syntax tree flows into a first operator node in the abstract syntax tree,

add, to the abstract syntax tree between the first variable node and the first operator node, a first check taint node comprising functionality to:

make a first taint status determination that the first non-constant value is tainted,

return the first non-constant value to the first operator node, wherein the first operator node generates a first result value by executing a first operator using the first non-constant value, and

convey the first taint status determination to a first set taint node, and

add, to the abstract syntax tree, the first set taint node between the first operator node and a parent node of the first operator node,

wherein the first set taint node stores based on the first taint status determination, the first result value in a first tainted object that identifies the first result value as tainted;

an abstract syntax tree interpreter, executing on the hardware computer processor and configured to execute the abstract syntax tree, wherein executing the abstract syntax tree comprises processing the first check taint node and the first set taint node; and

a taint analyzer, executing on the hardware computer processor and configured to:

perform, while executing the abstract syntax tree and using the abstract syntax tree, a taint analysis of the source code to identify a vulnerability in the source code.

9. The system of claim 8 ,

wherein the first taint status determination is based on the first non-constant value being stored in a second tainted object, and

wherein the first check taint node further comprises functionality to extract the first non-constant value from the second tainted object before returning the first non-constant value to the first operator node.

10. The system of claim 9 ,

wherein the source code is represented in a first programming language,

wherein the first operator node corresponds to an execution of a built-in operator implemented in a second programming language, and

wherein the second programming language implements an interpreter for the first programming language.

11. The system of claim 8 , wherein the first taint status determination is based on the first non-constant value being an object comprising a taint status flag indicating that the object is tainted.

12. The system of claim 8 , wherein the taint propagation instrumenter is further configured to:

make a decision to perform the taint propagation based on applying a policy for the first operator, wherein the first check taint node makes the first taint status determination in response to the decision to perform the taint propagation.

13. The system of claim 8 , wherein the taint propagation instrumenter is further configured to:

determine that a second non-constant value of a second variable corresponding to a second variable node in the abstract syntax tree flows into a second operator node in the abstract syntax tree, wherein the second non-constant value has a first type, and

add, to the abstract syntax tree, a second check taint node comprising functionality to:

make a second taint status determination that the second non-constant value is tainted,

detect an implicit call to a function to convert the second non-constant value to a second type,

send the second non-constant value to the function, wherein the function generates a converted value having the second type using the second non-constant value, and

return the converted value to the second operator node in the abstract syntax tree, wherein the second operator node generates a second result value by executing a second operator using the converted value.

14. The system of claim 8 , wherein the taint propagation instrumenter is further configured to:

observe that non-constant values of a second variable have been untainted during a series of executions of the abstract syntax tree, and

in response to observing that the non-constant values of the second variable have been untainted, replace a second check taint node, added for the second variable, with an empty instrumentation node that returns a non-constant value of the first non-constant variable to the first operator node without making a taint status determination.

15. A non-transitory computer readable medium comprising computer readable program code for causing a computer system to perform operations comprising:

determining that a first non-constant value of a first variable corresponding to a first variable node of an abstract syntax tree flows into a first operator node in the abstract syntax tree, wherein the abstract syntax tree is generated from source code;

adding, to the abstract syntax tree between the first variable node and the first operator node, a first check taint node comprising functionality to:

make a first taint status determination that the first non-constant value is tainted,

return the first non-constant value to the first operator node, wherein the first operator node generates a first result value by executing a first operator using the first non-constant value, and

convey the first taint status determination to a first set taint node;

adding, to the abstract syntax tree, the first set taint node between the first operator node and a parent node of the first operator node,

wherein the first set taint node stores, based on the first taint status determination, the first result value in a first tainted object that identifies the first result value as tainted;

executing the abstract syntax tree, wherein executing the abstract syntax tree comprises processing the first check taint node and the first set taint node; and

while executing the abstract syntax tree, performing, using the abstract syntax tree, a taint analysis of the source code to identify a vulnerability in the source code.

16. The non-transitory computer readable medium of claim 15 ,

wherein the first taint status determination is based on the first non-constant value being stored in a second tainted object, and

wherein the first check taint node further comprises functionality to extract the first non-constant value from the second tainted object before returning the first non-constant value to the first operator node.

17. The non-transitory computer readable medium of claim 16 ,

wherein the source code is represented in a first programming language,

wherein the first operator node corresponds to an execution of a built-in operator implemented in a second programming language, and

wherein the second programming language implements an interpreter for the first programming language.

18. The non-transitory computer readable medium of claim 15 , wherein executing the abstract syntax tree comprises:

making, by the first check taint node, a decision to perform taint propagation based on applying a policy for the first operator, wherein the policy comprises a rule that has an input qualifier specifying when, based on input to the first operator, to propagate a taint status of the inputs to results of the first operator.

19. The non-transitory computer readable medium of claim 15 , the operations further comprising:

observing that non-constant values of a second variable have been untainted during a series of executions of the abstract syntax tree; and

in response to observing that the non-constant values of the second variable have been untainted, replacing a second check taint node, added for the second variable, with an empty instrumentation node that returns a non-constant value of the first variable to the first operator node without making a taint status determination.

Assignments (2)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Jan 12, 2024
From: KREINDL, JACOB
To: ORACLE INTERNATIONAL CORPORATION
Reel/Frame 066113/0292 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Sep 4, 2020
From: BONETTA, DANIELE; JORDAN, ALEXANDER; HUMER, CHRISTIAN
To: ORACLE INTERNATIONAL CORPORATION
Reel/Frame 053692/0900 →
Continuity (1)
Related Publication 20220067172A1 · Mar 3, 2022