A dynamic trust measurement method, device, system and terminal for a process
By adopting dynamic trustworthy metrics in TrustZone and OP-TEE trusted operating systems, using page hash value and page hash reference value to progress, the problem of insufficient security in traditional Linux operating systems is solved, and a higher level is achieved security and adaptability.
Patent Information
- Application Number
- CN202111030733.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-03
- Publication Date
- 2024-11-15
- Estimated Expiration
- 2041-09-03
AI Technical Summary
Traditional Linux operating systems lack a secure and trusted execution environment with hardware isolation, which makes secure and trusted software vulnerable to attacks and poses huge security risks.
Using a trusted operating system based on TrustZone and OP-TEE, the page hash value and page hash reference value are used to perform trusted measurement of processes through dynamic trustworthy measurement methods, isolate the ordinary world and the secure world, reduce the attack surface, and improve the Security.
Effectively reduce the attack surface, ensure the accuracy of trusted measurement, improve the security of trusted software and the effectiveness of results, reduce hardware costs, and adapt to a variety of hardware platforms.
Smart Images

Figure CN113626772B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technology, and in particular to a dynamic trust measurement method, device, system and terminal for a process. Background Art
[0002] Since the traditional Linux operating system runs on a platform without an isolated secure and trusted execution environment on the hardware, the secure and trusted software implemented on it can only be forced to share a space with the system. Since the traditional trusted solution shares a non-isolated space with the system, both measurement and configuration data are vulnerable to attacks. The kernel has many and complex functions, which makes the implementation quite complicated. Various system subsystems share the same kernel space, which undoubtedly creates a huge attack surface and brings security issues. Summary of the invention
[0003] The technical purpose to be achieved by the embodiments of the present application is to provide a dynamic trust measurement method, device, system and terminal for a process, so as to solve the problem that current secure and trusted software is more vulnerable to attacks and has security risks.
[0004] To solve the above technical problems, the embodiment of the present application provides a dynamic trust measurement method for a process, which is applied to a trust measurement device based on TrustZone and an Open Portable Trusted Execution Environment (OP-TEE) trusted operating system, and the method includes:
[0005] When the trusted measurement of the first process is triggered, a target page address corresponding to the memory segment to be measured is obtained according to the physical page where the page table of the first process is located;
[0006] According to the target page address, a page hash value corresponding to the target page is obtained, and a page hash reference value for the target page is obtained from a pre-stored reference library;
[0007] Obtaining a current measurement stage of a target page in the memory segment to be measured, and obtaining a trusted measurement result according to the current measurement stage, the page hash value, and the page hash reference value;
[0008] Processing is performed according to the credibility measurement result and the first preset processing strategy.
[0009] Specifically, the dynamic trust measurement method of the process as described above triggers the trust measurement of the first process when a first call indication of a secure monitor call (Secure Monitor Call, SMC) is received or the current time reaches any expiration time of the first process in the scheduled task list;
[0010] Among them, the first call instruction is sent by the SMC when it determines that the ordinary world trusted agent module intercepts the first preset operation point through the Linux security module (Linux security module, referred to as LSM), and the first preset operation point is a pre-configured security control operation point.
[0011] Preferably, the dynamic trust measurement method of the process as described above, before the step of obtaining the page hash value corresponding to the target page according to the target page address and obtaining the page hash reference value of the target page from a pre-stored reference library, the method further includes:
[0012] Determine whether a target page in the memory segment to be measured is a resident page;
[0013] When the target page is a non-resident page, skip the target page;
[0014] When the target page is a resident page, the steps of obtaining a page hash value corresponding to the memory segment to be measured according to the memory segment type of the memory segment to be measured and the target page address, and obtaining a page hash reference value of the memory segment to be measured from a pre-stored reference library are performed.
[0015] Furthermore, the dynamic trust measurement method of the process as described above,
[0016] The step of obtaining the current measurement stage of the target page in the memory segment to be measured, and obtaining a trusted measurement result according to the current measurement stage, the page hash value and the page hash reference value comprises:
[0017] When the current measurement phase of the target page is the initial measurement phase, obtaining the memory segment type of the target page;
[0018] When the memory segment type of the target page is a readable data segment and there is a dynamically generated mark on the target page, copy the content of the target page, and delete the corresponding binding data content according to the data address group of the dynamic binding address recorded on the target page;
[0019] Obtaining an initial page hash value corresponding to the target page after deleting the binding data content;
[0020] Compare the initial page hash value with the page hash reference value to obtain a first comparison result;
[0021] When the first comparison result is credible, a new page hash reference value corresponding to the target page is obtained according to a preset executable linking format (ELF) dynamic binding algorithm;
[0022] The trust measurement result is obtained according to the page hash value and the new page hash reference value, and the reference library is updated according to the new page hash reference value.
[0023] Specifically, the dynamic trust measurement method of the process as described above further includes:
[0024] When the process exit of the first process is triggered, the resources related to the first process are cleared and the trusted measurement is ended, wherein when the second call instruction of the SMC is received, the process exit of the first process is triggered, and the second call instruction is sent by the SMC when it is determined that the ordinary world trusted agent module intercepts the process exit operation point through the LSM framework.
[0025] Specifically, the dynamic trust measurement method of the process as described above further includes:
[0026] When the process storage of the first process is triggered, the digital signature of the first process is obtained; the digital signature is decrypted according to the public key of the preset asymmetric algorithm to obtain the decrypted digital signature;
[0027] Performing integrity check on the process file of the first process according to the decrypted digital signature;
[0028] When the integrity check passes, a page benchmark value is generated based on the process file and stored in the benchmark library.
[0029] Furthermore, in the above-mentioned dynamic trust measurement method for a process, the steps of generating a page reference value according to a process file and storing it in a reference library include:
[0030] Get the memory segment type of each memory segment in the process file. The memory segment types include: code segment and read-only data segment;
[0031] When the memory segment type of the memory segment is a code segment, the ELF table in the process file is parsed to obtain the content of the code segment, and the corresponding page hash benchmark value is generated by page and stored in the benchmark library;
[0032] When the memory segment type of the memory segment is a read-only data segment, the ELF table is parsed to obtain the content of the read-only data segment, and the corresponding page hash reference value is generated by page. When a target page has dynamically generated content, the target page is marked with a dynamically generated mark, and the data address group of the dynamically bound address is recorded and stored in the reference library.
[0033] Preferably, in the above-mentioned dynamic trust measurement method of a process, when the process start of the first process is triggered, the method further comprises:
[0034] The expiration time for periodic credibility measurement of the first process is added to the preset scheduled task list, or a new scheduled task list for periodic credibility measurement of the first process is created.
[0035] Another preferred embodiment of the present application further provides a trust measurement device, comprising:
[0036] A first processing module is used to obtain a target page address corresponding to the memory segment to be measured according to a physical page where a page table of the first process is located when the trusted measurement of the first process is triggered;
[0037] The second processing module is used to obtain a page hash value corresponding to the target page according to the target page address, and obtain a page hash reference value for the target page from a pre-stored reference library;
[0038] The third processing module is used to obtain the current measurement stage of the target page in the memory segment to be measured, and obtain a trusted measurement result according to the current measurement stage, the page hash value and the page hash reference value;
[0039] The fourth processing module is used to perform processing according to the trust measurement result and the first preset processing strategy.
[0040] Specifically, the trust measurement device as described above triggers the trust measurement of the first process when receiving the first call indication of the security monitoring call SMC or the current time reaches any expiration time of the first process in the scheduled task list;
[0041] Among them, the first call instruction is sent by the SMC when it determines that the ordinary world trusted agent module intercepts the first preset operation point through the Linux security module LSM framework. The first preset operation point is a pre-configured security control operation point.
[0042] Specifically, the trust measurement device as described above further includes:
[0043] A fifth processing module, used for determining whether a target page in the memory segment to be measured is a resident page;
[0044] A sixth processing module, used for skipping the target page when the target page is a non-resident page;
[0045] The seventh processing module is used to execute the steps of obtaining the page hash value corresponding to the memory segment to be measured according to the memory segment type of the memory segment to be measured and the target page address when the target page is a resident page, and obtaining the page hash reference value of the memory segment to be measured from a pre-stored reference library.
[0046] Specifically, in the above-mentioned trust measurement device, the third processing module includes:
[0047] A first processing unit, configured to obtain a memory segment type of the target page when the current measurement phase of the target page is an initial measurement phase;
[0048] a second processing unit, configured to copy the content of the target page when the memory segment type of the target page is a readable data segment and a dynamically generated mark exists on the target page, and delete the corresponding binding data content according to the data address group of the dynamic binding address recorded on the target page;
[0049] The third processing unit is used to obtain the initial page hash value corresponding to the target page after deleting the binding data content;
[0050] A fourth processing unit, configured to compare the initial page hash value with the page hash reference value to obtain a first comparison result;
[0051] A fifth processing unit, configured to obtain a new page hash reference value corresponding to the target page according to a preset executable file ELF dynamic binding algorithm when the first comparison result is credible;
[0052] The sixth processing unit is used to obtain a trusted measurement result according to the page hash value and the new page hash reference value, and update the reference library according to the new page hash reference value.
[0053] Specifically, the trust measurement device as described above further includes:
[0054] The eighth processing module is used to clear the resources related to the first process and end the trusted measurement when the process exit of the first process is triggered, wherein the process exit of the first process is triggered when the second call instruction of the SMC is received, and the second call instruction is sent by the SMC when it determines that the ordinary world trusted agent module intercepts the process exit operation point through the LSM framework.
[0055] Specifically, the trust measurement device as described above further includes:
[0056] A ninth processing module is used to obtain a digital signature of the first process when the process storage of the first process is triggered; decrypt the digital signature according to a public key of a preset asymmetric algorithm to obtain a decrypted digital signature;
[0057] a tenth processing module, configured to perform integrity verification on the process file of the first process according to the decrypted digital signature;
[0058] The eleventh processing module is used to generate a page reference value according to the process file when the integrity check passes, and store it in the reference library.
[0059] Specifically, in the above-mentioned trust measurement device, the eleventh processing module includes:
[0060] A seventh processing unit is used to obtain a memory segment type of each memory segment in the process file, where the memory segment types include: a code segment and a read-only data segment;
[0061] an eighth processing unit, for parsing the ELF table in the process file to obtain the content of the code segment when the memory segment type of the memory segment is a code segment, and generating a corresponding page hash reference value by page and storing it in a reference library;
[0062] The ninth processing unit is used to parse the ELF table to obtain the content of the read-only data segment when the memory segment type of the memory segment is a read-only data segment, and generate a corresponding page hash reference value by page, and when a target page has dynamically generated content, mark the target page with a dynamically generated mark, record the data address group of the dynamic binding address, and store it in the reference library.
[0063] Specifically, the trusted measurement device as described above further includes: a twelfth processing module, which is used to add the expiration time of periodic trusted measurement of the first process to the preset scheduled task list when the process of the first process starts to be triggered, or to create a new scheduled task list for periodic trusted measurement of the first process.
[0064] In another preferred embodiment of the present application, a dynamic trust measurement system for a process is provided, comprising: a trusted configuration management application tool, a trusted agent kernel module, a trusted certificate module, a trusted database, and the trusted measurement device as described above;
[0065] Among them, the trusted configuration management application tool is located in the user space of the ordinary world, and is used to receive configurations and certificates issued remotely, and to perform local management and configuration operations;
[0066] The trusted agent kernel module is located in the kernel space of the normal world and is used to collect the memory page table of the process, intercept the operation point, and trigger the process processing operation of the secure world through the SMC call module;
[0067] The trusted certificate module is located in the user space of the secure world and is used to store trusted certificates, which include digital signatures.
[0068] The trusted database is located in the user space of the secure world and is used to store data related to trusted measurements;
[0069] The trust measurement device is located in the user space of the secure world, and is used to implement the steps of the dynamic trust measurement method of the process as described above.
[0070] In another preferred embodiment of the present application, a terminal is provided, comprising a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein when the computer program is executed by the processor, the steps of the dynamic trust measurement method for the process as described above are implemented.
[0071] In yet another preferred embodiment of the present application, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the dynamic trust measurement method for a process as described above are implemented.
[0072] Compared with the prior art, the dynamic trust measurement method, device, system and terminal of a process provided by the embodiments of the present application have at least the following beneficial effects:
[0073] In this embodiment, by setting up a trusted measurement device in the secure world, when the trusted measurement of the first process is triggered, the first process is trustedly measured by obtaining the page hash value of the memory segment to be measured, the page hash reference value and the current measurement stage, and the measurement result is obtained, and the measurement result is processed according to the measurement result and the first preset processing strategy, which can effectively reduce the attack surface, ensure the accuracy of the trusted measurement, and improve the security of the trusted software and the effectiveness of its results. BRIEF DESCRIPTION OF THE DRAWINGS
[0074] Figure 1 One of the flowcharts of a dynamic trust measurement method for a process of the present application;
[0075] Figure 2 The second flowchart of the dynamic trust measurement method of a process of the present application;
[0076] Figure 3 The third flowchart of the dynamic trust measurement method of a process of the present application;
[0077] Figure 4 This is a fourth flowchart of a dynamic trust measurement method for a process of the present application;
[0078] Figure 5 A schematic diagram of the structure of a dynamic trust measurement device for a process of the present application;
[0079] Figure 6 A schematic diagram of the structure of a dynamic trust measurement system for a process of the present application. DETAILED DESCRIPTION
[0080] In order to make the technical problems, technical solutions and advantages to be solved by the application clearer, the following will be described in detail in conjunction with the accompanying drawings and specific embodiments. In the following description, specific details such as specific configurations and components are provided only to help fully understand the embodiments of the application. Therefore, it should be clear to those skilled in the art that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the application. In addition, for clarity and brevity, the description of known functions and structures has been omitted.
[0081] It should be understood that the references to "one embodiment" or "an embodiment" throughout the specification mean that the specific features, structures, or characteristics associated with the embodiment are included in at least one embodiment of the present application. Therefore, the references to "in one embodiment" or "in an embodiment" appearing throughout the specification do not necessarily refer to the same embodiment. In addition, these specific features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.
[0082] In the various embodiments of the present application, it should be understood that the size of the serial numbers of the following processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0083] It should be understood that the term "and / or" in this article is only a description of the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.
[0084] In the embodiments provided in the present application, it should be understood that "B corresponding to A" means that B is associated with A, and B can be determined according to A. However, it should also be understood that determining B according to A does not mean determining B only according to A, and B can also be determined according to A and / or other information.
[0085] See also Figure 1 A preferred embodiment of the present application provides a dynamic trust measurement method for a process, which is applied to a trust measurement device based on TrustZone and OP-TEE trusted operating system, and the method includes:
[0086] Step S101, when the trusted measurement of the first process is triggered, the target page address corresponding to the memory segment to be measured is obtained according to the physical page where the page table of the first process is located;
[0087] Step S102, obtaining a page hash value corresponding to the target page according to the target page address, and obtaining a page hash reference value for the target page from a pre-stored reference library;
[0088] Step S103, obtaining the current measurement stage of the target page in the memory segment to be measured, and obtaining a trusted measurement result according to the current measurement stage, the page hash value and the page hash reference value;
[0089] Step S104: Processing is performed according to the credibility measurement result and the first preset processing strategy.
[0090] In a specific embodiment of the present application, a dynamic trusted measurement method for a process is provided. The method is applied to a trusted measurement device based on TrustZone and OP-TEE trusted operating system. Through the TrustZone technology in the ARM processor, a secure executable environment OP-TEE trusted operating system based on hardware isolation is provided to isolate the trusted measurement device from the ordinary world, which can effectively reduce the attack surface. During the specific execution of this method, when it is determined that the trusted measurement of a process is triggered, the target page address corresponding to the memory segment to be measured is obtained according to the physical page where the page table of the process is located, that is, the trusted measurement device located in the secure world directly accesses the physical page of the process in the ordinary world using privileges, which is conducive to ensuring the security of the measurement and the credibility of the measurement results, wherein the memory segment to be measured includes at least one target page;
[0091] After obtaining the address of the target page corresponding to the memory segment to be measured, the page hash value corresponding to each target page in the memory segment to be measured is obtained by calculation, and the page hash reference value of the memory segment to be measured is obtained from the pre-stored reference library according to the target page address, so as to obtain the trusted measurement result according to the obtained page hash value and the page hash reference value. That is, in this embodiment, the trusted measurement is based on the page hash value rather than the hash value of the entire process, that is, the page hash value is used as the minimum measurement unit, which is conducive to ensuring the accuracy of the measurement.
[0092] When obtaining the trusted measurement result, in addition to the obtained page hash value and page hash reference value, the current measurement stage of the target page in the memory segment to be measured is also obtained, so that the measurement step is associated with the current measurement stage, which is convenient for executing the same or different processing methods in different measurement stages, and is conducive to realizing personalized processing and targeted processing for different measurement stages during measurement, thereby ensuring the accuracy of the obtained measurement result, wherein the measurement stage includes but is not limited to the initial measurement stage less than or equal to the preset measurement number after the process file of the first process is stored in the terminal, and the normal measurement stage greater than the preset measurement number. Preferably, the preset number is once. After obtaining the trusted measurement result, it will be processed according to the trusted measurement result and the first preset processing strategy, including but not limited to: when the trusted measurement result is trusted, continue to execute the first process or enter the next process; when the trusted measurement result is untrustworthy, at least one of alarm, prompt, end process and measurement audit is performed, wherein the content of the measurement audit includes but is not limited to the measurement log (including terminal address, event content description, event result. Occurrence time, etc.), measurement object, communication method, etc.
[0093] In summary, in this embodiment, by setting up a trusted measurement device in the secure world, when the trusted measurement of the first process is triggered, the first process is trustedly measured by obtaining the page hash value of the memory segment to be measured, the page hash reference value and the current measurement stage, and the measurement result is obtained, and the measurement result is processed according to the measurement result and the first preset processing strategy, which can effectively reduce the attack surface, ensure the accuracy of the trusted measurement, and improve the security of the trusted software and the effectiveness of its results.
[0094] It should be noted that the above-mentioned memory segment to be measured is preferably the memory segment currently corresponding to the first process when the trusted measurement is triggered.
[0095] In addition, the dynamic trust measurement method of this application is mainly implemented based on the OP-TEE trusted operating system, so that it can be adapted to all trusted hardware platforms compatible with the OP-TEE trusted operating system, which can significantly reduce hardware costs and adaptation development costs, and does not rely on specific hardware and dedicated operating systems, which is conducive to improving the cost-effectiveness and competitiveness of this application.
[0096] Specifically, the dynamic trust measurement method of the process as described above triggers the trust measurement of the first process when a first call indication of the security monitoring call SMC is received or the current time reaches any expiration time of the first process in the scheduled task list;
[0097] Among them, the first call instruction is sent by the SMC when it determines that the ordinary world trusted agent module intercepts the first preset operation point through the Linux security module (Linux security module, referred to as LSM), and the first preset operation point is a pre-configured security control operation point.
[0098] In a specific embodiment of the present application, the method of determining whether the first process is triggered includes but is not limited to receiving the first call instruction of the SMC or the current time reaching any expiration time of the first process in the scheduled task list, that is, the trusted measurement can be triggered after receiving the first call instruction, or periodically triggered through the scheduled task list, which is conducive to avoiding the security risks caused by the process that needs to be measured not being measured for a long time. The SMC can effectively solve problems such as address space conversion during cross-border access. Specifically, the first call instruction is sent by the SMC when it determines that the ordinary world trusted agent module intercepts the first preset operation point through the LSM framework. The first preset operation point is a pre-configured security control operation point, such as: the subject's opening, reading, writing and other operation points of the object.
[0099] Optionally, the pre-configuration may be performed by a trusted configuration management application tool after receiving configuration information sent from a remote end such as a network end or configuration information stored locally.
[0100] See also Figure 2 Preferably, the dynamic trust measurement method of the process as described above, before the step of obtaining the page hash value corresponding to the target page according to the target page address and obtaining the page hash reference value of the target page from the pre-stored reference library, the method further includes:
[0101] Step S201, determining whether a target page in the memory segment to be measured is a resident page;
[0102] Step S202, when the target page is a non-resident page, skip the target page;
[0103] Step S203, when the target page is a resident page, execute the steps of obtaining the page hash value corresponding to the memory segment to be measured according to the memory segment type of the memory segment to be measured and the target page address, and obtaining the page hash reference value of the memory segment to be measured from a pre-stored reference library.
[0104] In another embodiment of the present application, before performing page hash operations on each target page in the memory segment to be measured in turn, since the target page includes a resident page and / or a non-resident page, and the page will be skipped when executing a non-resident page, when performing the page hash operation, it is determined whether the target page is a resident page. If it is a resident page, the subsequent steps of obtaining the page hash value are executed; if it is a non-resident page, the target page is skipped to ensure accurate acquisition of valid page hash values in the memory segment to be measured and improve computing efficiency.
[0105] See also Figure 3 Further, the dynamic trusted measurement method of the process as described above, the steps of obtaining the current measurement stage of the target page in the memory segment to be measured, and obtaining the trusted measurement result according to the current measurement stage, the page hash value and the page hash reference value include:
[0106] Step S301, when the current measurement phase of the target page is the initial measurement phase, obtaining the memory segment type of the target page;
[0107] Step S302, when the memory segment type of the target page is a readable data segment and there is a dynamically generated mark on the target page, copy the content of the target page, and delete the corresponding binding data content according to the data address group of the dynamic binding address recorded on the target page;
[0108] Step S303, obtaining the initial page hash value corresponding to the target page after deleting the binding data content;
[0109] Step S304, comparing the initial page hash value with the page hash reference value to obtain a first comparison result;
[0110] Step S305, when the first comparison result is credible, a new page hash reference value corresponding to the target page is obtained according to a preset executable file ELF dynamic binding algorithm;
[0111] Step S306: Obtain a trustworthy measurement result according to the page hash value and the new page hash reference value, and update the reference library according to the new page hash reference value.
[0112] In another preferred embodiment of the present application, since dynamically generated content may exist in the readable data segment in the process, the content of the target page with the dynamically generated content during process execution has added dynamic data compared to the content when the process file is stored, and therefore, it is impossible to make a correct judgment based on the reference value obtained during storage. Therefore, when the current measurement stage of the target page in the acquired memory segment to be measured is the initial measurement stage, the memory segment type of the target page is determined. If it is determined that the memory segment type of the target page is a readable data segment and there is a dynamically generated mark on the target page, it is processed according to the preset second preset processing strategy to obtain a trusted measurement result. If it is determined that the memory segment type of the target page is not a readable data segment, or it is determined that the memory segment type of the target page is a readable data segment, but there is no dynamically generated mark on the target page, the acquired page hash value is directly compared with the page hash reference value to obtain a trusted measurement result.
[0113] The step of processing according to the preset second preset processing strategy includes: copying the content of the target page, and deleting the corresponding binding data content according to the data address group of the dynamic binding address recorded on the target page; by copying the target page, avoiding the influence of subsequent deletion operations on the first process, performing the measurement operation under the premise of ensuring that the first process can be executed normally, and by deleting the binding content corresponding to the data address group of the dynamic binding address recorded, the initial content of the target page can be determined;
[0114] Then, obtain the initial page hash value corresponding to the target page after deleting the bound data content; compare the initial page hash value with the page hash reference value to obtain a first comparison result; that is, first compare the page hash value of the initial content of the target page with the page hash reference value to obtain the first comparison result, that is, determine whether the target page has changed after storage, to ensure that the initial content of the target page is credible, and at the same time avoid the situation where the page hash value of the target page and the content corresponding to the page hash reference value are different, resulting in the situation that the trusted measurement result itself is unreliable.
[0115] When the first comparison result is credible, a new page hash reference value corresponding to the target page is obtained according to the preset executable file ELF dynamic binding algorithm; a credible measurement result is obtained according to the page hash value and the new page hash reference value, and the reference library is updated according to the new page hash reference value. That is, after re-obtaining the page hash reference value of the target page when it has dynamically generated content according to the preset executable file ELF dynamic binding algorithm, it is used as a judgment standard for the target page with dynamically generated content, and the target page is credibly measured according to the judgment standard to obtain a credible measurement result, which is conducive to ensuring the accuracy and applicability of the page hash reference value; at the same time, by updating the reference library according to the new page hash reference value, when the target page is measured again, the new page hash reference value can be directly used for judgment, which is conducive to reducing the amount of calculation and improving efficiency.
[0116] It should be noted that the preset ELF dynamic binding algorithm is an algorithm for obtaining page hash values corresponding to the ELF file format, which includes but is not limited to the optimization algorithm of SM3.
[0117] Specifically, the dynamic trust measurement method of the process as described above further includes:
[0118] When the process exit of the first process is triggered, the resources related to the first process are cleared and the trusted measurement is ended, wherein when the second call instruction of the SMC is received, the process exit of the first process is triggered, and the second call instruction is sent by the SMC when it is determined that the ordinary world trusted agent module intercepts the process exit operation point through the LSM framework.
[0119] In another preferred embodiment of the present application, when the SMC receives the second call instruction sent by the ordinary world trusted agent module when it determines that the ordinary world trusted agent module intercepts the process exit operation point through the LSM framework, it is determined that the current ordinary world process needs to exit the process. At this time, the trusted measurement device clears the resources related to the first process and ends the trusted measurement, which is conducive to clearing useless resource occupation, improving resource utilization, and improving efficiency.
[0120] See also Figure 4 Specifically, the dynamic trust measurement method of the process as described above further includes:
[0121] Step S401, when the process storage of the first process is triggered, obtaining the digital signature of the first process;
[0122] Step S402, decrypting the digital signature according to the public key of the preset asymmetric algorithm to obtain a decrypted digital signature;
[0123] Step S403, performing integrity check on the process file of the first process according to the decrypted digital signature;
[0124] Step S404: when the integrity check passes, a page reference value is generated according to the process file and stored in the reference library.
[0125] In a preferred embodiment of the present application, in order to ensure the integrity of the executed process, when the process storage of the first process is triggered, the digital signature of the first process will be obtained, wherein the digital signature of the first process is not prevented from being intercepted when it is sent, etc., and the digital signature will be encrypted, and preferably encrypted using a preset asymmetric algorithm, so after obtaining the digital signature, the digital signature will be preferentially decrypted according to the public key of the preset asymmetric algorithm, and then the process file of the first process will be checked for integrity according to the decrypted digital signature, and only when the integrity check passes, the page reference value will be generated according to the process file and stored in the reference library, which is conducive to ensuring the integrity and accuracy of the reference value in the obtained reference library. Among them, the preset asymmetric algorithm is preferably SM2. The integrity, ease of use and confidentiality of the process file are guaranteed by adopting the certificate mechanism and algorithm.
[0126] Optionally, when the process of the first process starts to be triggered, the above steps on integrity verification are also performed, that is, when the process of the first process starts to be triggered, the digital signature of the first process is obtained; the digital signature is decrypted according to the public key of the preset asymmetric algorithm to obtain the decrypted digital signature; the process file of the first process is integrity verified according to the decrypted digital signature; when the integrity verification passes, the first process is started. It is used to pre-verify the integrity of the process at the beginning, which is conducive to avoiding unnecessary process startup.
[0127] Furthermore, in the above-mentioned dynamic trust measurement method for a process, the steps of generating a page reference value according to a process file and storing it in a reference library include:
[0128] Get the memory segment type of each memory segment in the process file. The memory segment types include: code segment and read-only data segment;
[0129] When the memory segment type of the memory segment is a code segment, the ELF table in the process file is parsed to obtain the content of the code segment, and the corresponding page hash benchmark value is generated by page and stored in the benchmark library;
[0130] When the memory segment type of the memory segment is a read-only data segment, the ELF table is parsed to obtain the content of the read-only data segment, and the corresponding page hash reference value is generated by page. When a target page has dynamically generated content, the target page is marked with a dynamically generated mark, and the data address group of the dynamically bound address is recorded and stored in the reference library.
[0131] In a specific embodiment of the present application, when generating a page reference value according to a process file and storing it in a reference library, the memory segment type of each memory segment in the process file is first obtained. The following explanation is given by taking the memory segment types including code segments and read-only data segments as an example.
[0132] When the memory segment type of the memory segment is a code segment, the ELF table in the process file is directly parsed to obtain the content of the memory segment, and the corresponding page hash benchmark value is generated by page and stored in the benchmark library;
[0133] When the memory segment type of the memory segment is a read-only data segment, the ELF table is parsed to obtain the content of the memory segment, and the corresponding page hash reference value is generated by page. When a target page has dynamically generated content, the target page is also marked with a dynamic generation mark, and the data address group of the dynamic binding address is recorded and stored in the reference library to inform the target page of the presence of dynamically generated content, so as to facilitate subsequent corresponding operations.
[0134] Preferably, in the above-mentioned dynamic trust measurement method of a process, when the process start of the first process is triggered, the method further comprises:
[0135] The expiration time for periodic credibility measurement of the first process is added to the preset scheduled task list, or a new scheduled task list for periodic credibility measurement of the first process is created.
[0136] In a preferred embodiment of the present application, when the process of the first process begins to be triggered, in order to avoid the situation where the first process does not trigger the trusted measurement for a long time, resulting in security risks, the first process will be periodically trusted. The method of implementing the periodic trusted measurement includes but is not limited to: adding an expiration time for periodic trusted measurement of the first process to the original preset scheduled task list, or creating a new scheduled task list for periodic trusted measurement of the first process, so that when the time reaches the expiration time in the scheduled task list, the trusted measurement is performed to ensure the security and trustworthiness of the first process.
[0137] See also Figure 5 Another preferred embodiment of the present application further provides a trust measurement device, comprising:
[0138] The first processing module 501 is used to obtain a target page address corresponding to the memory segment to be measured according to the physical page where the page table of the first process is located when the trusted measurement of the first process is triggered;
[0139] The second processing module 502 is used to obtain a page hash value corresponding to the target page according to the target page address, and obtain a page hash reference value for the target page from a pre-stored reference library;
[0140] The third processing module 503 is used to obtain the current measurement stage of the target page in the memory segment to be measured, and obtain a trusted measurement result according to the current measurement stage, the page hash value and the page hash reference value;
[0141] The fourth processing module 504 is used to perform processing according to the trust measurement result and the first preset processing strategy.
[0142] Specifically, the trust measurement device as described above triggers the trust measurement of the first process when receiving the first call indication of the security monitoring call SMC or the current time reaches any expiration time of the first process in the scheduled task list;
[0143] Among them, the first call instruction is sent by the SMC when it determines that the ordinary world trusted agent module intercepts the first preset operation point through the Linux security module LSM framework. The first preset operation point is a pre-configured security control operation point.
[0144] Specifically, the trust measurement device as described above further includes:
[0145] A fifth processing module, used for determining whether a target page in the memory segment to be measured is a resident page;
[0146] A sixth processing module, used for skipping the target page when the target page is a non-resident page;
[0147] The seventh processing module is used to execute the steps of obtaining the page hash value corresponding to the memory segment to be measured according to the memory segment type of the memory segment to be measured and the target page address when the target page is a resident page, and obtaining the page hash reference value of the memory segment to be measured from a pre-stored reference library.
[0148] Specifically, in the above-mentioned trust measurement device, the third processing module includes:
[0149] A first processing unit, configured to obtain a memory segment type of the target page when the current measurement phase of the target page is an initial measurement phase;
[0150] a second processing unit, configured to copy the content of the target page when the memory segment type of the target page is a readable data segment and a dynamically generated mark exists on the target page, and delete the corresponding binding data content according to the data address group of the dynamic binding address recorded on the target page;
[0151] The third processing unit is used to obtain the initial page hash value corresponding to the target page after deleting the binding data content;
[0152] A fourth processing unit, configured to compare the initial page hash value with the page hash reference value to obtain a first comparison result;
[0153] A fifth processing unit, configured to obtain a new page hash reference value corresponding to the target page according to a preset executable file ELF dynamic binding algorithm when the first comparison result is credible;
[0154] The sixth processing unit is used to obtain a trusted measurement result according to the page hash value and the new page hash reference value, and update the reference library according to the new page hash reference value.
[0155] Specifically, the trust measurement device as described above further includes:
[0156] The eighth processing module is used to clear the resources related to the first process and end the trusted measurement when the process exit of the first process is triggered, wherein the process exit of the first process is triggered when the second call instruction of the SMC is received, and the second call instruction is sent by the SMC when it determines that the ordinary world trusted agent module intercepts the process exit operation point through the LSM framework.
[0157] Specifically, the trust measurement device as described above further includes:
[0158] A ninth processing module is used to obtain a digital signature of the first process when the process storage of the first process is triggered; decrypt the digital signature according to a public key of a preset asymmetric algorithm to obtain a decrypted digital signature;
[0159] a tenth processing module, configured to perform integrity verification on the process file of the first process according to the decrypted digital signature;
[0160] The eleventh processing module is used to generate a page reference value according to the process file when the integrity check passes, and store it in the reference library.
[0161] Specifically, in the above-mentioned trust measurement device, the eleventh processing module includes:
[0162] A seventh processing unit is used to obtain a memory segment type of each memory segment in the process file, where the memory segment types include: a code segment and a read-only data segment;
[0163] an eighth processing unit, for parsing the ELF table in the process file to obtain the content of the code segment when the memory segment type of the memory segment is a code segment, and generating a corresponding page hash reference value by page and storing it in a reference library;
[0164] The ninth processing unit is used to parse the ELF table to obtain the content of the read-only data segment when the memory segment type of the memory segment is a read-only data segment, and generate a corresponding page hash reference value by page, and when a target page has dynamically generated content, mark the target page with a dynamically generated mark, record the data address group of the dynamic binding address, and store it in the reference library.
[0165] Specifically, the trusted measurement device as described above further includes: a twelfth processing module, which is used to add the expiration time of periodic trusted measurement of the first process to the preset scheduled task list when the process of the first process starts to be triggered, or to create a new scheduled task list for periodic trusted measurement of the first process.
[0166] The embodiment of the trust measurement device of the present application is a device corresponding to the embodiment of the dynamic trust measurement method of the above process. All implementation means in the above method embodiment are applicable to the embodiment of the device and can achieve the same technical effect.
[0167] See also Figure 6 , in yet another preferred embodiment of the present application, a dynamic trust measurement system for a process is also provided, comprising: a trusted configuration management application tool 601, a trusted agent kernel 602 module, a trusted certificate module 603, a trusted database 604, and the trusted measurement device 605 as described above;
[0168] The trusted configuration management application tool 601 is located in the user space of the ordinary world and is used to receive configurations and certificates issued remotely and to perform local management configuration operations;
[0169] The trusted agent kernel 602 module is located in the kernel space of the normal world and is used to collect the memory page table of the process, intercept the operation point, and trigger the process processing operation of the secure world through the SMC call module 606;
[0170] The trusted certificate module 603 is located in the user space of the secure world and is used to store trusted certificates, which include digital signatures;
[0171] The trusted database 604 is located in the user space of the secure world and is used to store data related to the trusted measurement;
[0172] The trust measurement device 605 is located in the user space of the secure world, and is used to implement the steps of the dynamic trust measurement method of the process as described above.
[0173] In a preferred embodiment of the present application, a dynamic trusted measurement system for a process is also provided. The dynamic trusted measurement system is implemented based on TrustZone and OP-TEE trusted operating systems. Specifically, the components in the dynamic trusted measurement system belong to the normal world and the secure world, and belong to the user space and the kernel space. The normal world is implemented based on the Linux operating system, and the secure world is implemented based on the OP-TEE trusted operating system.
[0174] Specifically, the dynamic trusted measurement system includes: a trusted configuration management application tool 601, a trusted agent kernel 602 module, a trusted certificate module 603, a trusted database 604, and a trusted measurement device 605 as described above;
[0175] Among them, the trusted configuration management application tool 601 is located in the user space of the ordinary world, and is used to receive the configuration and certificate sent from the remote end, and to perform local management configuration operations, so as to configure other components in the dynamic trusted measurement system; for example: after receiving the configuration sent from the remote end or obtaining the local configuration, the first preset operation point is configured according to the configuration to ensure the implementation of the dynamic trusted measurement method.
[0176] The trusted proxy kernel 602 module is located in the kernel space of the ordinary world, and is used to collect the memory page tables of application processes located in the user space of the ordinary world, intercept operation points, and trigger process processing operations in the secure world; when the process processing operation of the secure world is triggered, the SMC calling module 606 that bridges the kernel space of the ordinary world and the kernel space of the secure world is used to trigger the calling of the corresponding process processing operation in the secure world.
[0177] The trusted certificate module 603 is located in the user space of the secure world and is used to store trusted certificates, which include digital signatures;
[0178] The trusted database 604 is located in the user space of the secure world and is used to store data related to the trusted metrics.
[0179] The trusted measurement device 605 is located in the user space of the secure world, and is used to implement the steps of the dynamic trusted measurement method for the process as described above, wherein when executing the steps of the dynamic trusted measurement method for the process as described above, data can be stored and obtained in the trusted certificate module 603 and / or the trusted database 604. For example: the digital signature stored in the trusted certificate module 603; the benchmark library stored in the trusted database 604, etc.
[0180] It should be noted that the algorithm for obtaining the hash value not specifically described herein is preferably SM3. In another preferred embodiment of the present application, a terminal is provided, including a processor, a memory, and a computer program stored in the memory and executable on the processor, and when the computer program is executed by the processor, the steps of the dynamic trust measurement method of the process as described above are implemented.
[0181] In yet another preferred embodiment of the present application, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the dynamic trust measurement method for a process as described above are implemented.
[0182] In addition, the present application may repeat reference numerals and / or letters in different examples. This repetition is for the purpose of simplicity and clarity, and does not in itself indicate the relationship between the various embodiments and / or settings discussed.
[0183] It should also be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusions.
[0184] The above is a preferred embodiment of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles described in the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A dynamic trust measurement method for a process, applied to a trust measurement device based on TrustZone and an open portable trusted execution environment OP-TEE trusted operating system, characterized in that: The method comprises: When the trusted measurement of the first process is triggered, obtaining a target page address corresponding to the memory segment to be measured according to the physical page where the page table of the first process is located; According to the target page address, a page hash value corresponding to the target page is obtained, and a page hash reference value for the target page is obtained from a pre-stored reference library; Obtaining a current measurement stage of a target page in the memory segment to be measured, and obtaining a trusted measurement result according to the current measurement stage, the page hash value, and the page hash reference value; Processing according to the trust measurement result and a first preset processing strategy; Before the step of acquiring the page hash value corresponding to the target page according to the target page address and acquiring the page hash reference value of the target page from a pre-stored reference library, the method further includes: Determining whether a target page in the memory segment to be measured is a resident page; When the target page is a non-resident page, skipping the target page; When the target page is a resident page, the steps of obtaining a page hash value corresponding to the memory segment to be measured according to the memory segment type of the memory segment to be measured and the target page address, and obtaining a page hash reference value for the memory segment to be measured from a pre-stored reference library are executed.
2. The dynamic trust measurement method of a process according to claim 1, characterized in that: When a first call instruction of the security monitoring calling SMC is received or the current time reaches any expiration time of the first process in the scheduled task list, the trust measurement of the first process is triggered; Among them, the first calling instruction is sent by the SMC when it determines that the ordinary world trusted agent module intercepts the first preset operation point through the Linux security module LSM framework, and the first preset operation point is a pre-configured security control operation point.
3. The dynamic trust measurement method of a process according to claim 1, characterized in that: The step of obtaining the current measurement stage of the target page in the memory segment to be measured, and obtaining a trusted measurement result according to the current measurement stage, the page hash value and the page hash reference value comprises: When the current measurement phase of the target page is the initial measurement phase, obtaining the memory segment type of the target page; When the memory segment type of the target page is a readable data segment and there is a dynamically generated mark on the target page, copy the content of the target page, and delete the corresponding binding data content according to the data address group of the dynamic binding address recorded on the target page; Obtaining an initial page hash value corresponding to the target page after deleting the binding data content; Compare the initial page hash value with the page hash reference value to obtain a first comparison result; When the first comparison result is credible, a new page hash reference value corresponding to the target page is obtained according to a preset executable file ELF dynamic binding algorithm; The trust measurement result is obtained according to the page hash value and the new page hash reference value, and the reference library is updated according to the new page hash reference value.
4. The dynamic trust measurement method of a process according to claim 1, characterized in that: Also includes: When the process exit of the first process is triggered, resources related to the first process are cleared and the trusted measurement is ended, wherein when a second call instruction of the SMC is received, the process exit of the first process is triggered, and the second call instruction is sent by the SMC when it is determined that the ordinary world trusted agent module intercepts the process exit operation point through the LSM framework.
5. The dynamic trust measurement method of a process according to claim 1, characterized in that: Also includes: When the process storage of the first process is triggered, obtaining a digital signature of the first process; decrypting the digital signature according to a public key of a preset asymmetric algorithm to obtain the decrypted digital signature; Performing integrity verification on the process file of the first process according to the decrypted digital signature; When the integrity check passes, a page reference value is generated according to the process file and stored in the reference library.
6. The dynamic trust measurement method of a process according to claim 5, characterized in that: The step of generating a page reference value according to the process file and storing it in the reference library comprises: Obtaining a memory segment type of each memory segment in the process file, wherein the memory segment types include: a code segment and a read-only data segment; When the memory segment type of the memory segment is a code segment, the ELF table in the process file is parsed to obtain the content of the code segment, and a corresponding page hash reference value is generated by page and stored in the reference library; When the memory segment type of the memory segment is a read-only data segment, the ELF table is parsed to obtain the content of the read-only data segment, and a corresponding page hash reference value is generated by page. When a target page has dynamically generated content, the target page is marked with a dynamically generated mark, and the data address group of the dynamically bound address is recorded and stored in the reference library.
7. The dynamic trust measurement method of a process according to claim 1, characterized in that: When the process start of the first process is triggered, the method further includes: The expiration time for periodically performing the trust measurement on the first process is added to the preset scheduled task list, or a new scheduled task list for periodically performing the trust measurement on the first process is created.
8. A trustworthy measurement device, characterized in that: include: A first processing module, configured to obtain a target page address corresponding to a memory segment to be measured according to a physical page where a page table of the first process is located when a trusted measurement of the first process is triggered; A second processing module, configured to obtain a page hash value corresponding to the target page according to the target page address, and obtain a page hash reference value for the target page from a pre-stored reference library; A third processing module is used to obtain a current measurement stage of the target page in the memory segment to be measured, and obtain a trusted measurement result according to the current measurement stage, the page hash value and the page hash reference value; A fourth processing module, configured to perform processing according to the trust measurement result and the first preset processing strategy; The trust measurement device further includes: A fifth processing module, used for determining whether a target page in the memory segment to be measured is a resident page; A sixth processing module, used for skipping the target page when the target page is a non-resident page; The seventh processing module is used to execute the steps of obtaining the page hash value corresponding to the memory segment to be measured according to the memory segment type of the memory segment to be measured and the target page address when the target page is a resident page, and obtaining the page hash reference value of the memory segment to be measured from a pre-stored reference library.
9. A dynamic trust measurement system for a process, characterized in that: include: A trusted configuration management application tool, a trusted agent kernel module, a trusted certificate module, a trusted database, and a trusted measurement device as claimed in claim 8; The trusted configuration management application tool is located in the user space of the ordinary world, and is used to receive configurations and certificates issued remotely, and to perform local management configuration operations; The trusted agent kernel module is located in the kernel space of the ordinary world and is used to collect the memory page table of the process, intercept the operation point, and trigger the process processing operation of the secure world through the SMC; The trusted certificate module is located in the user space of the secure world and is used to store trusted certificates, wherein the trusted certificate includes a digital signature; The trusted database is located in the user space of the secure world and is used to store data related to trusted metrics; The trust measurement device is located in the user space of the secure world, and is used to implement the steps of the dynamic trust measurement method for a process as described in any one of claims 1 to 7.
10. A terminal, characterized in that: The invention comprises a processor, a memory and a computer program stored in the memory and executable on the processor, wherein when the computer program is executed by the processor, the steps of the dynamic trust measurement method of the process as claimed in any one of claims 1 to 7 are implemented.
11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the dynamic trust measurement method of a process according to any one of claims 1 to 7 are implemented.
