Dynamic measurement method, device and equipment
By deploying dynamic metric modules in the processor and storing baseline data using hash tree structures, the problem of inability to protect the process's runtime memory data in the prior art is solved, efficient dynamic metric protection is achieved, and dynamic metric monitoring modules are run in a trusted execution environment to ensure the closed loop of the trust chain.
Patent Information
- Application Number
- CN202311229465.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-21
- Publication Date
- 2025-03-21
AI Technical Summary
The prior art cannot protect the memory data during process running in real time, there is a TOC-TOU problem, and the dynamic measurement module itself may be tampered with, and the trust chain cannot be closed.
Provide a dynamic metric method, by deploying a dynamic metric module in the processor, actively triggering the metric process, using a hash tree structure to store baseline data, preset metric conditions determine the key data for measurement, and report it to the security chip. At the same time, the dynamic metric monitoring module is run in a trusted execution environment, and the dynamic metric module is measured regularly to ensure the closed loop of the trust chain.
Real-time protection of memory data during process runtime is realized, the real-time and effectiveness of dynamic measurements is improved, memory consumption is reduced, and the integrity of the trust chain is ensured.
Smart Images

Figure CN119670085A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of system security technology, and in particular to a dynamic measurement method, device and equipment. Background Art
[0002] In recent years, with the continuous development of the digital economy and information software industry, the security risks faced by information systems have also increased. As the foundation of information systems, operating systems run a large number of applications, and some applications inevitably have vulnerabilities. Once these vulnerabilities are exploited by attackers, they may have a serious impact on the system security of the operating system, such as causing privacy data leakage, core secrets theft, business unavailability, etc., causing serious business losses, etc. Most software attacks are accompanied by system integrity damage, such as malicious process running, configuration file tampering, backdoor implantation, etc.
[0003] In related technologies, in order to prevent software attacks, operating system integrity protection technology is generally used, that is, starting from the startup of the computer device, some key data is measured and verified to ensure that these key data have not been tampered with and to ensure that the system runs predictably. However, in related technologies, only static measurement of key data can be performed when the computer device is started, but memory data during process runtime cannot be protected. If an attacker uses some means to modify the code instructions of the process, the process may be hijacked or a backdoor may be implanted, which is highly concealed and has serious consequences. Summary of the invention
[0004] In view of the problem that the memory data during process operation cannot be protected in the prior art, the present application provides a dynamic measurement method, device and equipment. The present application also provides a computer-readable storage medium.
[0005] In a first aspect, the present application provides a dynamic measurement method, which is applied to a processor, the processor includes a dynamic measurement module, the dynamic measurement module is deployed in an operating environment REE, the method includes a measurement process executed by the dynamic measurement module, and the measurement process includes:
[0006] Obtain first baseline data for the target application;
[0007] When the first target data in the target application triggers a preset measurement condition, performing measurement on the first target data;
[0008] Determining, based on the first baseline data, whether a measurement result obtained by measuring the first target data is abnormal;
[0009] When there is an abnormality in the measurement result, the measurement result is stored as a first measurement log and reported to the security chip.
[0010] According to the dynamic measurement method provided by the present application, the dynamic measurement process can be actively triggered and started, effectively solving the TOC-TOU problem existing in the relevant technology, and improving the real-time and effectiveness of the dynamic measurement protection mechanism. At the same time, the key data that may actually be tampered with is determined through the preset measurement conditions, and the measurement is performed on it, and compared with the first baseline data stored in blocks through the hash tree structure to determine the measurement result, which reduces the memory consumption during the measurement process and improves the measurement efficiency.
[0011] Furthermore, first baseline data of the target application is obtained, including:
[0012] When the system is initialized, the baseline file is read. When the target application is constructed, the baseline file is obtained by measuring the second target data in the target application by the construction module and stored based on the hash tree structure. The construction module signs the baseline file.
[0013] Verify and sign the baseline documents;
[0014] When the baseline file passes the signature verification, the baseline file is determined as the first baseline data.
[0015] Further, when the first target data in the target application triggers a preset measurement condition, performing measurement on the first target data includes:
[0016] When a page fault occurs in the first target data in the target application program, performing measurement on the first target data for which mapping is established; or
[0017] When a property of first target data in the target application program changes, performing measurement on the first target data whose property has changed; or,
[0018] When it is determined that the first target data in the target application has a writable attribute, measurement is performed on the first target data having the writable attribute.
[0019] Furthermore, after performing measurement on the first target data of the writable attribute, the measurement process further includes:
[0020] Adding first target data with a writable attribute to the dirty page pool;
[0021] Perform measurement on all data in the dirty page pool according to a preset first time period;
[0022] When the writable attribute of the first target data is removed, measurement is performed on the first target data with the writable attribute removed, and the first target data is deleted from the dirty page pool.
[0023] Further, determining whether a measurement result obtained by measuring the first target data is abnormal based on the first baseline data includes:
[0024] Determine whether the measurement result of the first target data is the same as the hash value stored in the corresponding leaf node in the hash tree structure of the first baseline data;
[0025] When the measurement result is different from the hash value stored in the corresponding leaf node in the first baseline data, the root hash value is updated according to the measurement result;
[0026] When the updated root hash value is different from the root hash value in the first baseline data, it is determined that there is an abnormality in the measurement result.
[0027] Furthermore, when there is an abnormality in the measurement result, the measurement result is stored as a first measurement log and reported to the security chip, including:
[0028] The root hash value is stored as the first measurement log and reported to the security chip.
[0029] Furthermore, the first target data and the second target data include: a code segment, and / or a read-only data segment.
[0030] Furthermore, the measurement process also includes:
[0031] Sending a monitoring request to the dynamic measurement monitoring module;
[0032] The monitoring request is used to instruct the dynamic measurement monitoring module to measure the dynamic measurement module.
[0033] Furthermore, the processor also includes a dynamic measurement monitoring module, which is deployed in the trusted execution environment TEE. The method also includes a monitoring process executed by the dynamic measurement monitoring module, and the monitoring process includes:
[0034] In response to a monitoring request sent by the dynamic measurement module, obtaining second baseline data of the dynamic measurement module;
[0035] According to a preset second time period, regularly performing measurement on the third target data in the dynamic measurement module;
[0036] Determining, based on the second baseline data, whether a measurement result obtained by measuring the third target data is abnormal;
[0037] When there is an abnormality in the measurement result, the measurement result is stored as a second measurement log and reported to the security chip.
[0038] According to the dynamic measurement method provided in the present application, the dynamic measurement monitoring module running in the trusted execution environment TEE performs measurement on the dynamic measurement module in the execution environment REE, which can ensure the closed loop of the trust chain and avoid the problem of dynamic measurement function failure caused by tampering with the dynamic measurement module itself.
[0039] Furthermore, the second baseline data of the dynamic measurement module is obtained, including:
[0040] Measuring the fourth target data of the dynamic measurement module to obtain second baseline data;
[0041] The fourth target data of the dynamic measurement module includes a code segment of the dynamic measurement module and / or a read-only data segment, and the first baseline data acquired by the dynamic measurement module.
[0042] Furthermore, the third target data includes: a code segment of a dynamic measurement module, and / or a read-only data segment, and a measurement result obtained by the dynamic measurement module performing measurement on the first target data.
[0043] In a second aspect, the present application provides a dynamic measurement device, characterized in that it includes:
[0044] A first acquisition module, acquiring first baseline data of a target application;
[0045] A first measurement module, which performs measurement on the first target data when the first target data in the target application triggers a preset measurement condition;
[0046] A first determination module determines, based on the first baseline data, whether a measurement result obtained by measuring the first target data is abnormal;
[0047] The first reporting module stores the measurement result as a first measurement log and reports it to the security chip when there is an abnormality in the measurement result.
[0048] Furthermore, the device also includes:
[0049] A second acquisition module, in response to a monitoring request sent by the dynamic measurement module, acquires second baseline data of the dynamic measurement module;
[0050] A second measurement module, which regularly performs measurement on the third target data in the dynamic measurement module according to a preset second time period;
[0051] A second determination module determines, based on the second baseline data, whether a measurement result obtained by measuring the third target data is abnormal;
[0052] The second reporting module stores the measurement result as a second measurement log and reports it to the security chip when there is an abnormality in the measurement result.
[0053] In a third aspect, the present application also provides a computer device, comprising a memory for storing computer program instructions and a processor for executing the computer program instructions, wherein when the computer program instructions are executed by the processor, the computer device is triggered to execute any method step in the first aspect.
[0054] In a fourth aspect, the present application provides a computer-readable storage medium, characterized in that a computer program is stored in the computer-readable storage medium, which, when executed on a computer, enables the computer to execute any method in the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] like Figure 1 A dynamic measurement system provided by an embodiment of the present invention is shown;
[0056] like Figure 2 FIG. 1 is an overall flow chart of a dynamic measurement method provided by an embodiment of the present invention;
[0057] like Figure 3 Another dynamic measurement system provided by an embodiment of the present invention is shown;
[0058] like Figure 4 A schematic diagram of a dynamic measurement process provided by an embodiment of the present invention is shown;
[0059] like Figure 5 Shown is a flow chart of a dynamic measurement method provided by an embodiment of the present invention;
[0060] like Figure 6 The figure shows a hash tree structure provided by an embodiment of the present invention;
[0061] like Figure 7 Shown is a flow chart of a dynamic measurement method provided by an embodiment of the present invention;
[0062] like Figure 8 The figure shows a schematic diagram of an overall process of dynamic measurement provided by an embodiment of the present invention;
[0063] like Fig. 9 Shown is a flow chart of a dynamic measurement method provided by an embodiment of the present invention;
[0064] like Fig.10 FIG. 1 is a schematic diagram of a specific dynamic measurement system provided by an embodiment of the present invention;
[0065] like Fig.11 FIG. 1 is a schematic diagram of a specific dynamic measurement system provided by an embodiment of the present invention;
[0066] like Fig.12 FIG. 1 is a simplified structural diagram of a dynamic measurement device provided by an embodiment of the present invention;
[0067] like Fig.13 FIG. 2 is a simplified structural diagram of another dynamic measurement device provided by an embodiment of the present invention;
[0068] like Fig.14 Shown is a schematic diagram of the hardware structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0069] Before describing the embodiments of the present application, the related technologies and technical problems are first described.
[0070] In recent years, with the continuous development of the digital economy and information software industry, the security risks faced by information systems have also increased. As the foundation of information systems, operating systems are deployed on computer devices such as terminal devices, servers, and embedded devices. They connect to different hardware platform interfaces downward and provide an operating environment for applications upward. Operating system security is also the cornerstone of the security of the entire information system. A large number of applications are running on the operating system, and some applications inevitably have vulnerabilities. Once these vulnerabilities are exploited by attackers, they may have a serious impact on the system security of the operating system, such as causing privacy data leakage, core secrets theft, business unavailability, etc., causing serious commercial losses. Most software attacks are accompanied by system integrity damage, such as malicious process running, configuration file tampering, backdoor implantation, etc.
[0071] In related technologies, in order to prevent software attacks, operating system integrity protection technology is generally used, that is, from the start of the computer device, some key data are measured and verified to ensure that these key data have not been tampered with and to ensure that the system operation is predictable.
[0072] However, in related technologies, only static measurements can be performed on key data when the computer device is started, but memory data during process execution cannot be protected. If an attacker modifies the code instructions of a process by some means, the process may be hijacked or a backdoor may be implanted, which is highly concealed and has serious consequences.
[0073] In order to solve the above problems, a dynamic measurement technology has been proposed in the relevant technology, that is, to measure and protect the integrity of relatively immutable key data in the memory when the process is running, such as code segment data and read-only data segment data.
[0074] When executing dynamic measurement technology, the administrator triggers the measurement process, obtains key data in the memory, measures it, records the measurement results as measurement logs, and outputs them to the security chip. Finally, the integrity of the measurement logs in the security chip is proved through the remote service module.
[0075] However, there are still many shortcomings in the above methods. First, dynamic measurement technology relies on manual triggering by the administrator, or needs to be triggered according to the administrator's settings. When the administrator does not start the dynamic measurement process for a long time, the operating system will not automatically start the dynamic measurement of key data in the memory. This will cause the problem of time-of-use inspection (TOC-TOU), that is, it is impossible to perform dynamic measurement on key data in the memory in real time. If the attacker has completed the tampering of the key data and restored it between two dynamic measurements, the tampering will not be detected, the dynamic measurement will fail, and the operating system will be damaged.
[0076] Secondly, due to the virtual address mapping mechanism, key data will be mapped when it is accessed. Directly measuring key data in memory will trigger access to all key data addresses, resulting in a large amount of memory consumption.
[0077] At the same time, since the dynamic measurement module that specifically performs the dynamic measurement function is usually deployed in the kernel state, that is, the dynamic measurement module will run in the normal execution environment (Rich Execution Environment, REE), the dynamic measurement module itself is also at risk of being attacked and tampered with, and the integrity of the measurement results cannot be guaranteed, and there is a problem that the trust chain cannot be closed. Even if a security chip is used, it can only passively receive the measurement results sent by the dynamic measurement module and protect them, and it is also impossible to verify whether the dynamic measurement module itself is complete.
[0078] To solve the above problems, the embodiments of the present invention provide a dynamic measurement method and device. Figure 1 As shown in FIG. 1 , a dynamic measurement system is provided in an embodiment of the present invention. Figure 1 ,The dynamic measurement system includes computer equipment and remote proof service equipment. Figure 2 As shown in FIG. 1 , it is an overall flow chart of a dynamic measurement method provided by an embodiment of the present invention. Figure 1 and Figure 2 The overall process of this application is described.
[0079] The operating environment of the computer device is divided into the normal execution environment REE and the trusted execution environment (TEE). The target application to be dynamically measured and the dynamic measurement module that performs the measurement on it are deployed in the REE, and the dynamic measurement monitoring module is deployed in the TEE. The computer device is also equipped with a security chip.
[0080] The target application runs in the REE environment through its binary program files to perform its normal functions. When the target application is running normally, dynamic measurements need to be performed on it to verify its integrity in order to ensure that it has not been attacked or tampered with.
[0081] The dynamic measurement module is used to monitor and measure the target application. Specifically, when the first target data in the target application triggers the measurement condition, the first target data in the target application is measured. Based on the first baseline data of the first target application, it is determined whether the measurement result obtained by measuring the first target data is abnormal. If there is an abnormality, the measurement result is stored as a first measurement log and reported to the security chip.
[0082] The dynamic measurement monitoring module is used to monitor the dynamic measurement module. The dynamic measurement module measures the dynamic measurement module according to a preset time period. Based on the target application and the second baseline data of the dynamic measurement module, it is determined whether there is an abnormality in the measurement result obtained by measuring the dynamic measurement module. If there is an abnormality, the measurement result is stored as a second measurement log and reported to the security chip.
[0083] The security chip is used to receive, store, and protect the first and second measurement logs reported by the dynamic measurement module and the dynamic measurement monitoring module. The types of security chips include but are not limited to TPM chips, TCM chips, and TPCM chips.
[0084] The remote attestation service device is used to verify the integrity of the measurement results of the dynamic measurement module and the dynamic measurement monitoring module.
[0085] Among them, the method of storing baseline files in a hash tree structure and the method of determining whether there are abnormalities in the measurement results based on the baseline data will be described in detail later.
[0086] like Figure 3 As shown, another dynamic measurement system provided by an embodiment of the present invention is shown. Figure 3 ,Computer devices in the dynamic measurement system also contain building modules.
[0087] The construction module is used to generate a benchmark for the target application to compare when performing dynamic measurement, that is, to obtain and store the baseline file of the target application, which is used to generate the subsequent first baseline data and second baseline data to perform dynamic measurement. Specifically, the construction module includes: the binary file of the target application, the baseline generation tool and the specific generated baseline file.
[0088] The baseline generation tool is used to extract key data from the target application's binary file, such as Figure 2 As shown, the key data in the target application binary file are code segment data and data segment data, which are measured to generate measurement results.
[0089] The baseline file is stored in blocks in a hash tree structure. The baseline generation tool performs measurements on key data to obtain measurement results. At the same time, in order to ensure the security of the baseline file, the baseline file needs to be signed. When the measurement is actually performed, the baseline file is signed and deployed in the dynamic measurement module to generate the first baseline data, and the third baseline data is signed and deployed in the remote attestation service device to perform the subsequent integrity attestation process.
[0090] The REE environment of the operating environment also includes an application deployment module, a dynamic measurement function configuration interface, a remote attestation agent module and a TEE driver module. At the same time, a security chip driver module is deployed in both the REE environment and the TEE environment to ensure the execution of dynamic measurement tasks.
[0091] The application deployment module is specifically used to deploy the binary file of the target application to the REE environment so that it can run normally in the REE environment. At the same time, the baseline file stored in the baseline data file is imported into the dynamic measurement module.
[0092] The dynamic measurement function configuration interface is specifically used to provide a configuration interface for the dynamic measurement module to the outside world, such as an interface for importing baseline files, etc., which is generally in an encapsulated form.
[0093] The TEE driver module is specifically used to provide a communication interface between applications in the REE environment and applications in the TEE environment, so as to realize communication with applications in the TEE environment, such as the dynamic measurement monitoring module.
[0094] The remote attestation agent module is specifically used to establish a connection relationship with the remote attestation server, receive the remote attestation request sent by the remote attestation server, and retrieve the measurement log in the security chip according to the remote attestation request and send it to the remote attestation server for integrity attestation.
[0095] The security chip driver module is specifically used to provide a communication interface with the security chip to store the measurement log in the security chip and call out the measurement log from the security chip when performing remote attestation.
[0096] The remote attestation server also includes third baseline data and a remote attestation service module.
[0097] The third baseline data is deployed in the remote certification server when the construction module generates the baseline file, and is used to verify the integrity of the first measurement log and the second measurement log.
[0098] The remote attestation service module is used to send a remote attestation request to the remote attestation agent module, receive the measurement log reported by the remote attestation agent module, and perform integrity verification on the measurement log based on the third baseline data.
[0099] like Figure 4 FIG. 1 is a schematic diagram of a dynamic measurement process provided by an embodiment of the present invention. Figure 4 , the product components of the target application are deployed in the REE environment to perform their normal functions. The dynamic measurement module deployed in the REE environment performs dynamic measurement on the key data, namely the user process state code segment, read-only data segment, kernel module code segment, read-only data segment, and kernel code segment, read-only data segment, and stores the measurement results in the security chip. The dynamic measurement monitoring module deployed in the TEE environment measures the dynamic measurement module and stores the measurement results in the security chip. The remote attestation agent module deployed in the REE environment establishes a connection with the remote attestation service device, sends the measurement results in the security chip to the remote attestation service device, and the remote attestation service device performs integrity verification.
[0100] like Figure 5 The figure is a flow chart of a dynamic measurement method provided by an embodiment of the present invention. The method is applied to the dynamic measurement module, see Figure 5 The specific steps of the method include:
[0101] S501, obtaining first baseline data of a target application.
[0102] Specifically, when the terminal device system is initialized, a baseline file pre-stored for the target application is obtained. The digital signature of the baseline file is verified to determine the integrity of the baseline file. When the baseline file signature verification passes, the baseline file is determined to be complete and is saved as the first baseline data in the REE environment of the memory to perform subsequent integrity verification steps.
[0103] S502: When first target data in a target application triggers a preset measurement condition, measurement is performed on the first target data.
[0104] Specifically, Figure 2 As shown, the binary file of the target application includes process address space data, code segment data, data segment data, BSS segment data, stack segment data, etc., and the code segment data and read-only data segment data used to perform dynamic measurement are determined as key data of the target application.
[0105] Different measurement conditions are configured in advance for the key data in the target application. Part of the key data that triggers the measurement condition is determined as the first target data. When the first target data meets the preset measurement condition, the measurement is performed on the first target data in the key data alone.
[0106] The measurement condition is a preset condition for establishing a mapping or modifying an attribute of the first target data. According to whether the first target data meets the preset measurement condition, it can be determined whether the first target data has been tampered with. When the first target data meets the preset measurement condition, it is determined that the first target data is at risk of being tampered with, and it is necessary to perform measurement on it, and further determine the measurement result in combination with subsequent steps to specifically determine the integrity of the first target data.
[0107] S503: Determine, based on the first baseline data, whether a measurement result obtained by measuring the first target data has an abnormality.
[0108] Specifically, the measurement result obtained by measuring the first target data in S502 is compared with the first baseline data obtained according to S501 to determine whether there is an abnormality in the measurement result of measuring the first target data. When the comparison results are consistent, it is determined that there is no abnormality in the measurement result of the first target data and the first target data has not been tampered with; when the comparison results are inconsistent, it is determined that there is an abnormality in the first target data and the first target data has been tampered with.
[0109] Among them, the first baseline data is stored in a hash tree structure and is used as a comparison benchmark. The hash tree structure of the first baseline data stores data summary values of all key data, that is, hash values. The data summary value of the corresponding code segment or read-only data segment is stored at the corresponding position of the hash tree structure. The measurement result obtained by performing measurement on the first target data is compared with the data summary value stored at the corresponding position in the hash tree structure of the first baseline data. For example, when the first target data is code segment page1, the result of performing measurement on code segment page1 is compared with the hash value stored in the area storing the data summary value of code segment page1 in the first baseline data to determine whether page1 has been tampered with.
[0110] When the measurement result is different from the hash value stored in the corresponding leaf node in the first baseline data, the leaf nodes in the measurement result are further updated step by step to obtain an updated root hash value, and whether the measurement result is abnormal is determined according to the updated root hash value. When the updated root hash value is different from the root hash value stored in the first target data, it is determined that the measurement result is abnormal.
[0111] When updating the root hash value, the measurement result obtained by measuring the first target data is written into the corresponding position of the hash tree leaf node, and the data summary value stored in other leaf nodes is the same as the data summary value stored in the corresponding position in the first baseline data.
[0112] S504: When there is an abnormality in the measurement result, the measurement result is stored as a first measurement log and reported to the security chip.
[0113] Specifically, when there is an abnormality in the measurement result, the root hash value updated according to the measurement result is stored as a first measurement log, and the first measurement log is reported to the security chip, and the security chip PCR register is expanded.
[0114] In the embodiment of the present application, a measurement condition is pre-set to characterize whether the key data will establish a mapping or attribute modification. When the key data of the target application meets the measurement condition, it is determined that it may be tampered with and the measurement is directly performed. Compared with the related art, the start of the dynamic measurement process depends on the manual triggering of the administrator. The method provided in the embodiment of the present application can actively trigger and start the dynamic measurement process, effectively solving the TOC-TOU problem existing in the related art, and improving the real-time and effectiveness of the dynamic measurement protection mechanism.
[0115] At the same time, in the embodiment of the present application, when the key data meets the measurement conditions, only the first target data in the key data that specifically meets the measurement conditions will be measured. Compared with the related art, since the administrator triggers the dynamic measurement process, it is not clear which data may be tampered with, so all key data need to be measured, resulting in a large amount of memory growth. The method provided in the embodiment of the present application determines the part of the key data that may actually be tampered with through the preset measurement conditions, that is, the first target data performs measurement on it, and compares it with the first baseline data stored in blocks through the hash tree structure to determine the measurement result, while reducing the memory consumption in the measurement process, improving the measurement efficiency. The measurement result can also be effectively fed back according to the root node hash value at the same time, which can be directly used for subsequent integrity proof.
[0116] Optionally, in some embodiments, when executing S501 to obtain the first baseline data of the target application, it is necessary to first obtain the first baseline data of the target application through Figure 3The building blocks in the computer device shown enable the generation of a baseline file.
[0117] Specifically, when the target application is built, Figure 3 The baseline generation tool shown in the figure parses the data in the target application binary file. The code segment data and read-only data segment data in the target application binary file are parsed as key data and used as the second target data. The second target data is measured and the measurement results are stored in a hash tree structure, that is, the data summary values obtained by measuring each data segment in the second target data are stored in blocks in each leaf node in the hash tree structure. The hash tree structure and the data summary value stored therein are signed, and finally the following is generated: Figure 3 The baseline file shown in FIG. 1 is a baseline file shown in FIG. 1 . When measuring the second target data to obtain the measurement result, all memory pages in the code segment or the read-only data segment need to be measured.
[0118] like Figure 6 As shown in FIG. 1 , a hash tree structure is provided in an embodiment of the present invention. Figure 6 , the data summary values obtained by measuring the second target data are stored in each leaf node of the hash tree. For example, the data summary value obtained by measuring Page0 in the code segment is stored in the hash0-0 area, the data summary value obtained by measuring the code segment page1 is stored in the hash0-1 area, the data summary value obtained by measuring the code segment page2 is stored in the hash0-2 area, and the data summary value obtained by measuring the code segment page3 is stored in the hash0-3 area. Figure 6 The hash tree structure shown is in the form of a binary tree, and the actual hash tree hierarchy can be changed to be in the form of a multi-branch tree.
[0119] After the data summary value is stored in the leaf node, the other nodes in the hash tree structure are updated step by step according to the structural relationship of the hash tree and the data summary value stored in each leaf node until the root node hash (root hash) of the hash tree is updated. For example, the data summary value in the hash1-1 area is determined according to the data summary value stored in the hash0-0 and hash0-1 areas; for another example, the data summary value in the root hash (root hash) is determined according to the data summary value stored in the hash1-1 and hash1-2 areas. When the update of the data summary value in the root hash is completed, it is determined that the baseline file has been generated and the baseline file is signed.
[0120] When the dynamic measurement module specifically performs dynamic measurement, it will simultaneously obtain the same hash tree structure as the baseline file, and the data summary value stored in the hash tree structure is also the same as the corresponding data summary value in the baseline file. When the dynamic measurement module determines through S503 whether there is an abnormality in the measurement result obtained by performing measurement on the first target data, it is necessary to update the hash value of the corresponding memory page in the hash data structure obtained at the same time. For example, if the first target data is page2, and the measurement result obtained by performing measurement on page2 is different from the hash value stored in the hash0-2 area in the first baseline data, the measurement result is overwritten in the hash0-2 area of the hash tree structure, and updated to the superior together with the original hash values in hash0-0, hash0-1, and hash0-3 until it is updated to the root hash value, and compared with the root hash value pre-stored in the first baseline data to determine whether there is an abnormality in the measurement result. If there is an abnormality, the updated calculated root hash value is written into the security chip as the first measurement log.
[0121] Optionally, in some embodiments, when executing S502, when the first target data in the target application triggers preset measurement conditions, before performing measurement on the first target data, it is necessary to preset some measurement conditions, that is, to determine some specific scenarios about the first target data. When the first target data meets these conditions, it is determined that the first target data may have been tampered with, and dynamic measurement is performed on the first target data.
[0122] The measurement conditions set for the first target data include: when a page fault occurs in the first target data in the target application, after the page mapping is established, dynamic measurement is performed on the mapped first target data; when an attribute change occurs in the first target data in the target application, dynamic measurement is performed on the first target data with the changed attribute; when it is determined that the first target data in the target application has a writable attribute, measurement is performed on the first target data with the writable attribute.
[0123] Among them, since the data with writable attributes may be tampered at any time, that is, after the first target data with writable attributes is measured, there is still a possibility of tampering, so after the first target data with writable attributes is measured, it needs to be added to the dirty page pool. The dirty page pool is used to store the target data with writable attributes, and all the determined target data with writable attributes will be added to the dirty page pool.
[0124] A first time period is set to perform measurement on all target data stored in the dirty page pool to determine that each target data with a writable attribute added to the dirty page pool has not been tampered with. When the writable attribute of the target data in the dirty page pool is removed, after once again performing measurement on the target data with the writable attribute removed, the target data is removed from the dirty page pool, and dynamic measurement is no longer performed on it according to the first time period.
[0125] Optionally, in some embodiments, during the execution of S501-S504, in order to ensure that the dynamic measurement module itself will not be tampered with, the dynamic measurement module is measured by a dynamic measurement monitoring module deployed in a trusted execution environment TEE, and the measurement result is stored as a second measurement log and reported to the security chip. The remote attestation service module obtains the first measurement log and the second measurement log from the security chip to verify the measurement result.
[0126] Specifically, when the dynamic measurement module is loaded and initialized, it will send a monitoring request to the dynamic measurement monitoring module. The dynamic measurement monitoring module will obtain the second baseline data according to the monitoring request and perform measurement on the dynamic measurement module.
[0127] like Figure 7 The figure is a flow chart of a dynamic measurement method provided by an embodiment of the present invention. The method is applied to the dynamic measurement monitoring module, see Figure 7 The specific steps of the method include:
[0128] S701, in response to a monitoring request sent by a dynamic measurement module, obtaining second baseline data of the dynamic measurement module.
[0129] Specifically, after receiving the monitoring request sent by the dynamic measurement module, the fourth target data of the dynamic measurement module is measured to obtain the second baseline data. The second baseline data is used as a benchmark for the dynamic measurement module to perform subsequent comparison steps for the dynamic measurement module. The obtained second baseline data is saved as a measurement log and synchronously recorded in the security register of the security chip.
[0130] Among them, the fourth target data of the dynamic measurement module includes the key data of the dynamic measurement module itself, namely, the code segment and read-only data segment of the dynamic measurement module itself, and the first baseline data obtained by the dynamic measurement module, namely, the baseline file of the target application after the signature verification.
[0131] S702, according to a preset second time period, periodically perform measurement on the third target data in the dynamic measurement module.
[0132] Specifically, the dynamic measurement configuration module is configured with a second time period in advance, and the dynamic measurement module is periodically measured. Whenever the second time period passes, the third target data in the dynamic measurement module is measured. The third target data of the dynamic measurement module includes a code segment and a read-only data segment of the dynamic measurement module, and a measurement result obtained by the dynamic measurement module measuring the first target data.
[0133] S703: Determine, based on the second baseline data, whether there is any abnormality in the measurement result obtained by measuring the third target data.
[0134] S704: When there is an abnormality in the measurement result, the measurement result is stored as a second measurement log and reported to the security chip.
[0135] Specifically, the second measurement log is stored in the security chip, and the PCR register of the security chip is expanded.
[0136] The embodiment of the present invention measures the dynamic measurement module in the execution environment REE by introducing a dynamic measurement monitoring module running in the trusted execution environment TEE. Compared with the prior art, which only measures the dynamic measurement module deployed in the normal execution environment, it is impossible to verify whether the dynamic measurement module itself has been tampered with. The method provided in the embodiment of the present application can ensure the closed loop of the trust chain and avoid the problem of failure of the dynamic measurement function due to tampering of the dynamic measurement module itself.
[0137] Optionally, in some embodiments, the computer device performs measurement on the first target data of the target application through its own dynamic measurement module. After determining the measurement result, regardless of whether there is an abnormality in the measurement result, the integrity of the measurement result cannot be guaranteed, and it needs to be remotely certified by a remote certification service device to ensure the integrity of the measurement result.
[0138] like Figure 8 FIG. 1 is a schematic diagram of an overall dynamic measurement process provided by an embodiment of the present invention. Figure 8 After the dynamic measurement module is initialized and the baseline data is imported, a monitoring initialization request is sent to the dynamic measurement monitoring module, triggering the dynamic measurement monitoring module to perform measurement on it. While the dynamic measurement module measures the target application, the dynamic measurement monitoring module measures the dynamic measurement module regularly through a timer to ensure that the dynamic measurement module itself has not been tampered with. The measurement log storing the measurement results is sent to the security chip, and the security register is expanded.
[0139] like Fig. 9 The figure is a flow chart of a dynamic measurement method provided by an embodiment of the present invention. The method is applied to a remote certification service device, see Fig. 9 The specific steps of the method include:
[0140] S901, sending a remote attestation request to a remote attestation agent module deployed in the runtime environment REE.
[0141] Specifically, in Figure 3 As shown in the structure of the provided dynamic measurement system, the computer device establishes a connection relationship with the remote attestation service device through the remote attestation agent module deployed in the REE environment.
[0142] The remote attestation service device sends the remote attestation request to the remote attestation agent module of the computer device through the remote attestation service module to start the remote attestation process.
[0143] S902, receiving a first measurement log, a second measurement log, and a PCR value reported by a remote attestation agent module according to a remote attestation request.
[0144] Specifically, after receiving the remote attestation request, the remote attestation agent module Figure 3 The security chip driver module shown obtains the first measurement log reported by the dynamic measurement module, the second measurement log reported by the dynamic measurement monitoring module, and the PCR value of the platform register PCR stored in the security chip from the security chip, and sends them to the remote attestation service module of the remote attestation service device. The remote attestation service module in the remote attestation service device performs integrity verification based on the received first measurement log, second measurement log and PCR value. In order to ensure the credibility of the PCR value, the PCR value is signed by the private key inside the security chip.
[0145] S903: Perform integrity certification on the first measurement log and the second measurement log according to the PCR value and the pre-stored third baseline data.
[0146] Specifically, the PCR value is verified. If the PCR value verification fails, it is determined that the remote attestation has failed; if the PCR value verification passes, it is determined that the PCR value is credible, and the first measurement log and the second measurement log are verified to be credible based on the PCR value.
[0147] Perform PCR extension simulation calculation on the first measurement log and the second measurement log, and compare the calculation result with the verified PCR value. If they are inconsistent, it is determined that the first measurement log and the second measurement log have been tampered with and the remote proof fails. If they are consistent, it is determined that the first measurement log and the second measurement log are credible, that is, the first measurement log and the second measurement log have not been tampered with, and continue to prove the integrity of the first measurement log and the second measurement log according to the pre-stored third baseline data.
[0148] Among them, when the construction module in the computer device obtains the baseline file of the target application, in addition to deploying the baseline file to the dynamic measurement module as the first baseline data of the dynamic measurement module, it will also send the baseline file to the remote attestation service module and use the root hash value in the baseline file as the third baseline data in the remote attestation service module for performing remote attestation.
[0149] The first measurement log and the second measurement log are compared with the benchmark and hash value in the third baseline data. If they are inconsistent, it is determined that there is an abnormality in the first measurement log and the second measurement log, and the integrity proof fails; if they are consistent, it is determined that there is no abnormality in the first measurement log and the second measurement log, and the integrity proof succeeds.
[0150] like Fig.10 As shown, it is a structural diagram of a specific dynamic measurement system provided by the present invention. In the embodiment of the present invention, the operating environment of the computer device is a general server based on the Kunpeng host, the openEuler operating system is installed on the REE side, and the iTrustee operating system is installed on the TEE side. The hardware layer of the computer device includes a security chip, which is a TPM chip.
[0151] When the target application package is built, key data is extracted from the target application binary file, measured and stored in blocks according to the hash tree structure. The generated hash tree is signed to obtain a baseline file. The baseline file and the binary file of the target application are packaged into an application package.
[0152] Deploy the application binary files in the application software package on the openEuler operating system on the REE side to achieve the normal operation of the target application. The deployment of the baseline file also needs to be executed while executing the target application deployment. When deploying the baseline file, the baseline file needs to be imported into the dynamic measurement module in the openEuler operating system as the first baseline data of the dynamic measurement module. At the same time, the baseline file needs to be imported into the remote attestation service device, and the root hash value in the baseline data is used as the third baseline data of the remote attestation service device.
[0153] When the target application is running in the openEuler operating system, and its internal key data triggers the preset measurement conditions, the relevant key data is determined as the first target data and measured, and the hash tree is updated when the measurement result is inconsistent with the first baseline data. The updated hash tree root node is recorded in the first measurement log, reported to the security chip through the TPM chip driver deployed in the openEuler operating system, and the PCR register of the security chip is expanded.
[0154] The dynamic measurement module establishes a connection with the dynamic measurement monitoring module deployed in the iTrustee operating system through the iTrustee driver, and sends a monitoring request to the dynamic measurement monitoring module during initialization. The dynamic measurement monitoring module responds to the monitoring request, obtains the second baseline data of the dynamic measurement module, and performs measurement on it according to the preset time interval. When the measurement result is inconsistent with the second baseline data, the second measurement log is recorded, reported to the security chip, and the PCR register of the security chip is expanded.
[0155] The administrator triggers integrity attestation through the remote attestation service module of the remote attestation server, and issues a remote attestation request to the remote attestation agent module deployed in the openEuler operating system through the remote attestation module. After receiving the remote attestation request, the remote attestation agent module obtains the first measurement log, the second measurement log, and the PCR value of the platform status register PCR from the security chip through the TPM chip driver deployed in the openEuler operating system, and returns them to the remote attestation service module. The remote attestation service module performs integrity verification based on this.
[0156] Optionally, in some embodiments, the dynamic measurement system does not include a remote attestation service device, but rather uses a local verification mode of a computer device to perform local verification. An exception handling module is also deployed in the trusted execution environment of the computer device. The exception handling module is used to record an audit log when there is an exception in the measurement result, or directly terminate the operation of the target application or dynamic measurement module, or execute other configurable protection measures.
[0157] Specifically, when the dynamic measurement module compares the measurement result obtained by measuring the first target data in the target application with the first baseline data and an exception occurs, the exception result is fed back to the exception handling module, and the exception handling module directly terminates the operation of the target application.
[0158] Optionally, when the dynamic measurement monitoring module compares the measurement result obtained by performing measurement on the third target data of the dynamic measurement module with the second baseline data and an exception occurs, the exception result is fed back to the exception handling module, and the exception handling module records the audit log, or directly terminates the operation of the dynamic measurement module, or executes other configurable protection measures.
[0159] like Fig.11 As shown, it is a structural diagram of a specific dynamic measurement system provided by the present invention. In an embodiment of the present invention, an exception handling module is also deployed in the trusted execution environment iTrustee operating system of the computer device, and an audit module and an audit log are also deployed in the openEuler operating system.
[0160] The computer device performs local verification. When there is an abnormality in the verification result, the operation of the target application is terminated through the exception handling module deployed in the iTrustee operating system, and the process is directly recorded in the audit log through the audit module deployed in the openEuler operating system.
[0161] Fig.12 The figure shows a simplified structural diagram of a dynamic measurement device provided according to an embodiment of the present application, and the device is deployed on a computer device provided in the present application. Fig.12 As shown, the device comprises:
[0162] The first acquisition module 1201 acquires first baseline data of a target application.
[0163] The first measurement module 1202 performs measurement on the first target data when the first target data in the target application triggers a preset measurement condition.
[0164] The first determination module 1203 determines, based on the first baseline data, whether there is an abnormality in the measurement result obtained by measuring the first target data.
[0165] The first reporting module 1204 stores the measurement result as a first measurement log and reports it to the security chip when there is an abnormality in the measurement result.
[0166] Fig.13 FIG. 2 is a simplified structural diagram of another dynamic measurement device provided according to an embodiment of the present application. Fig.13 As shown, the device also includes:
[0167] The second acquisition module 1301 acquires second baseline data of the dynamic measurement module in response to a monitoring request sent by the dynamic measurement module.
[0168] The second measurement module 1302 periodically performs measurement on the third target data in the dynamic measurement module according to a preset second time period.
[0169] The second determination module 1303 determines whether there is an abnormality in the measurement result obtained by measuring the third target data according to the second baseline data.
[0170] The second reporting module 1304 stores the measurement result as a second measurement log and reports it to the security chip when there is an abnormality in the measurement result.
[0171] like Fig.14 FIG. 1 is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present invention. The electronic device can be implemented as a computer device or a remote service device provided in an embodiment of the present application. Fig.14As shown, the electronic device 1400 may include a processor 1401, an internal memory 1402, an antenna 1, an antenna 2, a mobile communication module 1403, a wireless communication module 1404, and the like.
[0172] It is to be understood that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the electronic device 1400. In other embodiments of the present application, the electronic device 1400 may include more or fewer components than shown in the figure, or combine certain components, or split certain components, or arrange the components differently. For example, in a computer device, there may be no antenna, mobile communication module, and wireless communication module. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0173] The processor 1401 of the electronic device 1400 may be a device on a chip (SOC), which may include a central processing unit (CPU) and may further include other types of processors. For example, the processor 1401 may include an application processor (AP) and / or a neural-network processing unit (NPU).
[0174] The processor 1401 may include one or more processing units. Different processing units may be independent components or integrated into one or more processors. In some embodiments, the electronic device 1400 may also include one or more processors 1401. The controller may generate an operation control signal according to the instruction operation code and the timing signal to complete the control of fetching and executing instructions.
[0175] NPU is a neural network (NN) computing processor. By drawing on the structure of biological neural networks, such as the transmission mode between neurons in the human brain, it can quickly process input information and continuously self-learn. NPU can realize applications such as intelligent cognition of electronic devices, such as image recognition, face recognition, voice recognition, text understanding, etc.
[0176] The internal memory 1402 of the electronic device 1400 can be used to store one or more computer programs, which include instructions. The processor 1401 can run the above instructions stored in the internal memory 1402, so that the electronic device 1400 performs the methods provided in some embodiments of the present application, as well as various applications and data processing. The internal memory 1402 may include a code storage area and a data storage area. Among them, the code storage area can store an operating system. The data storage area can store data created during the use of the electronic device 1400, etc. In addition, the internal memory 1402 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more disk storage components, flash memory components, universal flash storage (UFS), etc.
[0177] The internal memory 1402 can be a read-only memory (ROM), other types of static storage devices that can store static information and instructions, a random access memory (RAM) or other types of dynamic storage devices that can store information and instructions, or an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical disc, laser disc, optical disc, digital versatile disc, Blu-ray disc, etc.), a magnetic disk storage medium or other magnetic storage device, or it can also be any computer-readable medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer.
[0178] The processor 1401 and the internal memory 1402 can be combined into a processing device, or more commonly, are independent components. The processor 1401 is used to execute the program code stored in the internal memory 1402 to implement the method described in the embodiment of the present application. In specific implementation, the internal memory 1402 can also be integrated into the processor, or independent of the processor.
[0179] The wireless communication function of the electronic device 1400 can be implemented through antenna 1, antenna 2, mobile communication module 1403, wireless communication module 1404, modem processor and baseband processor.
[0180] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in the electronic device 1400 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of the antennas. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.
[0181] The mobile communication module 1403 can provide solutions for wireless communications including 2G / 3G / 4G / 5G, etc., applied to the electronic device 1400. The mobile communication module 1403 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 1403 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 1403 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some functional modules of the mobile communication module 1403 can be set in the processor 1401.
[0182] The modem processor may include a modulator and a demodulator. The modulator is used to modulate the low-frequency baseband signal to be sent into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After the low-frequency baseband signal is processed by the baseband processor, it is passed to the application processor. In some embodiments, the modem processor may be an independent device. In other embodiments, the modem processor may be independent of the processor 1401 and be set in the same device as the mobile communication module 1403 or other functional modules.
[0183] The wireless communication module 1404 can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc., which are applied to the electronic device 1400. The wireless communication module 1404 can be one or more devices integrating at least one communication processing module. The wireless communication module 1404 receives electromagnetic waves via antenna 2, modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 1401. The wireless communication module 1404 can also receive the signal to be sent from the processor 1401, modulate the frequency, amplify it, and convert it into electromagnetic waves for radiation through antenna 2. In the embodiment of the present application, the communication connection between the anchor device and the sub-device can be a Wi-Fi network provided by the wireless communication module 1404.
[0184] In some embodiments, antenna 1 of electronic device 1400 is coupled to mobile communication module 1403, and antenna 2 is coupled to wireless communication module 1404, so that electronic device 1400 can communicate with the network and other devices through wireless communication technology.
[0185] Furthermore, the devices, apparatuses, and modules described in the embodiments of the present application may be implemented by computer chips or entities, or by products having certain functions.
[0186] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, devices, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media containing computer-usable program code.
[0187] In the several embodiments provided in the present application, if any function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application.
[0188] Specifically, in one embodiment of the present application, a computer-readable storage medium is further provided, in which a computer program is stored. When the computer program is run on a computer, the computer executes the method provided in the embodiment of the present application.
[0189] An embodiment of the present application further provides a computer program product, which includes a computer program. When the computer program is run on a computer, the computer executes the method provided by the embodiment of the present application.
[0190] The embodiments described in this application are described with reference to the flowcharts and / or block diagrams of the methods, devices (apparatus), and computer program products according to the embodiments of the application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0191] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0192] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0193] It should also be noted that in the embodiments of the present application, "at least one" refers to one or more, and "more than one" refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent the existence of A alone, the existence of A and B at the same time, and the existence of B alone. Among them, A and B can be singular or plural. The character " / " generally indicates that the previous and subsequent associated objects are in an "or" relationship. "At least one of the following" and similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one of a, b and c can be represented by: a, b, c, a and b, a and c, b and c, or a and b and c, where a, b, c can be single or multiple.
[0194] In the embodiments of the present application, the terms "include", "comprises" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of further restrictions, an element defined by the sentence "includes a ..." does not exclude the presence of other identical elements in the process, method, commodity or device including the element.
[0195] The present application may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.
[0196] Each embodiment in this application is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0197] Those skilled in the art will appreciate that the various units and algorithm steps described in the embodiments of the present application can be implemented by a combination of electronic hardware, computer software, and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0198] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described devices, apparatuses and units can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0199] The above is only a specific implementation of the present application. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. The protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A dynamic measurement method, characterized in that: The method is applied to a processor, the processor includes a dynamic measurement module, the dynamic measurement module is deployed in an operating environment REE, the method includes a measurement process executed by the dynamic measurement module, and the measurement process includes: Obtaining first baseline data for the target application; When the first target data in the target application triggers a preset measurement condition, performing measurement on the first target data; Determining, based on the first baseline data, whether a measurement result obtained by measuring the first target data is abnormal; When there is an abnormality in the measurement result, the measurement result is stored as a first measurement log and reported to the security chip.
2. The method according to claim 1, characterized in that The step of obtaining first baseline data of the target application program includes: When the system is initialized, a baseline file is read. The baseline file is obtained by measuring the second target data in the target application by the construction module when the target application is constructed, and is stored based on a hash tree structure. The construction module signs the baseline file. Verifying the signature of the baseline document; When the baseline file passes the signature verification, the baseline file is determined as the first baseline data.
3. The method according to claim 1, characterized in that: When the first target data in the target application triggers a preset measurement condition, performing measurement on the first target data includes: When a page fault occurs in the first target data in the target application program, performing measurement on the first target data for which mapping is established; or When a property change occurs to the first target data in the target application program, performing measurement on the first target data whose property has changed; or, When it is determined that the first target data in the target application has a writable attribute, measurement is performed on the first target data having the writable attribute.
4. The method according to claim 3, characterized in that After performing measurement on the first target data having a writable attribute, the measurement process further includes: Adding the first target data having a writable attribute to the dirty page pool; Regularly performing measurement on all data in the dirty page pool according to a preset first time period; When the writable attribute of the first target data is removed, measurement is performed on the first target data with the writable attribute removed, and the first target data is deleted from the dirty page pool.
5. The method according to claim 1, characterized in that Determining, according to the first baseline data, whether a measurement result obtained by measuring the first target data is abnormal includes: Determine whether the measurement result of the first target data is the same as the hash value stored in the corresponding leaf node in the hash tree structure of the first baseline data; When the measurement result is different from the hash value stored in the corresponding leaf node in the first baseline data, updating the root hash value according to the measurement result; When the updated root hash value is different from the root hash value in the first baseline data, it is determined that the measurement result is abnormal.
6. The method according to claim 1, characterized in that When the measurement result is abnormal, storing the measurement result as a first measurement log and reporting it to the security chip includes: The root hash value is stored as the first measurement log and reported to the security chip.
7. The method according to claims 1-6, characterized in that: The first target data and the second target data include: a code segment, and / or a read-only data segment.
8. The method according to claim 1, characterized in that The measurement process also includes: Sending a monitoring request to the dynamic measurement monitoring module; The monitoring request is used to instruct the dynamic measurement monitoring module to measure the dynamic measurement module.
9. The dynamic measurement method according to claim 1, characterized in that: The processor further includes a dynamic metric monitoring module, which is deployed in a trusted execution environment TEE. The method further includes a monitoring process executed by the dynamic metric monitoring module, which includes: In response to a monitoring request sent by a dynamic measurement module, obtaining second baseline data of the dynamic measurement module; According to a preset second time period, regularly performing measurement on the third target data in the dynamic measurement module; Determining, based on the second baseline data, whether a measurement result obtained by measuring the third target data is abnormal; When there is an abnormality in the measurement result, the measurement result is stored as a second measurement log and reported to the security chip.
10. The method according to claim 9, characterized in that The obtaining of the second baseline data of the dynamic measurement module includes: Measuring the fourth target data of the dynamic measurement module to obtain the second baseline data; The fourth target data of the dynamic measurement module includes a code segment of the dynamic measurement module and / or a read-only data segment, and the first baseline data acquired by the dynamic measurement module.
11. The method according to claim 9, characterized in that The third target data includes: a code segment of the dynamic measurement module, and / or a read-only data segment and a measurement result obtained by the dynamic measurement module performing measurement on the first target data.
12. A dynamic measurement device, characterized in that: include: A first acquisition module, acquiring first baseline data of a target application; A first measurement module, which performs measurement on the first target data in the target application when the first target data in the target application triggers a preset measurement condition; A first determination module determines, based on the first baseline data, whether a measurement result obtained by measuring the first target data is abnormal; The first reporting module stores the measurement result as a first measurement log and reports it to the security chip when the measurement result is abnormal.
13. The device according to claim 12, characterized in that The device also includes: A second acquisition module, in response to a monitoring request sent by the dynamic measurement module, acquires second baseline data of the dynamic measurement module; A second measurement module, which regularly performs measurement on the third target data in the dynamic measurement module according to a preset second time period; A second determination module determines, based on the second baseline data, whether a measurement result obtained by measuring the third target data is abnormal; The second reporting module stores the measurement result as a second measurement log and reports it to the security chip when there is an abnormality in the measurement result.
14. A computer device, characterized in that: The computer device comprises a memory for storing computer program instructions and a processor for executing the computer program instructions, wherein when the computer program instructions are executed by the processor, the computer device is triggered to execute the method steps according to any one of claims 1 to 11.
15. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, which, when executed on a computer, enables the computer to execute the method according to any one of claims 1 to 11.