# US 2024/0004967 A1 · Software protection method and apparatus, electronic device, and storage medium

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

- Number: US 2024/0004967 A1
- Document ID: US20240004967A1
- Status: Published application
- Kind: A1
- Application number: 18/467,252
- Filed: 2023-09-14
- Published: 2024-01-04
- Earliest claimed: 2021-03-15
- Assignees: Tsinghua University
- Applicants: Tsinghua University
- Inventors: Chao ZHANG; Wende TAN; Yuan LI; Ying LIU; Jianping WU
- Web page: https://patentgrep.com/patent/US20240004967A1

## CPC

- G06F 8/434: {Pointers; Aliasing}
- G06F 21/121: {Restricting unauthorised execution of programs}
- G06F 21/125: {by manipulating the program code, e.g. source code, compiled code, interpreted code, machine code}
- G06F 21/52: during program execution, e.g. stack integrity {; Preventing unwanted data erasure; Buffer overflow}
- G06F 21/54: by adding security routines or objects to programs
- G06F 21/60: Protecting data
- G06F 21/6245: {Protecting personal data, e.g. for financial or medical purposes}
- G06F 21/64: Protecting data integrity, e.g. using checksums, certificates or signatures
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

The present disclosure provides a software protection method and apparatus, an electronic device and a storage medium. By identifying the sensitive data in the software source code and determining the point of use of the sensitive data; setting the sensitive data in the read-only section of the compilation product of the software source code so that the sensitive data is stored in the read-only area when the software is running; inserting the check code into the above point of use of the sensitive data, where the check code is used to check whether the sensitive data read is in the read-only area while the software is running, and determine whether to continue running the software according to the check result, embodiments of the present disclosure realize the integrity verification of the sensitive data, and thereby prevent the sensitive data from being corrupted with low performance overheads.

## Claims

### Claim 1

A software protection method, comprising:
identifying sensitive data in a software source code and determining a point of use of the sensitive data;
setting the sensitive data in a read-only section of a compilation product of the software source code, so that the sensitive data is stored in a read-only area when a software is running; and
inserting a check code at the point of use of the sensitive data, wherein the check code is used to check whether sensitive data read is in the read-only area while the software is running, and determine whether to continue running the software according to a check result.

### Claim 2 (depends on 1)

The method according to claim 1, wherein the identifying the sensitive data in the software source code and determining the point of use of the sensitive data comprises:
identifying data with a special marker as the sensitive data; and
determining that a point of a memory read instruction associated with the sensitive data is the point of use of the sensitive data, wherein the memory read instruction is used to read the sensitive data by a pointer.

### Claim 3 (depends on 2)

The method according to claim 2, wherein before the identifying the data with the special marker as the sensitive data, the method further comprises:
identifying an instruction containing a sensitive operation in the software source code according to a preset rule, and marking data used by the instruction using the special marker; and
associating the data with the memory read instruction.

### Claim 4 (depends on 3)

The method according to claim 3, wherein the method further comprises: marking the memory read instruction using the special marker;
the inserting the check code at the point of use of the sensitive data comprises:
inserting the check code before the marked memory read instruction; or
modifying the marked memory read instruction to the memory read code containing the check code.

### Claim 5 (depends on 1)

The method according to claim 1, wherein the setting the sensitive data in the read-only section of the compilation product of the software source code comprises:
identifying a collection of legitimate values of the sensitive data, constituting an allowlist, and setting data in the allowlist in the read-only section of the compilation product of the software source code; and
setting the sensitive data as the data in the allowlist.

### Claim 6 (depends on 2)

The method according to claim 2, wherein the setting the sensitive data in the read-only section of the compilation product of the software source code comprises:
identifying a collection of legitimate values of the sensitive data, constituting an allowlist, and setting data in the allowlist in the read-only section of the compilation product of the software source code; and
setting the sensitive data as the data in the allowlist.

### Claim 7 (depends on 3)

The method according to claim 3, wherein the setting the sensitive data in the read-only section of the compilation product of the software source code comprises:
identifying a collection of legitimate values of the sensitive data, constituting an allowlist, and setting data in the allowlist in the read-only section of the compilation product of the software source code; and
setting the sensitive data as the data in the allowlist.

### Claim 8 (depends on 4)

The method according to claim 4, wherein the setting the sensitive data in the read-only section of the compilation product of the software source code comprises:
identifying a collection of legitimate values of the sensitive data, constituting an allowlist, and setting data in the allowlist in the read-only section of the compilation product of the software source code; and
setting the sensitive data as the data in the allowlist.

### Claim 9 (depends on 5)

The method according to claim 5, wherein the determining whether to continue running the software according to the check result comprises:
continuing running the software if the sensitive data read is in the read-only area; and
blocking the software from running if the sensitive data read is not in the read-only area.

### Claim 10 (depends on 1)

The method according to claim 1, wherein the check code is generated based on features provided by different processors, hardware, or operating systems.

### Claim 11

An electronic device, comprising: at least one processor and a memory;
the memory stores computer executable instructions; and
the at least one processor executes the computer executable instructions stored in the memory, enables the at least one processor to:
identify sensitive data in a software source code and determine a point of use of the sensitive data;
set the sensitive data in a read-only section of a compilation product of the software source code, so that the sensitive data is stored in a read-only area when a software is running; and
insert a check code at the point of use of the sensitive data, wherein the check code is used to check whether sensitive data read is in the read-only area while the software is running, and determine whether to continue running the software according to a check result.

### Claim 12 (depends on 11)

The electronic device according to claim 11, wherein the at least one processor is configured to:
identify data with a special marker as the sensitive data; and
determine that a point of a memory read instruction associated with the sensitive data is the point of use of the sensitive data, wherein the memory read instruction is used to read the sensitive data by a pointer.

### Claim 13 (depends on 12)

The electronic device according to claim 12, wherein the at least one processor is configured to:
identify an instruction containing a sensitive operation in the software source code according to a preset rule, and mark data used by the instruction using the special marker; and
associate the data with the memory read instruction.

### Claim 14 (depends on 13)

The electronic device according to claim 13, wherein the at least one processor is configured to:
mark the memory read instruction using the special marker; and
insert the check code before the marked memory read instruction; or, modify the marked memory read instruction to the memory read code containing the check code.

### Claim 15 (depends on 11)

The electronic device according to claim 11, wherein the at least one processor is configured to:
identify a collection of legitimate values of the sensitive data, constitute an allowlist, and set data in the allowlist in the read-only section of the compilation product of the software source code; and
set the sensitive data as the data in the allowlist.

### Claim 16 (depends on 12)

The electronic device according to claim 12, wherein the at least one processor is configured to:
identify a collection of legitimate values of the sensitive data, constitute an allowlist, and set data in the allowlist in the read-only section of the compilation product of the software source code; and
set the sensitive data as the data in the allowlist.

### Claim 17 (depends on 13)

The electronic device according to claim 13, wherein the at least one processor is configured to:
identify a collection of legitimate values of the sensitive data, constitute an allowlist, and set data in the allowlist in the read-only section of the compilation product of the software source code; and
set the sensitive data as the data in the allowlist.

### Claim 18 (depends on 14)

The electronic device according to claim 14, wherein the at least one processor is configured to:
identify a collection of legitimate values of the sensitive data, constitute an allowlist, and set data in the allowlist in the read-only section of the compilation product of the software source code; and
set the sensitive data as the data in the allowlist.

### Claim 19 (depends on 15)

The electronic device according to claim 15, wherein the at least one processor is configured to:
continue running the software if the sensitive data read is in the read-only area; and
block the software from running if the sensitive data read is not in the read-only area.

### Claim 20

A non-transitory computer-readable storage medium, wherein the readable storage medium stores computer executable instructions, and when the computer executable instructions are configured to enable a processor to:
identify sensitive data in a software source code and determine a point of use of the sensitive data;
set the sensitive data in a read-only section of a compilation product of the software source code, so that the sensitive data is stored in a read-only area when a software is running; and
insert a check code at the point of use of the sensitive data, wherein the check code is used to check whether sensitive data read is in the read-only area while the software is running, and determine whether to continue running the software according to a check result.
