1. Field of the Invention
The present invention relates to systems and methods for protecting software from unauthorized use or copying, and in particular to a system and method for protecting software using a hidden application code in a dynamic link library object.
2. Description of the Related Art
Software protection systems are in wide use today. Broadly speaking, these software protection systems can be categorized by how they check whether use of the software is authorized. A first such category includes those software protection systems that use software protection routines that are linked in within the software application itself. A second such category includes software protection routines that are disposed in a loadable library (e.g. a dynamic link library, or DLL) external to the software application. A third such category includes a shell, or wrapper around the software application.
Because linked-in code is more difficult to replace/emulate than a function in an external library, and because shell/wrappers offer the additional protection of (a) encryption of the original code, so most disassemblers will not work, and (b) checksumming the code so attempted code modification can be detected, it is generally best to combine the characteristics of the first and third above categories. However, many software applications and programming languages do not allow linking to externally written and compiled code. Typically, the application can call DLLs through a specific application programming interface (API), but this technique is not entirely secure because such DLLs can be easily disabled (e.g. by replacement with a substitute DLL without the required functionality) by a software hacker. Further, the software applications (or the DLLs) typically do not check to assure that the proper DLL (instead of a hacker-substituted DLL) is loaded. Software hackers can also defeat such software protection systems by altering the application itself, for example, by bypassing application code that performs or initiates the authorization or licensing check.
Some protection DLLs check their own code, but they do not check the calling application. Application vendors also generally do not have the experience or the time to write elaborate code to check their own code or that of the associated DLLs. Since the software application calls the DLL, a hacker could potentially remove all application instructions that call any protection DLLs (checking calls), rendering the software protection system ineffective. What is needed is a system which can help software application vendors protect the software programs with minimal modification to the original (unprotected) code and which cannot be defeated by removing protection DLL calls in the application. The present invention, which places some of the protected applications code into the protected DLL, satisfies this need.
To address the requirements described above, the present invention discloses a method, apparatus, article of manufacture, and a memory structure for protecting software applications from unauthorized use and/or copying.
In summary, the present invention discloses a technique in which the operating system of the user computer loads the software application and a DLL having a portion of the application execution code stored therein into memory. At selected points during its execution, the software application calls the DLL to execute a portion of the application code that was saved into the DLL before delivery to the end user. Since this code is encrypted and the encryption key is stored in a hardware security device and not in the DLL or the software application, the application code portion cannot be executed without recovering the key.
The method comprises the steps of encrypting a compiled portion of the application code according to an encryption key, storing the encrypted code in a DLL associated with the software application, generating a value derived from the compiled portion of the application code, generating a second value derived from the application code and the encryption key, and storing the second computed value in a hardware security device. After the software application is distributed to the end-user and the application is executed, the DLL calculates the value derived from the application code, generates a random number, generates a third value from the value derived from the application code and the random number. The DLL then transmits the third value to a hardware security device, where a fifth value is generated from the third value and the second value and transmitted back to the DLL. The DLL then computes a seventh value from the fifth value and the random number, and decrypts the encrypted portion of the application code using the seventh value. In one embodiment, the DLL re-encrypts the application code with the seventh value before sending the result of the DLL call back to the application code. The apparatus comprises the means for performing the foregoing operations, and substantial equivalents thereof
Referring now to the drawings in which like reference numbers represent corresponding parts throughout:
In the following description, reference is made to the accompanying drawings which form a part hereof, and which is shown, by way of illustration, several embodiments of the present invention. It is understood that other embodiments may be utilized and structural changes may be made without departing from the scope of the present invention.
Generally, the developer computer 102 operates under control of an operating system 116 stored in the memory 104, and interfaces with the user to accept inputs and commands and to present results through a graphical user interface (GUI) module. The instructions performing the GUI functions can be resident or distributed in the operating system 116, the application program 110, or implemented with special purpose memory and processors. Embodiments of the developer computer 102 used by software application developers also include a compiler 108 which allows an application program 110 written in a programming language such as COBOL, C++, FORTRAN, or other language to be translated into processor 106 readable code. The compiled application code 110 accesses and manipulates data stored in the memory 104 of the developer computer 102 using the relationships and logic that are generated using the compiler 108.
The developer computer 102 also typically comprises a device driver 114 and a dynamic link library 112. The device driver 114 includes one or more software modules that provide a link between the operating system 114 and peripheral devices (e.g. 122, 120, 118, 138, 132) communicatively coupled to the computer. The dynamic link library 112 includes one or more executable program modules that perform one or more of the functions required by the application program 110. DLLs 112 are not launched directly by the user, but when needed, they are called for by a running application (e.g. 110) and are loaded to provide the required functionality.
The developer computer 102 also comprises an input/output (I/O) port 134 for a hardware security device (HSD) 138. In one embodiment, the I/O port 134 is a USB-compliant port implementing a USB-compliant interface. The HSD 138 includes a processor 140 communicatively coupled to the I/O port 136 and a memory 142 communicatively coupled to the processor 140. The processor 140 performs the operations ascribed to the HSD 138 using processor instructions stored in the memory 142 of the HSD 138. The HSD 138 memory 142 typically includes a secure memory that cannot be read by the end-user, a read only memory (ROM) and a random access memory (RAM). The HSD 138 may also include a hardware module 144 to implement the operations described below. For example, encryption and/or decryption operations can be performed by the hardware module 144.
In one embodiment, instructions implementing the operating system 116, the application program 110, and the compiler 108 are tangibly embodied in a computer-readable medium, e.g., data storage device 130, which could include one or more fixed or removable data storage devices, such as a zip drive, floppy disc drive, hard drive, CD-ROM drive, tape drive, etc. Further, the operating system 116 and the application program 110 are comprised of instructions which, when read and executed by the developer computer 102, causes the developer computer 102 to perform the steps necessary to implement and/or use the present invention. Application program 110 and/or operating instructions may also be tangibly embodied in memory 104 and/or data communications devices, thereby making a computer program product or article of manufacture according to the invention. As such, the terms “article of manufacture” and “computer program product” as used herein are intended to encompass a computer program accessible from any computer readable device or media.
The developer computer 102 may be communicatively coupled to a remote computer or server 126 via communication medium 124 such as a dial-up network, a wide area network (WAN), local area network (LAN), virtual private network (VPN) or the Internet. Program instructions for computer operation, including additional or alternative application programs can be loaded from the remote computer/server 126. In one embodiment, the developer computer 102 implements an Internet browser, allowing the user to access the world wide web (WWW) and other internet resources.
Those skilled in the art will recognize that many modifications may be made to this configuration without departing from the scope of the present invention. For example, those skilled in the art will recognize that any combination of the above components, or any number of different components, peripherals, and other devices, may be used with the present invention.
The private key and the public key Kpu are stored, as shown in blocks 204 and 206, respectively. In one embodiment, the private key Kpr is stored in the HSD 138 is kept secret and is kept secure from disclosure to the software end user, and the public key Kpu is stored in the DLL 112. Alternatively, the public key Kpu can be stored in the application program 110 in a way that the DLL 112 can retrieve it, or the application program 110 can pass the public key Kpu to the DLL 112 when the application program 110 makes a call to the DLL 112. In the description that follows, the public key is assumed to have been stored in the DLL 112.
The application 110 is compiled to produce a compiled application code (A), as shown in block 208.
Returning to
A value is computed from the second portion (A)-(C) of the compiled application code, as shown in block 216. In one embodiment, the value is the checksum of the application program 110 code. If desired, the checksum can be computed on the application code's static data as well as the application code itself. The checksum can also be computed on the DLLs code (optionally including the DLL's static data) as well as the application code.
Finally, a value K* is computed from the random encryption key (K) and the checksum of the application (Ck), as shown in block 218. In the illustrated embodiment, this is accomplished by computing K* from the exclusive or (XOR) of the encryption key (K) and the checksum (Ck). Then, the computed value K* is stored in the HSD 138 as shown in block 220.
At this point, the application software 110, the DLL 112 (which includes the encrypted code C*), and the prepared HSD (having the value K* stored in a memory therein) is provided to the end user.
Generally, the end-user computer 402 operates under control of an operating system 416 stored in the memory 404, and interfaces with the user to accept inputs and commands and to present results through a graphical user interface (GUI) module. The instructions performing the GUI functions can be resident or distributed in the operating system 416, the application program 110, or implemented with special purpose memory and processors. The compiled application code 110 accesses and manipulates data stored in the memory 404 of the end-user computer 402. The end-user computer 402 also comprises an input/output (I/O) port 434 for the hardware security device (HSD) 138.
The end-user computer 402 also typically comprises a device driver 414 and a dynamic link library the dynamic link libraries associated with and called by the application program 110 when required.
In one embodiment, instructions implementing the operating system 416, the application program 110 and the DLL 112 are tangibly embodied in a computer-readable medium, e.g., data storage device 430, which could include one or more fixed or removable data storage devices, such as a zip drive, floppy disc drive, hard drive, CD-ROM drive, tape drive, etc. Further, the operating system 416 and the application program 110 are comprised of instructions which, when read and executed by the end-user computer 402, causes the end-user computer 402 to perform the steps necessary to implement and/or use the present invention. Application program 110, DLL 112 and/or operating instructions may also be tangibly embodied in memory 404 and/or data communications devices, thereby making a computer program product or article of manufacture according to the invention.
As was true with the developer computer, the end-user computer 402 may be communicatively coupled to a remote computer or server 426 via communication medium 424 such as a dial-up network, a wide area network (WAN), local area network (LAN), virtual private network (VPN) or the Internet. Program instructions for computer operation, including additional or alternative application programs can be loaded from the remote computer/server 426 (which may be the developer computer 102). In one embodiment, the end-user computer 402 implements an Internet browser, allowing the user to access the world wide web (WWW) and other internet resources.
As shown in block 504, the DLL 112 generates a value (analogous to the value computed in block 216) from the application code. In one embodiment, the value is a checksum of the application's code (Ck) (and, optionally, static data). Although it can be generally assumed that a well-written DLL can verify the integrity of its own code (and data), the present invention can be implemented by checksum the DLL as well as the application. In this case, the block 216 of
To make communications with the HSD 138 unique, the DLL 112 selects a random number (R) as a “salt”, as shown in block 506. The random number R is chosen from a sufficiently large range of possibilities so to prevent a hacker from attacking the software protection system.
Next, as shown in block 508, a value (X) is computed from the random number (R) and the checksum (Ck), as shown in block 508. In one embodiment, the value (X) is computed as the checksum (Ck) XORed with the random number (R).
Then, as shown in block 510, the value (X) is encrypted using the public key Kpu to produce a value (X*) and transmitted to the HSD 138 as a challenge (typically via a device driver 414). The HSD 138 receives a message having the (X*) value, and, using the private key Kpr decrypts (X*) value to obtain the (X) value, as shown in block 512. The HSD 138 then computes a value (Y) from the (K*) value stored in block 220 and the (X) value. In the illustrated embodiment, the value (Y) is computed as the (K*) value XORed with the (X) value, as shown in block 514. The (Y) value is then encrypted using the private key Kpr to produce a (Y*) value. The (Y*) value is then sent to the DLL 112, as shown in block 516.
The DLL 112 decrypts Y* using the public key Kpu to produce (Y), as shown in block 518. A value (K′) is computed from the (Y) value and the random number (R), as shown in block 520. In the illustrated embodiment, the (K′) value is computed as the (Y) value XORed with the random number (R). Note that nominally, K′=(K* XOR(Ck XOR R))XOR R=((K XOR Ck)XOR(Ck XOR R)XOR R=K.
The (formerly encrypted) application code (C*) is decrypted using the K′ value to produce the decrypted application code (C′), as shown in block 522. The decrypted application code (C′) is executed (called with the application-supplied parameters), as shown in block 524. The result is saved, and ultimately transmitted to the software application 110, as shown in block 528. In one embodiment of the invention, the decrypted application code (C′) is re-encrypted to restore the original, protected state before the result is transmitted to the software application, as shown in block 526.
For purposes of example, the XOR operation is cited in the foregoing discussion for purpose of computing intermediate values and other results. However, any function invertible function (including symmetric encryption/decryption) can be used to practice the present invention. An invertible function ƒ can be defined such that if ƒ(a,b) is the function and ƒ1(c,b) is its inverse, if C=ƒ(A,B) then A=ƒ1(C,B). The XOR operation is invertible because if C=A XOR B, then A=C XOR B.
The operations described in
With regard to the operations used in protecting the software application 110 (described in
Referring to the runtime operations described in
the operations X=(Ck XOR R) and X*=PKEncr(Ck XOR R, Kpu) described in blocks 508 and 510 can be described instead as X=h(Ck,R), and the DLL 112 saves the Ck and X values for later use;
the operations Y=K* XOR X and Y*=PKEncr(K* XOR X, Kpr) described in blocks 514 and 516 can be described instead as Y=g(K*,X); and
the operation Y=PKDecr(Y*,Kpu) described in block 518 can be described instead as K*=g−1(Y,X).
Further, referring to the runtime operations described in
Hence, if Ck was the same value as the checksum computed at protection time, then K′=K. Thus, the encryption key, K, is recovered, and can be used to decrypt the application code in the DLL 110A
This concludes the description of the preferred embodiments of the present invention. The foregoing description of the preferred embodiment of the invention has been presented for the purposes of illustration and description. It is not intended to be exhaustive or to limit the invention to the precise form disclosed. Many modifications and variations are possible in light of the above teaching.
For example, the functions and operations described above can be implemented in a variety of ways. For example, the encryption and/or decryption functions performed by the HSD 138 can be performed by one or more software modules (each with processor instructions supporting the encryption/decryption of values and/or messages), by one or more hardware modules (each with electronic circuit components) or by a combination of hardware and software modules.
It is intended that the scope of the invention be limited not by this detailed description, but rather by the claims appended hereto. The above specification, examples and data provide a complete description of the manufacture and use of the composition of the invention. Since many embodiments of the invention can be made without departing from the spirit and scope of the invention, the invention resides in the claims hereinafter appended.
This application claims benefit of U.S. Provisional Patent Application No. 60/331,855, entitled “SOFTWARE PROTECTION METHOD WITH HIDDEN APPLICATION CODE IN PROTECTION DLL,” by Mehdi Sotoodeh, Brian Grove, and Laszlo Elteto, filed Nov. 20, 2001.
Number | Name | Date | Kind |
---|---|---|---|
4634807 | Chorley et al. | Jan 1987 | A |
4747139 | Taaffe | May 1988 | A |
5182707 | Cooper et al. | Jan 1993 | A |
5375241 | Walsh | Dec 1994 | A |
5530752 | Rubin | Jun 1996 | A |
5604800 | Johnson et al. | Feb 1997 | A |
5675645 | Schwartz et al. | Oct 1997 | A |
5797015 | Daniels, Jr. et al. | Aug 1998 | A |
5802367 | Held et al. | Sep 1998 | A |
5838911 | Rosenhauer et al. | Nov 1998 | A |
5916308 | Duncan et al. | Jun 1999 | A |
5935246 | Benson | Aug 1999 | A |
6041363 | Schaffer | Mar 2000 | A |
6052778 | Hagy et al. | Apr 2000 | A |
6141698 | Krishnan et al. | Oct 2000 | A |
6148325 | Schmidt et al. | Nov 2000 | A |
6363409 | Hart et al. | Mar 2002 | B1 |
6378072 | Collins et al. | Apr 2002 | B1 |
6405316 | Krishnan et al. | Jun 2002 | B1 |
6421703 | Steinmetz et al. | Jul 2002 | B1 |
6442752 | Jennings et al. | Aug 2002 | B1 |
6446204 | Pang et al. | Sep 2002 | B1 |
6996720 | DeMello et al. | Feb 2006 | B1 |
20020053024 | Hashimoto et al. | May 2002 | A1 |
20030065929 | Milliken | Apr 2003 | A1 |
Number | Date | Country |
---|---|---|
1-263734 | Oct 1989 | JP |
8-339296 | Dec 1996 | JP |
WO 0039956 | Jul 2000 | WO |
WO 0062159 | Oct 2000 | WO |
Number | Date | Country | |
---|---|---|---|
20030097577 A1 | May 2003 | US |
Number | Date | Country | |
---|---|---|---|
60331855 | Nov 2001 | US |