This application is related to the following previously-filed application: “Portion-Level In-Memory Module Authentication” Ser. No. 10/795,068, filed Mar. 5, 2004.
The present invention relates generally to the field of computing, and, more particularly, to the authentication of a software module.
Generally, computer applications run by executing code. The code controls the actions of the computer systems on which it is run. In order to protect the application from unauthorized tampering with the code, a number of security precautions may be utilized.
Some of these security measures are physical. For example, a user purchasing software on a CD-ROM may be able to verify that the CD-ROM is a legitimate copy of the software by inspecting holograms or other security devices on the packaging.
Module authentication is a security measure that executes on a computer system and attempts to ensure the security of software applications by providing a level of protection against tampering.
Static module authentication is a mechanism to detect tampering of the portable executable binary modules that comprise a software application. These binary modules are stored on the persistent storage device, which is usually a file on a hard disk and therefore often referred to as the “on-disk” image of the module. Authentication of the on-disk image may be accomplished by cryptographically hashing the file and comparing the result to a precomputed hash of the file. A cryptographic hashing algorithm operates on binary data of arbitrary size and generates a fixed size value known as a hash. Cryptographic hashes are computed such that any modification of the hashed data will cause a change in the generated hash. A hash is computed of the on-disk module. It is almost completely impossible to make a modification of a file to insert malicious changes and yet maintain the same hash of the modified file. Therefore, the hash of a file can be compared to a stored hash in order to verify that no modifications have been made. In order to prevent an adversary from changing the stored precomputed hash as well as the module being validated, the validity of the stored hash must be verifiable. For example, the stored hash may be cryptographically signed by a trusted signatory.
However, in order to be executed, a file constituting the portable executable (PE) computer program module (e.g. a DLL or EXE) must be loaded into memory. Once loaded, this “in-memory” module image is subject to potentially malicious modifications such as code patching, detouring and software debugger breakpoints. Consequently, it is necessary to authenticate the in-memory image of the module as well as the on-disk image. Authentication of this in-memory executable image of the file is known as “in-memory authentication” or “dynamic module authentication”.
Since tampering of the in-memory images of application modules can occur at any time during the life of the application session, it is usually desirable from a security standpoint to repeat the in-memory authentication process multiple times.
There are two significant reasons why computing a file hash is not an efficient basis for repeated verification of the in-memory module image. First, working set optimizations may be performed by the operating system or by the program itself which cause not all of an executable to be loaded into memory at any given time. This is done to reduce the memory footprint of the running process, for example, so that many processes can run on a computer with limited memory and not cause page swapping. It also minimizes the use of memory bus and device I/O bandwidth (for example, to the hard disk where the executable image is stored) consumed by subsequent page swapping. Memory and bandwidth are valuable fixed resources dictated by the hardware configuration of the computer, so a reduction in the use of either improves the behavior of the computer on all running applications. However, each time a whole file hash must be computed, the entire file must be loaded into physical memory. This negates the benefit of any working set optimizations performed by the operating system or the program itself because the entire module image must be loaded from disk into memory.
A second reason is that a module's in-memory image is not identical to its on-disk file image and the differences must be accounted for when comparing to a file hash. For example, address “relocations” may be applied to the in-memory image by the operating system. That is, the PE file is stored on-disk with a predefined preferred base address where the operating system (OS) loader will attempt to load the file in memory. The code in the on-disk image will be aligned with that base address. However, if there is an address collision with a module that has already been loaded at the preferred address, the OS must relocate, or “rebase”, the module to a new location. When this rebasing does occur, all addresses which assumed the original preferred address within the module image need to change to reflect the base address where the PE file is actually loaded. The PE file contains relocation data which describes where these relocations must be applied. The OS loader applies the relocations to the addresses specified in the relocation data which is a data section in the on-disk PE image. Additionally, the in-memory copy of the import address table (IAT) within the loaded PE file will be modified by the OS loader as function addresses are resolved against DLL export tables. The IAT describes the in memory-address locations of functions in other PEmodules. When the PE is loaded by the OS, the IAT is changed from the original on-disk version of the PE to reflect the actual locations of functions that can be called in other PE modules outside of the PE.
There are multiple methods for performing an in-memory authentication based on a file hash. Each suffers from the inefficiencies mentioned previously. One method is to copy the entire on-disk image into memory to compute its hash, compare the hash to the stored signed hash, apply loader changes to the copy and finally compare the copy to the in-memory image which was loaded by the OS. Another method would be to back out loader changes from the in-memory image into another portion of memory, hash that memory and then compare the hash to the signed file hash. Both methods involve three basic tasks: 1) the in-memory image must be swapped into physical memory, 2) a copy of the image must be made in memory and 3) the expected differences between the in-memory image and the on-disk image caused by the operating system loader must be accounted for. These basic tasks are extremely inefficient, in terms of computation, I/O bandwidth consumption, transfer time, and memory allocation.
In order to reduce space and time requirements for loading, many current executables are created in such a way so as to obviate the need for the entire executable to be loaded by the OS in order for the program's functionality to be used. Some portion of the executable is loaded for the initial functionality, and additional portions are loaded only if and when they become necessary. For example, in one scenario, a program with a help system is executed. When the program is initially run, unneeded help system portions of the executable are not loaded. Thus, starting up the program is not delayed.
If, as described, some portions are not immediately loaded at startup, these portions may be loaded at a later time, either upon opportunity (when the loading will not cause noticeable user delay) or when additional functionality is needed. As in the example, the help system may be loaded when the user first requests use of the help system. This will reduce unnecessary use of memory in loading the help system before it is needed. However, there may be a noticeable delay to the user. Thus, alternatively, the help system may be loaded before the help system has been requested, but after the program has been started up for the user, during a time when such loading will not adversely affect the user experience unduly. In this way, while memory is used for the help system portions in advance of their use, there will be minimal delay when the user requests the help system.
However, as described, above, in order to perform in-memory authentication according to the prior art, the entire on-disk image of the PE is loaded into memory. Thus, either the advantages of delayed loading of portions of the executable can not be realized or the security of an in-memory authentication is not achieved.
In view of the foregoing, there is a need for a system that overcomes the drawbacks of the prior art.
The present invention presents an efficient technique for in-memory verification of a PE (portable executable) file.
According to one embodiment of the invention, individual “portion-level” hashes for portions of the PE file (or software module) are pre-computed and stored securely, for example in a signed hash file. Each “portion” represents a fraction of the total executable image, and separate portions may or may not represent overlapping parts of the image. In the preferred embodiment, the set of all portions does not need to cover the entire image. That is, parts of the executable that can not generally be verified do not need a verification hash. For example, these might include global data sections which are modified by the application at run-time, or data sections that were discarded once the OS loads the image like relocations data in certain OS embodiments.
Portion-level hashes are retrieved and validated as necessary, for example by validating a signature for the hash file, and then used to verify portions of the in-memory image of the executable loaded by the OS. In one embodiment, a portion-level verification proceeds by removing the changes applied to the corresponding in-memory portion of the executable before computing the hash for the portion. The computed hash can then be compared to the pre-computed hash retrieved from secure storage, and any unauthorized changes will result in a mismatch.
More generally, portion-level verification does not require the use of cryptographic hashes or signatures. Any system that can pre-compute portion-level verification information can benefit from this invention.
This portion-level verification can provide substantial performance improvement over the prior art because it allows in-memory verification of the executable without defeating working set optimizations. Moreover, it allows faster application startup because in-memory verification can be amortized over time rather than requiring an expensive monolithic verification of the entire in-memory image at startup time. Finally, parts of the executable that are not used during an execution session may never need to be verified at all.
For example, where “pages” are used as the atomic unit of memory in a system, portion-level hashes corresponding to pages of the PE file can be pre-computed. In one embodiment, an initial verification occurs for all pages that are part of the working set that have been loaded by the OS. In one embodiment, verification must occur before any of these pages is allowed to execute. In an alternate embodiment, this verification must occur before certain sensitive functions are executed. In another alternate embodiment, the verification may be amortized over time by checking subsets of pages at different times during execution. Such amortization allows the application to respond to user interaction without burdensome delays while still providing continuous tamper resistance.
In one embodiment, a select number of pages are tracked and these pages are reverified each time they are used, or, in an alternate embodiment, at least once in a given period of time. This way, continual verification of sensitive pages being used in the PE is provided.
Other features of the invention are described below.
The foregoing summary, as well as the following detailed description of preferred embodiments, is better understood when read in conjunction with the appended drawings. For the purpose of illustrating the invention, there is shown in the drawings example constructions of the invention; however, the invention is not limited to the specific methods and instrumentalities disclosed. In the drawings:
Overview
In order to allow in-memory authentication of a module being loaded from a persistent storage into memory, a hash is computed of at least one portion of the module. In one embodiment, the module is divided into page-size portions, and a verification technique is used which allows the page-size portions to be verified. For example, a hash is created for each of these page-size portions. The resulting hashes (“portion hashes” or “page hashes”) or other verification information is stored. In one embodiment, the verification information is signed and stored on the disk with the module.
In order to perform the in-memory authentication, a portion loaded into memory is authenticated with reference to the stored verification information for that portion. For example, where a hash has been taken of each page of the module, the stored hash is compared to a computed hash of the page as loaded. In one embodiment, where the loaded page has been changed by the OS loader, the loader changes are subtracted from the page. All changes made are undone by backing out the changes to the page made by the loader. The resulting page is then hashed, creating a “check page hash”. The check page hash is compared to the stored page hash. In one embodiment, before the stored page hash is used for verification, it is analyzed to determine whether it should be trusted. A signature may be checked on the stored page hash. If the signature indicates that the stored page hash can be trusted, then it is used for verification.
Module authentication is a security feature that helps protect the application execution environment against tampering. When used properly, it provides some level of protection against code patching, redirection and software breakpoints. The level of protection is dependent on the number of modules in the applications process space that are authenticated and the frequency of the authentication.
Exemplary Computing Arrangement
The invention is operational with numerous other general purpose or special purpose computing system environments or configurations. Examples of well known computing systems, environments, and/or configurations that may be suitable for use with the invention include, but are not limited to, personal computers, server computers, hand-held or laptop devices, multiprocessor systems, microprocessor-based systems, set top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, embedded systems, distributed computing environments that include any of the above systems or devices, and the like.
The invention may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The invention may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network or other data transmission medium. In a distributed computing environment, program modules and other data may be located in both local and remote computer storage media including memory storage devices.
With reference to
Computer 110 typically includes a variety of computer readable media. Computer readable media can be any available media that can be accessed by computer 110 and includes both volatile and nonvolatile media, removable and non-removable media. By way of example, and not limitation, computer readable media may comprise computer storage media and communication media. Computer storage media includes both volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data. Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CDROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other medium which can be used to store the desired information and which can accessed by computer 110. Communication media typically embodies computer readable instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transport mechanism and includes any information delivery media. The term “modulated data signal” means a signal that has one or more of its characteristics set or changed in such a manner as to encode information in the signal. By way of example, and not limitation, communication media includes wired media such as a wired network or direct-wired connection, and wireless media such as acoustic, RF, infrared and other wireless media. Combinations of any of the above should also be included within the scope of computer readable media.
The system memory 130 includes computer storage media in the form of volatile and/or nonvolatile memory such as read only memory (ROM) 131 and random access memory (RAM) 132. A basic input/output system 133 (BIOS), containing the basic routines that help to transfer information between elements within computer 110, such as during start-up, is typically stored in ROM 131. RAM 132 typically contains data and/or program modules that are immediately accessible to and/or presently being operated on by processing unit 120. By way of example, and not limitation,
The computer 110 may also include other removable/non-removable, volatile/nonvolatile computer storage media. By way of example only,
The drives and their associated computer storage media discussed above and illustrated in
The computer 110 may operate in a networked environment using logical connections to one or more remote computers, such as a remote computer 180. The remote computer 180 may be a personal computer, a server, a router, a network PC, a peer device or other common network node, and typically includes many or all of the elements described above relative to the computer 110, although only a memory storage device 181 has been illustrated in
When used in a LAN networking environment, the computer 110 is connected to the LAN 171 through a network interface or adapter 170. When used in a WAN networking environment, the computer 110 typically includes a modem 172 or other means for establishing communications over the WAN 173, such as the Internet. The modem 172, which may be internal or external, may be connected to the system bus 121 via the user input interface 160, or other appropriate mechanism. In a networked environment, program modules depicted relative to the computer 110, or portions thereof, may be stored in the remote memory storage device. By way of example, and not limitation,
Loading of a Software Module into Memory
Generally, PE file 200 contains several different constituent parts. As an example, as shown in
Dynamic Verification of Portions of a Software Module
In order to dynamically verify a portion of the software module which has been loaded into RAM 132, verification information is pre-computed for the portion. The pre-computed portion level data may be or include, for example, a hash of the portion using a specific hash function. Other forms of verification are also contemplated like, for example, verification that only certain authorized function calls are made from the portion where the portion-level data is the list of the authorized functions. The pre-computed portion level verification data is then used to verify the portion of the software module which has been loaded. In one embodiment, the portion-level verifications are stored along with the PE file 200, as stored portion-level verification data 208.
One way in which the pre-computed portion-level verification data may be used to verify the loaded portion of the software module is by hashing the loaded portion of the software module, and comparing it to a stored hash (contained in the portion-level verification data). Because the OS loader may make changes to the module when loading it into the RAM 132, the loaded portion of the software module may have been changed. In such cases, hashing the loaded portion of the software module will yield a different result than a stored hash in a pre-computed portion level verification. In one embodiment, to allow the verification to continue, the changes made by the OS loader must be “backed out” of the loaded portion of the software module before the hash is computed.
For example, as discussed above, relocations may be applied to the in-memory image of the module by the operating system. If the portion of the module contains addresses requiring relocations, the in-memory image will be changed from the on-disk image of that portion. All addresses which assume the original preferred address within the module image are changed by the OS loader to reflect the base address where the PE file is actually loaded. Thus, in this embodiment, changes made to the portion are removed before the verification occurs.
Thus, in order to compute the hash and verify the portion, in one embodiment the changed addresses must revert to the original addresses. If all authorized changes are backed out, with changed information removed and returned to the original state, then the portion can be verified. This step must be careful to only reverse the process performed by the loader, because relocations may have also been tampered with by an adversary. By carefully performing only the reverse operation of the loader, tampered addresses will not be reverted to the original state and therefore will be detected by the verification as expected.
In another embodiment the portion-level verification data may include multiple variants of hashes for a given in-memory portion that can be quickly compared for verification before needing to reverse the loader changes. These variants can include anticipated variations to the loaded portion of the software module based on expected loader changes, such as relocations for common re-basing addresses.
In one embodiment, the portions being verified are pages of the software module. In this way, when the software module is paged into memory, the portions being loaded correspond to the portions which can be verified. Moreover, only the portions that have been loaded need to be verified because only those pages can be executed by the processor.
In one embodiment, each portion of the software module which is loaded is verified. As discussed below, this may be done before all or part of the software module is executed. In another embodiment, the portions of the executable are verified as they are paged into memory, for example, by integrating the verification with the OS loader via an OS driver. In another embodiment, a hot list of portions of the software module is maintained, and those portions on the hot list may be verified. In still another embodiment, portions of the software module relating to some secure functionality of the software module are verified before the secure functionality is utilized.
Because verification relies on the use of a portion-level verification data, the security of the portion-level verification data is significant. Thus, in one embodiment, as part of the verification of a portion, a check on the trustworthiness of the portion-level verification data is performed. For example, the portion-level verification data may be signed using a digital signature of a trustworthy entity. Portion-level verification data may be individually signed, or some or all of the portion-level verification data may be grouped together and signed.
Scheduling of Portion-Level Verification
In one embodiment, in order for dynamic authentication to occur, the portion-level verifications occur according to a specific scheduling arrangement. Thus, where page-level hashes have been created and stored, a scheduling arrangement controls the verification of some or all of the pages in memory using the page-level hashes.
For example, according to one scheduling arrangement, where the module-level verification is followed by execution of the module, verification of the set of pages required to begin execution occurs. In one embodiment, the entire verification occurs before execution begins. In another embodiment, secure functionality of the module is contained in one or more portions of the software module. Only these portions are verified before the secure functionality is accessed. Later verifications of other portions are scheduled after execution begins.
In addition, scheduling arrangements for continual re-verifications of pages being used may also be established. For example, a hot list of specific portions of the software module may be dynamically established and maintained, and the pages listed in the hot list may be reverified continually.
As another example, a periodic verification and reverification schedule may determine how pages are reverified, in order to amortize the verification cost. Pages to verify may be selected randomly (as is common in computing systems, such random selection may be in fact pseudo-random, as computers are generally deterministic). A tunable parameter may be included which allows the costs of verification to be controlled and managed, so it does not interfere with the responsiveness of the executing software module or other modules.
Setting Up Portion-Level Verifications
In order for portion-level verifications to be available for use in authenticating a portion of a software module in memory, they must be created.
Once the portions are identified, in step 410, corresponding portion-level verification data are created for each identified portion. As described above, in one embodiment, this verification includes a hash of the identified portion. The portion-level verification data are stored in step 420. These portion-level verification data may be available along with the module, or may be made available for verification through some other means. For example, the portion-level verification data may be made available via a network, such as the Internet.
Verifier
As shown in
The hasher 545 takes the loaded module portion 530C with load changes removed and hashes it according to a predetermined hash function. The result is then compared by comparator 547 to the stored PLVD 510C as retrieved. If the result of the hash of the loaded module portion 530C with changes removed is equal to the stored PLVD 510C, then the loaded module portion 530C is verified. Otherwise, loaded module portion 530C is suspect.
It is noted that the foregoing examples have been provided merely for the purpose of explanation and are in no way to be construed as limiting of the present invention. While the invention has been described with reference to various embodiments, it is understood that the words which have been used herein are words of description and illustration, rather than words of limitations. Further, although the invention has been described herein with reference to particular means, materials and embodiments, the invention is not intended to be limited to the particulars disclosed herein; rather, the invention extends to all functionally equivalent structures, methods and uses, such as are within the scope of the appended claims. Those skilled in the art, having the benefit of the teachings of this specification, may effect numerous modifications thereto and changes may be made without departing from the scope and spirit of the invention in its aspects.
Number | Name | Date | Kind |
---|---|---|---|
5339430 | Lundin et al. | Aug 1994 | A |
5530757 | Krawczyk | Jun 1996 | A |
5625693 | Rohatgi et al. | Apr 1997 | A |
5757914 | McManis | May 1998 | A |
5768382 | Schneier et al. | Jun 1998 | A |
5907619 | Davis | May 1999 | A |
5944821 | Angelo | Aug 1999 | A |
5970143 | Schneier et al. | Oct 1999 | A |
6105137 | Graunke et al. | Aug 2000 | A |
6484315 | Ziese | Nov 2002 | B1 |
6546487 | McManis | Apr 2003 | B1 |
6560776 | Breggin et al. | May 2003 | B1 |
6681329 | Fetkovich et al. | Jan 2004 | B1 |
6854645 | Somers et al. | Feb 2005 | B1 |
6961852 | Craft | Nov 2005 | B2 |
7103779 | Kiehtreiber et al. | Sep 2006 | B2 |
7197545 | Davie | Mar 2007 | B1 |
7325126 | Ivanov et al. | Jan 2008 | B2 |
7356815 | Sarfati et al. | Apr 2008 | B2 |
7412480 | Baentsch et al. | Aug 2008 | B2 |
20020194484 | Bolosky et al. | Dec 2002 | A1 |
20030172370 | Satuloori et al. | Sep 2003 | A1 |
20040243807 | Hughes et al. | Dec 2004 | A1 |
20050010767 | Craft | Jan 2005 | A1 |
20050188214 | Worley et al. | Aug 2005 | A1 |
20050198517 | Ivanov et al. | Sep 2005 | A1 |
Number | Date | Country | |
---|---|---|---|
20060026569 A1 | Feb 2006 | US |