An executable program obfuscation and encryption method based on binary slicing

By performing binary encryption slicing and filling the executable program with random numbers, the problem of existing software protection methods being unable to operate effectively in an intranet environment is solved, achieving efficient and continuous anti-debugging and anti-analysis functions, and protecting the software source code.

CN117093962BActive Publication Date: 2026-11-17SHANGHAI RONGPAN NETWORK TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202211657340.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-22
Publication Date
2026-11-17
Estimated Expiration
2042-12-22

AI Technical Summary

Technical Problem

Existing software protection methods cannot operate effectively in intranet environments and suffer from problems such as low execution efficiency, poor compatibility, large size, and complex deployment, making them unable to effectively prevent software cracking and unauthorized modification.

Method used

The original executable program is binary encrypted, sliced, compressed, and filled with random numbers. The sliced ​​data is stored in the rodata segment of the new executable program, and then decrypted and loaded during runtime to complete the original program's functions.

Benefits of technology

It enables continuous anti-debugging and anti-analysis to protect the software source code without increasing deployment difficulty, reducing execution efficiency, or changing compatibility.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117093962B_ABST
    Figure CN117093962B_ABST
Patent Text Reader

Abstract

This invention provides an executable program obfuscation and encryption method based on binary slicing. The encryption method includes: performing binary encryption on the original executable program to obtain binary data; slicing, compressing, and padding the binary data with random numbers; storing the sliced ​​data in the rodata segment of a new executable program; and the new executable program decrypting the sliced ​​data and loading it during the runtime phase to complete the functionality of the original executable program. This completely eliminates the code and file characteristics of the original executable program, achieving good and continuous anti-debugging and anti-analysis capabilities without increasing deployment difficulty, reducing execution efficiency, or changing the original software compatibility and size, thus protecting the software source code.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of encryption, and more particularly to an executable program obfuscation encryption method based on binary slicing. Background Technology

[0002] With the rapid development of computer technology, software has become an indispensable part of people's lives. Software is growing in size and complexity, and correspondingly, the resources invested in its development are increasing. To protect the enormous financial and human resources invested in software development and to prevent software cracking and unauthorized modification, software protection is becoming increasingly important.

[0003] The shortcomings of existing software protection methods are analyzed as follows:

[0004] Activation code-based protection: Activation authentication often requires an internet connection to an authentication server, which cannot be effectively implemented in an intranet environment; and authentication is only required for the first activation, and cannot achieve persistent anti-tampering and anti-debugging during subsequent operation.

[0005] Protection based on distributed deployment: Since the original software's functions are implemented by programs deployed on different devices, it increases the difficulty of tampering with and debugging the software. Compared with 1), it does not require an internet connection. However, this method requires deployment on multiple devices, which increases the deployment difficulty and reduces the software's execution efficiency. It is also not suitable for most personal software.

[0006] Protection methods based on shell programs: When a packed program is executed, the shell program is required to guide the original executable program. The guidance process often sacrifices some of the original program's execution efficiency. Furthermore, the compatibility of the packed program depends on the shell program and cannot achieve good compatibility with different versions of operating systems.

[0007] Virtual machine-based protection method: Based on 3), the virtual machine-based protection method converts the executable code based on the x86 assembly system into the code of the bytecode instruction system in order to protect the original instructions from being easily reverse-engineered and modified, making it more difficult to analyze and crack. However, due to the introduction of the virtual machine mechanism, the processed program is often larger in size and its execution efficiency is greatly affected. The virtual machine-based protection method also does not solve the compatibility problem existing in 3).

[0008] Traditional static analysis tools typically require analyzing code segments and rodata segments to analyze executable programs. However, using the methods described above, static analysis tools cannot obtain the original code segment information because the rodata segment data is stored in fragments and encrypted. Traditional static analysis tools also cannot directly obtain effective information from the rodata segment, thus achieving the function of code protection. Summary of the Invention

[0009] In view of the above problems, the present invention is proposed to provide an executable program obfuscation and encryption method based on binary slicing to overcome or at least partially solve the above problems.

[0010] According to one aspect of the present invention, an executable program obfuscation and encryption method based on binary slicing is provided, the encryption method comprising:

[0011] The original executable program is binary encrypted to obtain binary data;

[0012] The binary data is sliced, compressed, and filled with random numbers. The sliced ​​data is then stored in the rodata segment of the new executable program.

[0013] The new executable program completes the decryption of the slice data and the loading of the runtime phase, thus fulfilling the functions of the original executable program.

[0014] Optionally, the binary encryption of the original executable program specifically includes: the input original executable program will be processed as binary data, the target executable file generator first generates a one-time key, and uses an encryption algorithm to encrypt the binary data.

[0015] Optionally, the step of slicing the binary data specifically includes:

[0016] The encrypted binary data is cut into multiple binary data blocks of a fixed size, using byte division.

[0017] Optionally, storing the sliced ​​data into the rodata segment of the new executable program specifically includes:

[0018] Based on the number of slices generated after slicing, generate the same number of blank slices in the rodata section of the target program.

[0019] Fill the blank segments with random numbers;

[0020] The resulting segments are compressed and then filled into the blank segments.

[0021] Optionally, the process of generating the new executable program specifically includes:

[0022] Obtain the original program;

[0023] Generate a one-time key;

[0024] The original program is encrypted using the one-time key to obtain binary data;

[0025] The encrypted binary data is sliced ​​to obtain sliced ​​data;

[0026] The sliced ​​data is compressed to obtain a new executable program for the target.

[0027] Optionally, the binary encryption of the original executable program specifically includes:

[0028] The loader extracts all slices from the rodata segment of the newly executed program;

[0029] The loader decompresses all slices individually into slice bytes;

[0030] The loader will stitch the decompressed fragments into complete data;

[0031] The complete data is decrypted into the original program;

[0032] The original program is expanded in memory according to the executable program layout;

[0033] The loader restores the import table of the executable program after it has been expanded;

[0034] The loader restores the relocation table of the executable program after it has been expanded;

[0035] The program counter (pc) jumps to the entry address of the expanded executable program.

[0036] Run the expanded executable program.

[0037] This invention provides an executable program obfuscation and encryption method based on binary slicing. The encryption method includes: performing binary encryption on the original executable program to obtain binary data; slicing, compressing, and padding the binary data with random numbers; storing the sliced ​​data in the rodata segment of a new executable program; and the new executable program decrypting the sliced ​​data and loading it during the runtime phase to complete the functionality of the original executable program. This completely eliminates the code and file characteristics of the original executable program, achieving good and continuous anti-debugging and anti-analysis capabilities without increasing deployment difficulty, reducing execution efficiency, or changing the original software compatibility and size, thus protecting the software source code.

[0038] The above description is merely an overview of the technical solution of the present invention. In order to better understand the technical means of the present invention and to implement it in accordance with the contents of the specification, and in order to make the above and other objects, features and advantages of the present invention more apparent and understandable, specific embodiments of the present invention are described below. Attached Figure Description

[0039] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the following description of the embodiments will be briefly introduced. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0040] Figure 1 A flowchart of the encryption process for the target executable file generator provided in this embodiment of the invention;

[0041] Figure 2 This is a schematic diagram of the target program's data segment provided in an embodiment of the present invention;

[0042] Figure 3 This is a flowchart illustrating the execution process of a target executable file, provided in an embodiment of the present invention.

[0043] Figure 4 An encryption flowchart of an executable program obfuscation and encryption method based on binary slicing provided in an embodiment of the present invention;

[0044] Figure 5 A schematic diagram of binary data slicing provided in an embodiment of the present invention;

[0045] Figure 6 This is a schematic diagram of the target program roda segment slice filling provided in an embodiment of the present invention. Detailed Implementation

[0046] Exemplary embodiments of the present disclosure will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.

[0047] The terms "comprising" and "having," and any variations thereof, in the specification, embodiments, claims, and drawings of this invention are intended to cover non-exclusive inclusion, such as including a series of steps or units.

[0048] The technical solution of the present invention will be further described in detail below with reference to the accompanying drawings and embodiments.

[0049] Compared with existing technologies, the executable program obfuscation and encryption method based on binary slicing proposed in this patent has the following advantages: by performing binary encryption on the original executable program, slicing, compressing, and filling with random numbers, the sliced ​​data is stored in the rodata segment of the new executable program. The new executable program completes the decryption of the sliced ​​data and the loading of the runtime stage, thereby completing the functions of the original executable program.

[0050] Traditional static analysis tools typically require analyzing code segments and rodata segments to analyze executable programs. However, using the methods described above, static analysis tools cannot obtain the original code segment information because the rodata segment data is stored in fragments and encrypted. Traditional static analysis tools also cannot directly obtain effective information from the rodata segment, thus achieving the function of code protection.

[0051] This invention defines a "target executable file generator" to complete the encryption process. The original program is encrypted by the target executable file generator to generate the target program. The flowchart is as follows. Figure 1 As shown.

[0052] The generated target program layout is as follows Figure 2 As shown.

[0053] The execution flow of the encrypted target executable file is as follows: Figure 3 As shown.

[0054] The encryption process of the executable program obfuscation encryption method based on binary slicing is as follows: Figure 4 As shown.

[0055] This includes binary data encryption, binary data slicing, and filling the target program's rodata segment with the slicing obfuscation.

[0056] Binary data encryption specifically includes: In this embodiment, the input original executable program will be treated as binary data. The target executable file generator first generates a one-time key, and then uses an encryption algorithm to encrypt the binary data.

[0057] Binary data slicing specifically involves dividing the encrypted binary data into 1024-byte blocks, forming several binary data blocks of fixed size (1024 bytes each). Binary data slicing is as follows: Figure 5 As shown.

[0058] After obfuscation, the target program's roddata segment is filled with slices. Based on the number of slices generated after slicing, the same number of blank slices of size 1024 bytes are generated in the target program's roddata segment. These blank slices are first filled with random numbers, and then the generated slices are compressed and filled into the blanks. The target program's roddata segment slice filling is as follows: Figure 6 As shown.

[0059] The execution flow of the encrypted target program is as follows Figure 3 As shown, it specifically includes:

[0060] The execution flow of the encrypted target program is as follows: Figure 3The execution flow of the target executable file is shown below. The target program has a built-in loader program used to complete the bootstrapping process. The detailed execution flow of the target program is as follows:

[0061] The loader extracts all slices from the target program's rodata segment;

[0062] The loader decompresses all slices individually into 1024-byte segments;

[0063] The loader will stitch the decompressed fragments into complete data;

[0064] Decrypt the complete data back into the original program;

[0065] The original program is expanded in memory according to the executable program layout;

[0066] The loader restores the import table of the executable program after it has been expanded;

[0067] The loader restores the relocation table of the executable program after it has been expanded;

[0068] The program counter (pc) jumps to the entry address of the expanded executable program.

[0069] Run the expanded executable program.

[0070] Beneficial effects: Compared with "activation code-based protection methods": it can achieve persistent anti-analysis without an internet connection;

[0071] Compared to "protection methods based on distributed deployment": it is easier to deploy and does not sacrifice program execution efficiency.

[0072] The executable program obfuscation and encryption method proposed in this invention based on binary slicing eliminates the code and file characteristics of the original executable program. Without increasing deployment difficulty, reducing execution efficiency, or changing the original software compatibility and size, it achieves good and continuous anti-debugging and anti-analysis functions, thus realizing the protection of software source code.

[0073] Compared with existing technologies, the executable program obfuscation and encryption method based on binary slicing proposed in this invention has the following advantages: by performing binary encryption on the original executable program, slicing, compressing, and filling with random numbers, the sliced ​​data is stored in the rodata segment of the new executable program. The new executable program completes the decryption of the sliced ​​data and the loading of the runtime stage, thereby completing the functions of the original executable program.

[0074] The above specific embodiments further illustrate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above are merely specific embodiments of the present invention and are not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. An executable program obfuscation and encryption method based on binary slicing, characterized in that, The encryption method includes: performing binary encryption on the original executable program to obtain binary data; slicing, compressing, and padding the binary data with random numbers; storing the sliced ​​data into the rodata segment of the new executable program; and the new executable program completing the decryption of the sliced ​​data and loading during the runtime phase to complete the functions of the original executable program. The binary encryption of the original executable program specifically includes: the input original executable program will be processed as binary data, the target executable file generator first generates a one-time key, and uses an encryption algorithm to encrypt the binary data; The step of storing the sliced ​​data into the rodata segment of the new executable program specifically includes: generating the same number of blank slice fragments in the rodata segment of the target program according to the number of slices generated after slicing, and filling the blank slice fragments with random numbers; compressing the slice fragments generated by slicing and then filling them into the blank slice fragments.

2. The executable program obfuscation and encryption method based on binary slicing according to claim 1, characterized in that, The step of slicing the binary data specifically includes: cutting the encrypted binary data into multiple binary data blocks of a fixed size equal to the number of cutting bytes.

3. The executable program obfuscation and encryption method based on binary slicing according to claim 1, characterized in that, The process of generating the new executable program specifically includes: obtaining the original program; generating a one-time key; encrypting the original program with the one-time key to obtain binary data; slicing the encrypted binary data to obtain slice data; and compressing the slice data to obtain the target new executable program.

4. The executable program obfuscation and encryption method based on binary slicing according to claim 1, characterized in that, The process of performing binary encryption on the original executable program specifically includes: the loader extracting all slices from the rodata segment of the newly executed program; the loader decompressing all slices individually into fragments of slice bytes; the loader concatenating the decompressed fragments into complete data; the complete data being decrypted into the original program; the original program being expanded in memory according to the executable program layout; the loader restoring the import table of the expanded executable program; the loader restoring the relocation table of the expanded executable program; the PC register jumping to the entry address of the expanded executable program; and running the expanded executable program.

Citation Information

Patent Citations

  • Model data protection method and readable computer storage medium

    CN111259432A