Protection of binary executables using dynamic encryption techniques
Abstract
A facility for securely executing a program is described. The facility stores a number of encoded modules, each including an encoded block and a type field that contains a resource indicator that in turn identifies an encoding resource. The encoding resource has contents specifying details of a process for decoding the encoded block to obtain a working module containing executable code for a portion of the program.
Interactive Citation Constellation Global Citation Ranking
Interactive SVG Citation Constellation renders in Rust/WebAssembly. Prior art cited: 7 · Forward citations: 0.
Claims (22 — 4 Independent, 18 Dependent)
- Claim 1Independent Claim
A method in a computing system, comprising: accessing a set of encrypted modules across which an executable program is encoded, each of the encrypted modules specifying an encoding resource containing information usable to decrypt the encrypted module; identifying a first one of the encrypted modules containing an entry point for the program; accessing the encoding resource specified for the first encrypted module; using contents of the accessed encoding resource specified for the first encrypted module to decrypt the first encrypted module, decryption of the first encrypted module resulting in a first decrypted module corresponding to the first encrypted module being stored in working memory; executing the program within the first decrypted module, to a point at which the first decrypted module specifies a call to a first non-local subroutine; in response to reaching the point at which the first decrypted module specifies a call to the first non-local subroutine: identifying a second one of the encrypted modules containing an entry point for the first non-local subroutine, the second encrypted module being distinct from the first encrypted module; using contents of the accessed encoding resource specified for the second encrypted module to decrypt the second encrypted module, decryption of the second encrypted module resulting in a second decrypted module corresponding to the second encrypted module being stored in working memory; expunging the first decrypted module from working memory; and executing the first non-local subroutine within the second decrypted module.
- Claim 2Depends on #1
The method of claim 1 wherein the method is performed by a driver subsystem executing on the computing system.
- Claim 3Depends on #1
The method of claim 1 wherein, in addition to each of the encrypted modules of the set being encrypted, each of the encrypted modules of the set is compressed, and wherein the encoding resource specified for each of the encrypted modules contains information usable to decompress the encrypted module, the method further comprising: using contents of the accessed encoding resource specified for the first encrypted module to decompress the first decrypted module, decompression of the first decrypted module resulting in a first decompressed module corresponding to the first encrypted module being stored in working memory, wherein it is the first decompressed module within which the program is executed; erasing the first decrypted module from working memory; in response to reaching the point at which the first decrypted module specifies a call to the first non-local subroutine: using contents of the accessed encoding resource specified for the second encrypted module to decompress the second decrypted module, decompression of the second decrypted module resulting in a second decompressed module corresponding to the second encrypted module being stored in working memory, wherein it is the second decompressed module within which the first non-local subroutine is executed; and erasing the second decrypted module from working memory.
- Claim 4Depends on #1
The method of claim 1 wherein metadata of the call to the first non-local subroutine is used to identify the second encrypted module.
- Claim 5Depends on #1
The method of claim 1 wherein the first decrypted module is expunged from working memory in response to metadata of the call to the first non-local subroutine.
- Claim 6Depends on #1
The method of claim 1 wherein execution of the first non-local subroutine within the second decrypted module reaches a call to a second non-local subroutine, the method further comprising: in response to reaching the point at which the second decrypted module specifies a call to the second non-local subroutine: identifying a third one of the encrypted modules containing an entry point for the second non-local subroutine, the third encrypted module being distinct from the second encrypted module; using contents of the accessed encoding resource specified for the third encrypted module to decrypt the third encrypted module, decryption of the third encrypted module resulting in a third decrypted module corresponding to the third encrypted module being stored in working memory; and executing the second non-local subroutine within the third decrypted module while retaining the second decrypted module in working memory.
- Claim 7Depends on #6
The method of claim 6 where retaining the second decrypted module in working memory during execution of the second non-local subroutine is in response to metadata of the call to the second non-local subroutine.
- Claim 8Independent Claim
One or more computer memories collectively storing a data structure usable to enable a processor to securely execute a program organized into subroutines, the data structure comprising: a first working module in working memory comprising executable code for the program that includes executable code for a first non-local subroutine, a program counter register of the processor identifying a location in the first working module, the first working module having been decoded from a corresponding first encoded module and stored in decoded form in working memory in response to a call to the first non-local subroutine from a second working module that was in working memory at the time of the call, such that working memory contains a decoded version of only a proper subset of all of the executable code of the program, wherein the second working module was expunged from working memory in response to the call to the first non-local subroutine, such that, when the call to the first non-local subroutine returns, resuming execution in the second module involves decoding the second working module from a corresponding second encoded module.
- Claim 9Depends on #8
The one or more computer memories of claim 8, the data structure further comprising: a second cached working module retained in working memory in response to the call to the first non-local subroutine, such that, when the call to the first non-local subroutine returns, resuming execution in the second module can occur without decoding the second working module from a corresponding second encoded module.
- Claim 10Depends on #9
The one or more computer memories of claim 9, the data structure further comprising: metadata attached to the call to the first non-local subroutine in the second working module specifying retention of the second cached working model in response to the call to the first non-local subroutine.
- Claim 11Depends on #9
The one or more computer memories of claim 9, the data structure further comprising: the first encoded module, stored in connection with a type field containing a resource indicator identifying an encoding resource, the encoding resource having contents specifying details of a process for performing the decoding of the first encoded module to obtain the first working module.
- Claim 12Depends on #11
The one or more computer memories of claim 11, the data structure further comprising: a plurality of resource records, each resource record comprising: an encoding resource; and a resource indicator identifying the encoding resource, such that, when an encoded module is to be decoded, the resource indicator in its type field can be used to locate the corresponding resource record, read the contained encoding resource, and use the details it contains to perform the decoding.
- Claim 13Depends on #12
The one or more computer memories of claim 12 wherein the encoding resource for distinguished one of the plurality of resource records comprises: a decryption algorithm; a decryption mode; a decryption key size; a decryption key; a reference to a separately-stored decryption key; an initialization value; a decompression algorithm; and/or one or more decompression configuration values.
- Claim 14Depends on #12
The one or more computer memories of claim 12, the data structure further comprising: a second encoded module corresponding to the second decoded module, stored in connection with a type field containing a resource indicator that is different from the resource indicator contained by the type field in connection with which the first encoded module is stored.
- Claim 15Independent Claim
One or more computer-readable devices collectively storing a data structure usable to enable a processor to securely execute a program, the data structure comprising: a plurality of encoded modules, each encoded module comprising: an encoded block, and a type field containing a resource indicator identifying an encoding resource, the encoding resource having contents specifying details of a process for decoding the encoded block to obtain a working module comprising executable code for a portion of the program; and a plurality of resource records, each resource record comprising: an encoding resource, and a resource indicator identifying the encoding resource, such that, when the encoded block of an encoded module is to be decoded, the resource indicator in its type field can be used to locate the corresponding resource record, read the contained encoding resource, and use the details it contains to perform the decoding.
- Claim 16Depends on #15
The one or more computer-readable devices of claim 15 wherein, for each of the encoded modules, the resource indicator identifies an encoding resource whose contents specify decryption details.
- Claim 17Depends on #15
The one or more computer-readable devices of claim 15 wherein, for each of the encoded modules, the resource indicator identifies an encoding resource whose contents specify decompression details.
- Claim 18Independent Claim
One or more computer-readable devices collectively having contents configured to cause a computing system to perform a method for managing an in-memory representation of a program, the method comprising: executing a first decoded module comprising a first portion of executable code of the program; encountering in the execution of the first decoded module a dynamic link stub representing a call to a first non-local subroutine; in response to the encountering: from the dynamic link stub, identifying an encoded module containing an encoded representation of the first non-local subroutine; using contents of an encoding resource specified for the identified encoded module to decode the identified encoded module, decode of the identified encoded module resulting in a second decoded module corresponding to the identified encoded module being stored in working memory; and executing the first non-local subroutine within the second decoded module.
- Claim 19Depends on #18
The one or more computer-readable devices of claim 18 wherein the decoding comprises: loading into working memory an encoded block contained by the identified encoded module; loading into working memory an encoding resource specified for the identified encoded module; deriving a decryption key using contents of the loaded encoding resource; allocating working memory for a new working module; using the derived decryption key to decrypt the loaded encoded block in accordance with contents of the loaded encoding resource into the allocated working module; and expunging from working memory the loaded encoded block and encoding resource.
- Claim 20Depends on #19
The one or more computer-readable devices of claim 19 wherein the deriving is performed by a security subsystem.
- Claim 21Depends on #19
The one or more computer-readable devices of claim 19 wherein the decrypted encoded block is decompressed before being placed into the allocated working module.
- Claim 22Depends on #18
The one or more computer-readable device of claim 18, the method further comprising: accessing metadata for the call contained by the dynamic link stub, the accessed metadata specifying whether the decoded module containing the dynamic link stub should be cached or expunged upon completing the non-local subroutine call to which the dynamic link stub corresponds; where the accessed metadata specifies that the decoded module containing the dynamic link stub should be cached upon performing the non-local subroutine call to which the dynamic link stub corresponds, omitting to expunge the first decoded module in response to the encountering; and where the accessed metadata specifies that the decoded module containing the dynamic link stub should be expunged upon performing the non-local subroutine call to which the dynamic link stub corresponds, expunging the first decoded module in response to the encountering.
Technical Overview & Description
CROSS-REFERENCE TO RELATED APPLICATION(S) This application claims the benefit and priority to each of U.S. Provisional Application No. 63/354,468, filed Jun. 22, 2022, and U.S. Provisional Application No. 63/354,555, filed Jun. 22, 2022, each of which is hereby incorporated by reference in its entirety. This application is related to U.S. application Ser. No. 18/338,863, entitled “ PROTECTION, OBFUSCATION, AND OPTIMIZATION OF BINARY EXECUTABLES USING RECOMPILATION ” , filed concurrently herewith, which is hereby incorporated by reference in its entirety. In cases where the present application conflicts with a document incorporated by reference, the present application controls. BACKGROUND The term “ binary obfuscation ” refers to modifying executable code to make it difficult for humans and computers to understand. Current standard practice in binary obfuscation is, among other things, to wrap the entire target binary in an encryption layer so that all of the machine code is encrypted on disk also known as encryption at rest. During execution, the executable is decrypted to temporary storage on disk or in memory and then be executed by means of an inline decryption program. BRIEF DESCRIPTION OF THE DRAWINGS FIG. 1 is a flow diagram showing the encoded program and associated program flow characterizing the facility in some embodiments. FIG. 2 is a block diagram showing contents of memory used by the facility in some embodiments. FIG. 3 is a block diagram showing the contents of an encoding resource used by the facility in some embodiments. FIG. 4 is a flow diagram showing the decode module program flow characterizing the facility in some embodiments. FIG. 5 is a detailed encoding resource binary representation demonstrating an example embodiment. FIG. 6 is a runtime memory layout demonstrating an example embodiment of a protected program during execution. FIG. 7 is a block diagram showing a sample series of snapshots of working memory as the facility manages the cont
Cited By — Indexed Forward Citations (0 of 0 total)
No indexed citing patents in this generation yet. Ingest USPTO/PatentsView bulk citation tables via patents-ingest to expand the local forward citation graph.
References Cited — Backward Prior Art (7)
Non-Patent Literature (1)
- Lakshmanan Nataraja; Detecting Packed Executables Based on Raw Binary Data ; University of California; year: 2010 , pp. 1-6.