# US 2025/0378174 A1 · Intelligent contract vulnerability detection method and apparatus, and device

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

- Number: US 2025/0378174 A1
- Document ID: US20250378174A1
- Status: Published application
- Kind: A1
- Application number: 18/877,228
- Filed: 2023-06-25
- Published: 2025-12-11
- Earliest claimed: 2022-06-27
- Assignees: Digital Currency Institute , the People’s Bank of China
- Applicants: Digital Currency Institute , the People’s Bank of China
- Inventors: Ziqiang LIU
- Web page: https://patentgrep.com/patent/US20250378174A1

## CPC

- G06F 21/577: {Assessing vulnerabilities and evaluating computer system security}
- G06F 21/552: {involving long-term monitoring or reporting}
- G06F 21/64: Protecting data integrity, e.g. using checksums, certificates or signatures
- H04L 63/1433: {Vulnerability analysis}
- G06F 2221/034: Test or assess a computer or a system
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)
- H04L: TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION (arrangements common to telegraphic and telephonic communication H04M)

## Abstract

An intelligent contract vulnerability detection method, which comprises: obtaining formalized deployment information of the intelligent contract, wherein the formalized deployment information comprises a formalized initial state and a formalized behavior list, and the formalized behavior list comprises an initialization execution function and a behavior function of the intelligent contract; executing an initialization execution function and a behavior function in the formalized behavior list on the basis of the formalized initial state to obtain an execution result of the intelligent contract; and evaluating the execution result of the intelligent contract according to a formalized specification library of the intelligent contract to obtain a vulnerability detection result, wherein the formalized specification library comprises formalized specifications of the intelligent contract. The present method relates to the technical field of block chains, and can improve the detection precision of vulnerability detection for smart contracts.

## Claims

### Claim 1

A method for detecting a vulnerability in a smart contract, applied to a virtual machine server, comprising:
obtaining formalized deployment information of the smart contract, wherein the formalized deployment information comprises a formalized initial state and a formalized behavior list, and the formalized behavior list comprises an initialization execution function and a behavior function of the smart contract;
executing the initialization execution function and the behavior function comprised in the formalized behavior list based on the formalized initial state to obtain an execution result of the smart contract; and
detecting the execution result of the smart contract based on a formalized specification library of the smart contract to obtain a vulnerability detection result, wherein the formalized specification library comprises a formalized specification of the smart contract.

### Claim 2 (depends on 1)

The method according to claim 1, wherein the detecting the execution result of the smart contract based on a formalized specification library of the smart contract to obtain a vulnerability detection result comprises:
detecting, for each behavior function, whether the execution result obtained by executing the initialization execution function and the behavior function based on the formalized initial state conforms to the formalized specification;
establishing a correlative relationship between the execution result and the formalized initial state, and making the execution result as a new formalized initial state be comprised in the formalized deployment information in a case that the execution result is not comprised in the formalized deployment information, if it is detected that the execution result conforms to the formalized specification; and
reporting an error message if it is detected that the execution result does not conform to the formalized specification.

### Claim 3 (depends on 2)

The method according to claim 2, further comprising:
constructing a directed graph, wherein the directed graph comprises a node corresponding to the formalized initial state, and any two nodes with a correlative relationship are connected via a directed edge, and wherein
the establishing a correlative relationship between the execution result and the formalized initial state if it is detected that the execution result conforms to the formalized specification comprises:
determining whether a node corresponding to the execution result exists in the directed graph if it is detected that the execution result conforms to the formalized specification;
setting a directed edge pointing from the initial state to the node if the node exists; and
adding the execution result to the directed graph and setting a directed edge pointing from the initial state to a node corresponding to the execution result, if no node corresponding to the execution result.

### Claim 4 (depends on 1)

The method according to claim 1, wherein the formalized deployment information comprises a plurality of formalized initial states, and the method further comprises:
determining an execution queue based on the plurality of formalized initial states, wherein the execution queue comprises a formalized initial state conforming to the formalized specification among the plurality of formalized initial states; wherein
the executing the initialization execution function and the behavior function comprised in the formalized behavior list based on the formalized initial state comprises:
executing the initialization execution function and the behavior function comprised in the formalized behavior list based on each of the plurality of formalized initial states in the execution queue.

### Claim 5 (depends on 1)

The method according to claim 1, further comprising:
determining a customized formalized specification of the smart contract based on requirement information of the smart contract; and
adding the customized formalized specification to the formalized specification library.

### Claim 6 (depends on 5)

The method according to claim 5, wherein the formalized specification library further comprises a general specification, the general specification represents the formalized specification for each smart contract of a plurality of smart contracts, and after the adding the customized formalized specification to the formalized specification library, the method further comprises:
replacing the general specification with the customized formalized specification of the smart contract.

### Claim 7 (depends on 1)

The method according to claim 1, wherein the obtaining formalized deployment information of the smart contract comprises:
obtaining the smart contract; and
analyzing the smart contract to obtain the formalized initial state and the formalized behavior list.

### Claim 8 (depends on 7)

The method according to claim 7, wherein the smart contract is stored in an electronic device, the virtual machine server is communicatively connected to the electronic device, and the obtaining the smart contract comprises:
obtaining the smart contract from the electronic device.

### Claim 9 (depends on 4)

The method according to claim 4, wherein each of the plurality of formalized initial states conforms to the formalized specification, or some of the plurality of formalized initial states conform to the formalized specification.

### Claim 10 (depends on 1)

The method according to claim 1, wherein the virtual machine server is configured with a data repository, and after the obtaining the formalized deployment information of the smart contract, the method further comprises:
storing the formalized deployment information of the smart contract in the data repository.

### Claim 11 (depends on 1)

The method according to claim 1, wherein the initialization execution function initializes the virtual machine server.

### Claim 12 (depends on 1)

The method according to claim 1, wherein the behavior function represents a transaction rule for performing transaction between various accounts.

### Claim 13

(canceled)

### Claim 14

An electronic apparatus, comprising a memory, a processor, and a computer program stored on the memory and executable by the processor, wherein
the computer program, when being executed by the processor, causes the processor to:
obtain formalized deployment information of a smart contract, wherein the formalized deployment information comprises a formalized initial state and a formalized behavior list, and the formalized behavior list comprises an initialization execution function and a behavior function of the smart contract;
execute the initialization execution function and the behavior function comprised in the formalized behavior list based on the formalized initial state to obtain an execution result of the smart contract; and
detect the execution result of the smart contract based on a formalized specification library of the smart contract to obtain a vulnerability detection result, wherein the formalized specification library comprises a formalized specification of the smart contract.

### Claim 15

A non-transitory computer-readable storage medium, storing a computer program, wherein
the computer program, when being executed by a processor, causes the processor to:
obtain formalized deployment information of a smart contract, wherein the formalized deployment information comprises a formalized initial state and a formalized behavior list, and the formalized behavior list comprises an initialization execution function and a behavior function of the smart contract;
execute the initialization execution function and the behavior function comprised in the formalized behavior list based on the formalized initial state to obtain an execution result of the smart contract; and
detect the execution result of the smart contract based on a formalized specification library of the smart contract to obtain a vulnerability detection result, wherein the formalized specification library comprises a formalized specification of the smart contract.

### Claim 16 (depends on 14)

The electronic apparatus according to claim 14, wherein for detecting the execution result of the smart contract based on the formalized specification library of the smart contract to obtain the vulnerability detection result, the computer program, when being executed by the processor, causes the processor to:
detect, for each behavior function, whether the execution result obtained by executing the initialization execution function and the behavior function based on the formalized initial state conforms to the formalized specification;
establish a correlative relationship between the execution result and the formalized initial state, and make the execution result as a new formalized initial state be comprised in the formalized deployment information in a case that the execution result is not comprised in the formalized deployment information, if it is detected that the execution result conforms to the formalized specification; and
report an error message if it is detected that the execution result does not conform to the formalized specification.

### Claim 17 (depends on 16)

The electronic apparatus according to claim 16, wherein the computer program, when being executed by the processor, causes the processor to:
construct a directed graph, wherein the directed graph comprises a node corresponding to the formalized initial state, and any two nodes with a correlative relationship are connected via a directed edge, and wherein
for establishing the correlative relationship between the execution result and the formalized initial state if it is detected that the execution result conforms to the formalized specification, the computer program, when being executed by the processor, causes the processor to:
determine whether a node corresponding to the execution result exists in the directed graph if it is detected that the execution result conforms to the formalized specification;
set a directed edge pointing from the initial state to the node if the node exists; and
add the execution result to the directed graph and set a directed edge pointing from the initial state to a node corresponding to the execution result, if no node corresponding to the execution result.

### Claim 18 (depends on 14)

The electronic apparatus according to claim 14, wherein the formalized deployment information comprises a plurality of formalized initial states, and the computer program, when being executed by the processor, causes the processor to:
determine an execution queue based on the plurality of formalized initial states, wherein the execution queue comprises a formalized initial state conforming to the formalized specification among the plurality of formalized initial states; and wherein
for executing the initialization execution function and the behavior function comprised in the formalized behavior list based on the formalized initial state, the computer program, when being executed by the processor, causes the processor to:
execute the initialization execution function and the behavior function comprised in the formalized behavior list based on each of the plurality of formalized initial states in the execution queue.

### Claim 19 (depends on 14)

The electronic apparatus according to claim 14, wherein the computer program, when being executed by the processor, causes the processor to:
determine a customized formalized specification of the smart contract based on requirement information of the smart contract; and
add the customized formalized specification to the formalized specification library.

### Claim 20 (depends on 19)

The electronic apparatus according to claim 19, wherein the formalized specification library further comprises a general specification, the general specification represents the formalized specification for each smart contract of a plurality of smart contracts, and after the adding the customized formalized specification to the formalized specification library, the computer program, when being executed by the processor, causes the processor to:
replace the general specification with the customized formalized specification of the smart contract.

### Claim 21 (depends on 14)

The electronic apparatus according to claim 14, wherein the computer program, when being executed by the processor, causes the processor to:
obtain the smart contract; and
analyze the smart contract to obtain the formalized initial state and the formalized behavior list.
