Abstract:
The present invention discloses a method for establishing a trusted running environment in a computer. A trusted file authentication module and a trusted process memory code authentication module are preset in operation system (OS) of the computer and a secured OS is loaded and run. The trusted file authentication module intercepts all file operation behaviors, checks whether current file to be operated is a trusted file or not, and processes the file according to its operation type if it is trusted, otherwise processes the file after its eligibility is verified; the trusted process memory code authentication module authenticates on timing whether the running state and the integrality for all process code are normal or not; if any process is abnormal, giving an alarm, saving field data run by the process and closing down the process; otherwise continuing to run normally. With this invention, the security for the running environment in the computer can be ensured whether the attack from known or unknown virus exists or not, and this facilitates application and reduces implementation cost.

Description:
BACKGROUND OF THE INVENTION 
       [0001]    1. Field of Invention 
         [0002]    The present invention relates to the technological field of computer security, in particular to a method for establishing a trusted running environment in the computer. 
         [0003]    2. Description of Prior Art 
         [0004]    Due to its own defects, the computer operation system (OS) is prone to an overall breakdown when attacked, especially in case of an unknown attack or a new virus. Consequently the overall system cannot continue its operation, or even it can, various problems may pop up. As such, it is inevitable for a user to doubt whether the running environment in the computer can be trusted, and thus the user may be too worried to perform processing and interaction of confidential information, such as electronic payment, electronic document and etc, on the computer. This is disadvantageous by all means. 
         [0005]    Currently, there are usually several solutions for the above problems as follows: 
         [0006]    The first method is to apply antivirus software. Specifically, the antivirus software detects the attack from a network virus by a method of feature matching. It isolates or disinfects any infected files when the file is found so that the computer security can be guaranteed. 
         [0007]    This method has a disadvantage, however, in that it cannot detect the attack from an unknown virus. Consequently, the computer system cannot launch any counteraction before the publication of new virus library, rule library and patch program. Meanwhile, the antivirus software itself is susceptible to such attacks. 
         [0008]    The second method is to apply host-invasion detection software. In particular, the host-invasion detection software detects any attack using a given feature rule library and releases an alarm. 
         [0009]    This method has a disadvantage similar to that of the first method, that is, it cannot detect the attack from an unknown virus. Consequently, the computer system cannot launch any counteraction before the publication of new virus library, rule library and patch program. Meanwhile, the host-invasion detection software itself is susceptible to such attacks. 
         [0010]    The third method is to utilize dual-net physical isolation, a dual-net physical isolation computer or a method of dual-mode OS switching. It specifically guarantees the security of the computer running environment through dual-net or dual-mode switching. 
         [0011]    Unfortunately, this method will lead to an increased cost for the computer itself. And a user also needs to switch the mode of the computer and hence it is inconvenient to use. 
         [0012]    The fourth method is to utilize process isolation technique. In detail, an identification flag is set for a process and any visitor to the process is discriminated, while different processes in the process pool are isolated and monitored with respect to their utilization for physical memory and CPU as well as to system performance in order to prevent memory overflow when multiple processes are running. 
         [0013]    This method has a disadvantage in that it is not detected as to whether a process itself has been attacked. Therefore computer security is still in danger. 
         [0014]    The above methods each serve as a protection measure against various attacks. However, they cannot ensure the running environment in the computer to be secured and trusted. 
       SUMMARY OF THE INVENTION 
       [0015]    In view of the above problems, the object of the present invention is to provide a method for establishing a trusted running environment in the computer, which can essentially guarantee security and trustworthiness of the running environment in the computer and facilitate user application. 
         [0016]    In order to achieve the above object, the technical solution of the invention is realized by a method for establishing a trusted running environment in the computer, which presets a trusted file authentication module and a trusted process memory code authentication module in operation system (OS) of the computer and loads and runs a secured OS. In this method, the trusted file authentication module intercepts all file operation behaviors, checks whether the current file to be operated is a trusted file or not, and processes the file according to its operation type if it is trusted, otherwise processes the file after its eligibility is verified if it is not a trusted file. Then, the trusted process memory code authentication module authenticates on timing whether the running state and the integrality for all process code are normal or not and, if any process is abnormal, gives an alarm, saves field data run by the process and subsequently closes down the process, otherwise continues to run normally. 
         [0017]    Preferably, said loading and running a secured OS comprises: presetting a basic file management system and a trusted file list containing file names for OS core files predefined by a user, file related to startup and application software to be protected by the user; setting in a security storage component all data requiring security guarantee and integrality value thereof; and setting in underlying firmware of the computer an fundamental software integrality authentication and recovery module of trusted OS. The process of loading and running OS further comprises the following steps: 
         [0018]    a. after a successful authentication and startup of the underlying firmware in the computer, the underlying firmware checks whether the integrality value of the basic file management system is consistent with an integrality value prestored in the security storage component or not; and if it is, the underlying firmware starts the basic file management system and proceeds to step b; otherwise, stop system startup; 
         [0019]    b. the basic file management system starts the fundamental software integrality authentication and recovery module of trusted OS, which in turn reads a disk parameter from a disk sector and checks whether the integrality value of the disk parameter is consistent with an integrality value prestored in the security storage component or not; and if it is consistent, step c is executed; otherwise the fundamental software integrality authentication and recovery module of trusted OS extracts disk data prestored in the security storage component, writes it in the current disk sector and then proceeds to step c; 
         [0020]    c. the fundamental software integrality authentication and recovery module of trusted OS checks whether the integrality value of the trusted file list is consistent with an integrality value prestored in the security storage component or not; and if it is consistent, step d is executed; otherwise a trusted file list prestored in the security storage component is extracted to replace the current trusted file list and then step d is executed; 
         [0021]    d. the fundamental software integrality authentication and recovery module of trusted OS reads the OS core files in the trusted file list and checks whether the integrality value of the OS core file is consistent with an integrality value prestored in the security storage component or not; and if it is consistent, the OS is loaded and run; otherwise, an OS core file prestored in the security storage component is extracted to replace the current OS core files and then the OS is loaded and run. 
         [0022]    Preferably, said basic file management system is located in the security storage component, the underlying firmware or the OS; and said trusted file list is located in the security storage component or the OS. 
         [0023]    Preferably, said all data requiring security guarantee in the security storage component is determined according to the requirement of system running and the user requirement; and said all data requiring security guarantee includes, but not limited to, data for the underlying firmware, the OS, various application software and files as well as the disk parameter. 
         [0024]    Preferably, said disk parameter includes, but not limited to, main boot sector parameter, partition boot sector parameter and file allocation table parameter. 
         [0025]    Preferably, the method for said trusted file authentication module to check whether the current file to be operated is a trusted file or not is: checking whether the current file to be operated is a file in the trusted file list or not; and if it is, determining the current file to be operated is a trusted file; otherwise, determining the current file to be operated is an untrusted file. 
         [0026]    Preferably, the processing for a trusted file according to the current file operation type is: checking the type of the current file operation behavior is reading or modification, and 
         [0027]    if it is reading, checking whether the integrality value of the current file to be operated is consistent with an integrality value prestored in the security storage component or not; and if consistent, loading the current file to be operated into the memory and allow reading from a visitor; if not consistent, extracting a prestored trusted file from the security storage component to replace the current file, and loading the current file to be operated into the memory and allow reading from the visitor, and 
         [0028]    if it is modification, checking the computer is currently in secured state and then allowing the visitor to modify the trusted file list; recalculating the integrality values for the trusted file list and the modified file and storing their new integrality values in the security storage component. 
         [0029]    Preferably, said modification includes, but not limited to, reading and/or attribution modification and/or deletion and/or new file creation; said secured state means that currently the computer has no physical connection with any network and the trusted file list is in a modification enabled state. 
         [0030]    Preferably, the method further comprises providing a physical switch for enabling modification and determining whether the trusted file list is currently in the modification enabled state or not based on the on or off state of the physical switch. 
         [0031]    Preferably, the processing for an untrusted file after its eligibility is authenticated is: after the completion of virus detection on the untrusted file, loading a process corresponding to the file into a virtual machine, which monitors the behavior of the process and gives an alarm and closes down the process if any illegal behavior is found in the process; if no illegal behavior, allowing the processing on the file. 
         [0032]    Preferably, said illegal behavior includes at least illegal modification on OS file and/or illegal modification on disk and/or illegal boundary violation in memory access and/or illegal jumping. 
         [0033]    Preferably, the process for said trusted process memory code authentication module to authenticate on timing whether the running state of all process code is normal or not is: checking whether the program pointer to a process exceeds physical memory address prescribed by the process or not and/or whether the process code traverses the prescribed physical memory address or not. 
         [0034]    The process for said trusted process memory code authentication module to authenticate on timing whether the integrality of all process code is normal or not is: calculating the integrality value of process code in the memory for a process corresponding to a file when the file is loaded into the memory for the first time, storing the integrality value in the security storage component, and authenticating on timing whether the integrality value of all current process code is consistent with the integrality value prestored in the security storage component or not; if it is, determining the process code as being normal; otherwise, determining the process code as being abnormal. 
         [0035]    Preferably, when said trusted process memory code authentication module has authenticated that the running state and/or integrality of the process code is abnormal, the method further comprises authenticating again the file corresponding to the abnormal process by the trusted file authentication module and then loading it into the memory again; calculating the integrality value of the process corresponding to the file in the memory; storing the calculated value in the security storage component; and recovering the process to its previous running state based on the field data previously saved for running the process. 
         [0036]    Preferably, said file operation behavior includes, but not limited to, file reading/writing, file attribution modification, file deletion and file creation. 
         [0037]    Preferably, said security storage component can be a hard disk storage component with mandatory access authorization control, a chip storage component with mandatory access authorization control or a memory component with access control mechanism. 
         [0038]    Preferably, said storage component is a security chip, a hard disk with security protection function or a flash storage with access control function. 
         [0039]    The present invention presets the trusted file authentication module and the trusted process memory code authentication module in operation system (OS) of the computer, and loads and runs a secured OS. The trusted file authentication module intercepts all file operation behaviors, and processes the file according to its operation type if the operation behavior is for a trusted file, while processing the file after its eligibility is verified if the operation behavior is for an untrusted file. The trusted process memory code authentication module authenticates on timing whether the running state and the integrality for all process code are normal and; if any process is abnormal, giving an alarm, saving field data run by the process and closing down the process; otherwise, continuing to run normally. With the invention, from the OS startup any attack on the OS core, application files and processes themselves is detected and the corresponding recovery is made based on a trusted computer hardware platform, instead of detecting the existence of any virus through information such as virus library or rule library. In this way, no matter whether the attack from known or unknown virus exists or not, the security and trustiness for the running environment in the computer can be ensured and thus a trusted running environment can be provided for a user who merely needs to determine which file and data requires security guarantee. This facilitates application and reduces implementation cost. 
     
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS  
         [0040]      FIG. 1  shows a schematic flowchart for loading and running OS in which one embodiment of the invention is applied; 
           [0041]      FIG. 2  shows a schematic flowchart for authenticating a current file to be operated by a trusted file authentication module; 
           [0042]      FIG. 3  shows a schematic flowchart for authenticating process code by a trusted process memory code authentication module; and 
           [0043]      FIG. 4  shows a schematic diagram for enabling modification under the control of a physical switch. 
       
    
    
     DETAILED DESCRIPTION OF PREFERRED EMBODIMENTS 
       [0044]    Hereafter, the present invention will be described in detail in conjunction with the accompanying figures. 
         [0045]    According to the invention, it establishes a trust chain through overall authentication on OS, application software and processes based on a trusted computer hardware platform and thus provides a verified trusted running environment for a user. 
         [0046]      FIG. 1  shows a schematic flowchart for loading and running OS in which one embodiment of the invention is applied. In this embodiment, there is provided in underlying firmware within a computer a basic file management system having functions of disk management and file management as well as a fundamental software integrality authentication and recovery module of trusted OS, which is used for authenticating core file related to startup in the OS. All data that requires security guarantee which are determined according to requirements of system running and the user requirement, are set in a security storage component of the computer along with integrality values thereof; the data requiring security guarantee includes data for underlying firm, such as BIOS, OS, various application software and files as well as disk parameter. In addition, a trusted file list is provided containing file names for OS core file predefined by the user, file related to startup and application software that the user wants to protect. The process of loading and running OS comprises the following steps: 
         [0047]    In step  101 , after a successful authentication and startup of the underlying firmware in the computer, the underlying firmware checks whether the integrality value of the basic file management system is consistent with an integrality value prestored in the security storage component or not; if it is, step  102  is executed; otherwise, system startup is stopped. 
         [0048]    In steps  102  and  103 , the underlying firmware starts the basic file management system, which in turn starts the fundamental software integrality authentication and recovery module of trusted OS. 
         [0049]    In step  104 , the fundamental software integrality authentication and recovery module of trusted OS reads a disk parameter from a disk sector and checks whether the integrality value of the disk parameter is consistent with an integrality value prestored in the security storage component or not; if it is, step  106  is executed; otherwise, step  105  is executed. 
         [0050]    The above disk parameter includes, but not limited to, main boot sector parameter, partition boot sector parameter and file allocation table (FAT) parameter. 
         [0051]    In step  105 , the fundamental software integrality authentication and recovery module of trusted OS extracts disk data prestored in the security storage component, to replace the current disk sector parameter and then proceeds to step  106 . 
         [0052]    In step  106 , the fundamental software integrality authentication and recovery module of trusted OS checks whether the integrality value of the trusted file list is consistent with an integrality value prestored in the security storage component or not; if it is, step  108  is executed; otherwise, step  107  is executed. 
         [0053]    In step  107 , the fundamental software integrality authentication and recovery module of trusted OS extracts a trusted file list prestored in the security storage component to replace the current trusted file list and then proceeds to step  108 . 
         [0054]    In step  108 , the fundamental software integrality authentication and recovery module of trusted OS reads the OS core files in the trusted file list and checks whether the integrality value of the OS core file is consistent with an integrality value prestored in the security storage component or not; if it is, step  110  is executed; otherwise, step  109  is executed. 
         [0055]    In step  109 , the fundamental software integrality authentication and recovery module of trusted OS extracts an OS core file prestored in the security storage component to replace the current OS core file and then proceeds to step  110 . 
         [0056]    In step  110 , the OS is loaded and run. 
         [0057]    So far, it is possible to ensure that the OS under in running is secured. In the above embodiment, the basic file management system is provided in the underlying firmware such that the speed for starting and booting the computer can be increased. It is obvious that the basic file management system can also be provided in the security storage component or the OS. The trusted file list can be provided in the security storage component or the OS. 
         [0058]    After the OS enters into normal running, the trusted file authentication module is started to authenticate the current file to be operated and the trusted process memory code authentication module is also started to authenticate the running state and integrality for all process code so as to ensure the security for the running environment in the computer. Next, the authentication methods for the trusted file authentication module and the trusted process memory code authentication module will be explained respectively. 
         [0059]      FIG. 2  shows a schematic flowchart for authenticating a current file to be operated by the trusted file authentication module. 
         [0060]    In step  201 , the trusted file authentication module intercepts all file operation behaviors including file reading/writing, file attribution modification, file deletion and file creation. 
         [0061]    In step  202 , the trusted file authentication module checks whether the current file to be operated is a file in the trusted file list or not; if it is, proceeding to step  203 ; otherwise, proceeding to step  208 . 
         [0062]    In step  203 , the type of the current file operation behavior is checked; step  204  is executed if the type is reading; step  207  is executed if it is modification. 
         [0063]    In step  204 , it is checked whether the integrality value of the current file to be operated is consistent with an integrality value prestored in the security storage component or not; if they are consistent, step  206  is executed; otherwise, step  205  is executed. 
         [0064]    In step  205 , a prestored trusted file is extracted from the security storage component to replace the current file. 
         [0065]    In step  206 , the current file to be operated is loaded into the memory and reading from a visitor is allowed, then the flow is ended. 
         [0066]    In step  207 , after it is checked that the computer is currently in secured state, the visitor is allowed to modify the trusted file list; the integrality values for the trusted file list and the modified file are recalculated and stored in the security storage component. The flow is then ended. 
         [0067]    The above modification includes, but not limited to, writing and/or attribution modification and/or deletion and /or new file creation. The process for checking whether the computer is currently in secured state or not is: checking whether or not the computer currently has physical connection with any network and the trusted file list is in a modification enabled state. The so-called modification enabled state is a state in which a security physical switch is enabled. Now turning to  FIG. 4 , which shows a schematic diagram for enabling modification under the control of the physical switch. One physical switch for enabling modification is provided to connect to the ground at one end and to I/O control module on the main board of the computer at the other end. The I/O control module can be realized in a chip set or CPU. The interface between the physical switch and the I/O control module can be, but not limited to, GPIO, serial port, parallel port or USB port. When it is checked whether the trusted file list is currently in the modification enable state or not, “ON” or “OFF” state of the physical switch is read at the I/O address for the physical switch, and it is determined that the trusted file list is currently in the modification enabled state if the physical switch is in “OFF” state if the physical switch is in “ON” state, the trusted file list is currently in a modification disabled state. 
         [0068]    In step  208 , after the completion of virus detection on the untrusted file, a process corresponding to the file is loaded into a virtual machine, which monitors the behavior of the process and gives an alarm and closes down the process if any illegal behavior is found in the process; if no illegal behavior, allowing the operation on the file. 
         [0069]    The above virtual machine is a kind of software running in the computer and simulates the monitor on the process behavior by a real computer. The above illegal behavior includes at least illegal modification on OS file and/or illegal modification on disk and/or illegal boundary violation in memory access and/or illegal jumping. 
         [0070]      FIG. 3  shows a schematic flowchart for authenticating process code by the trusted process memory code authentication module. 
         [0071]    In step  301 , after the file is confirmed as a trusted file, the integrality value of process code in the memory for a process corresponding to the file is calculated when the file is loaded into the memory for the first time, and the integrality value is stored in the security storage component. 
         [0072]    In step  302 , the trusted process memory code authentication module authenticates on timing whether the running state of all the processes and the integrality value of all current process code are normal or not; if it is so, proceeds to step  303 , otherwise continues the normal execution and repeats regularly step  302 . 
         [0073]    The above process for authenticating whether the running state of all process code is normal or not is: checking whether a pointer to a process program exceeds physical memory address prescribed by the process or not, and/or whether the process code traverses the prescribed physical memory address or not. The process for authenticating whether the integrality of all process code is normal or not is: authenticating whether the integrality value of all current process code is consistent with the integrality value prestored in the security storage component or not; if it is, determining the process code is normal; otherwise, abnormal. 
         [0074]    Wherein, the operation for checking whether a pointer to a process program exceeds physical memory address prescribed by the process or not, and/or whether the process code traverses the prescribed physical memory address or not can be realized in software, CPU or chip set. 
         [0075]    In step  303 , an alarm is given. Field data for running the process is saved and the process is closed down. The file corresponding to the abnormal process can be authenticated again by the trusted file authentication module and then loaded into the memory again. The integrality value of the process corresponding to the file in the memory can be recalculated and stored in the security storage component. The process can be recovered to its previous running state based on the field data previously saved for running the process. 
         [0076]    The above-mentioned security storage component can be a hard disk storage component with mandatory access control authorization, a chip storage component with mandatory access authorization control or a memory component with access control mechanism. The protection for the above hard disk storage component is fulfilled by a hard disk control logic circuit and independent of hard disk logic partition and OS partition. The so-called mandatory access control authorization means that the security storage component can identify a visitor based on password and accept access from the visitor only when the identification is successful, or that the security storage component and the visitor utilize a pair of secret information shared in advance and certification protocol based on the calculation involving hash function and random number to certify the visitor&#39;s identity, and the security storage component accepts the access only when the certification is successful. 
         [0077]    Specifically, the above-mentioned security storage component can be a security chip (e.g.,TPM, Trusted Plafform Module), a hard disk with security protection function, such as a hard disk with HPA (Host Protected Area) or a flash storage with access control function. A detail description to the security chip has been disclosed in the application CN03138380.7 “A Security chip and Information Security Processing Device and Method Based on the Chip” by the applicant, which will not be repeated here. Moreover, the method for authenticating underlying firmware in the computer has been illustrated in the application, so it will not be repeated in step  101 . 
         [0078]    The above is merely preferred embodiments of the present invention and not intended to limit the invention. Any change, substitution or modification made within the spirit and principle of the invention should be encompassed in the scope of the invention.