# US 2023/0266948 A1 · Method for extracting the structure of an input for a binary program

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

- Number: US 2023/0266948 A1
- Document ID: US20230266948A1
- Status: Published application
- Kind: A1
- Application number: 18/110,835
- Filed: 2023-02-16
- Published: 2023-08-24
- Earliest claimed: 2022-02-18
- Assignees: University of Louisiana Lafayette
- Applicants: University of Louisiana Lafayette
- Inventors: Seshagiri Prabhu NARASIMHA; Arun Lakhotia
- Web page: https://patentgrep.com/patent/US20230266948A1

## CPC

- G06F 8/30: Creation or generation of source code
- G06F 9/4498: {Finite state machines}
- G06F 8/74: Reverse engineering; Extracting design information from source code
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Herein disclosed is a method for automatically automatically infer a recursive state machine (RSM) describing the space of acceptable input of an arbitrary binary program. This method automatically identifies atomic fields of fixed and variable lengths and syntactic elements, such as separators and terminators, and generalizes them into regular expression tokens. It constructs an RSM of tokens to represent structures such as arrays and records. Further, it constructs nested states in RSM to represent complex, nested structures. The RSM may serve as an independent parser for the program's acceptable input.

## Claims

### Claim 1

A method for extracting the structure of a binary program, comprising:
(a) providing a state machine;
(b) providing one or more inputs comprising a serialized representation of a data structure,
wherein said data structure comprises one or more fields and wherein such fields are atomic or composite;
wherein each atomic field of the data structure comprises one or more values, comprising a sequence of bytes;
wherein a token comprises an abstract representation of the values of a field;
(c) producing a taint trace comprising a sequence of tuples;
(d) from the taint-trace, identifying one or more field values and each field value's corresponding source index;
(e) constructing a taint interval tree;
(f) deriving one or more field tokens;
(g) classifying each of a set of instructions that accesses the one or more values of a field;
(h) inferring a field type for each set of instructions using the classifications of each set;
(i) constructing a structure transition graph; and
(j) applying the step
(k) recursively to construct a recursive state machine.

### Claim 2 (depends on 1)

The method of claim 1, wherein a state machine is derived by:
(a) creating a graph representing the structure of the state machine comprising a plurality of nodes, wherein each node of the graph represents a field, comprising:
(i) partitioning an input into a sequence of values;
(ii) computing a sequence of fields by replacing each value with the field to which it belongs;
wherein each field comprises one node;
wherein a one or more edges of the graph reflect an ordering of the fields; and
wherein a first element and a last element of a field sequence identify a first node and final node of the state machine; and
(b) populating each node with one or more tokens computed from values belonging to the corresponding field.

### Claim 3 (depends on 1)

The method of claim 1, wherein the state machine is derived by:
(a) creating a graph representing the structure of the state machine, wherein each node of the graph represents a field, comprising:
(i) partitioning an input into a sequence of values;
(ii) computing a sequence of fields by replacing each value with the field to which it belongs;
wherein each field comprises one node;
wherein a one or more edges of the graph reflect an ordering of the fields; and
wherein a first element and a last element of a field sequence identify a first node and final node of the state machine; and
(b) populating each node with one or more tokens computed from values belonging to the corresponding field, comprising creating a regular expression that recognizes all values belonging to a field.

### Claim 4 (depends on 1)

The method of claim 1, wherein constructing the taint interval tree comprises:
(a) constructing a taint interval graph;
(b) converting said taint interval graph into a taint interval tree;
(c) performing a level order traversal of the tain interval tree; and
(d) ordering one or more nodes according to each nodes' respective interval start offset.

### Claim 5 (depends on 1)

The method of claim 1, wherein deriving one or more field tokens comprises:
(a) collecting one or more taint interval graph nodes with identical source indexes; and
(b) generalizing said taint interval graph nodes raw byte values.

### Claim 6 (depends on 1)

The method of claim 1, wherein constructing the structure transition graph comprises:
(a) identifying one or more nodes of the taint interval graph with matching source index values;
(b) constructing a frontier of one or more taint interval graph nodes;
(c) constructing structure transition graph nodes; and
(d) adding structure transition graph edges.

### Claim 7 (depends on 6)

The method of claim 6, wherein the frontier comprises a sequence of taint interval graph nodes, ordered on each node's interval start offset;
wherein the intervals span all of the input data; and
wherein the interval offsets of consecutive pairs of nodes in the sequence do not overlap.

### Claim 8 (depends on 1)

The method of claim 1, wherein the taint trace is created using a taint tracker comprising functionality to:
(a) maintain separate taints for each input;
(b) taint each byte of an input, wherein said taint comprises the offset of said byte;
(c) propagate taint through a plurality of instructions;
(d) trace taint through a central processing unit flag;
(e) propagate taint through a plurality of library functions; and
(f) track an abstracted calling context.

### Claim 9 (depends on 1)

The method of claim 1, wherein the sequence of tuples comprises:
an instruction address;
an abstracted calling context; and
a set of taints, comprising the union of all taints of all operands of an instruction during an invocation of the instruction.

### Claim 10 (depends on 1)

The method of claim 1, wherein the tuples appearing in the taint trace are ordered in an invocation order of the instructions.

### Claim 11 (depends on 1)

The method of claim 1, wherein a source index in a taint trace denotes a field.

### Claim 12 (depends on 1)

The method of claim 1, wherein a field may be a numeric type or a string type.

### Claim 13 (depends on 4)

The method of claim 4, wherein the taint interval tree comprises two or more frontiers.

### Claim 14 (depends on 1)

The method of claim 1, wherein constructing the structure transition graph comprises:
(a) identifying one or more nodes of the taint interval graph with matching source index values;
(b) constructing a frontier of one or more taint interval graph nodes;
(c) constructing structure transition graph nodes; and
(d) adding structure transition graph edges.

### Claim 15 (depends on 12)

The method of claim 12, further comprising constructing a state machine from a frontier.

### Claim 16 (depends on 12)

The method of claim 12, further comprising constructing a state machine from a frontier, comprising:
(a) ordering one or more taint interval graph nodes in the frontier according to their start offsets;
(b) for each source index in the frontier, creating a node in the state machine;
(c) marking the source index of the last node in the frontier as the final node of the state machine;
(d) adding a new node;
(e) marking the new node as the start node;
(f) annotating each node with the token, type, and data encoding of its respective source index;
(g) adding edges to the taint interval graph; and
(h) adding a start edge.
