Trusted switch file execution method and device, electronic equipment and storage medium

By using TPCM to verify the memory data of the executed files in a trusted switch, the complexity of file verification and security risks in the prior art are solved, and an efficient and secure file execution process is achieved.

CN119089429APending Publication Date: 2024-12-06NINGBO HOLLYSHI INFORMATION SECURITY RES INST CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411090559.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-09
Publication Date
2024-12-06

AI Technical Summary

Technical Problem

In the prior art, it is necessary to modify the properties of the file to be executed and add the signature value, resulting in complex file verification methods, affecting the execution efficiency of the file, and failing to effectively check the tampering of files loaded into memory, resulting in security risks.

Method used

After the file to be executed is loaded into the memory of the trusted switch, the verification data is obtained from the memory, and the target verification value is verified through the trusted verification value stored in the Trusted Platform Control Module (TPCM). Only after the verification is passed When executing files, ensure the security and verification accuracy of files.

Benefits of technology

Improve the accuracy and efficiency of file verification, avoid the complex verification process caused by modifying file attributes and increasing signature values, ensure the security of file execution, and prevent security risks caused by tampering with loaded files.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119089429A_ABST
    Figure CN119089429A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of file processing, and provides a trusted switch file execution method and device, electronic equipment and a storage medium. The method comprises the following steps: after a to-be-executed file is loaded to a memory of a trusted switch, obtaining verification data corresponding to the to-be-executed file from the memory, and determining a target verification value corresponding to the verification data; verifying the target verification value through a credible verification value stored in the TPCM; the to-be-executed file is executed when the target verification value passes the verification, the to-be-executed file is verified by obtaining the data, loaded into the memory, of the to-be-executed file, and the to-be-executed file is executed only when the target verification value passes the verification and it is determined that the to-be-executed file is not abnormal. The security of executing the to-be-executed file is ensured, and the to-be-executed file is directly verified based on the verification data loaded into the memory, so that the verification accuracy and verification efficiency of verifying the to-be-verified file are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of file processing technology, and in particular to a trusted switch file execution method, device, electronic device and storage medium. Background Art

[0002] In recent years, industrial control systems have shown a trend of deep integration with the Internet of Things and the Internet, which has greatly improved the intelligence and informationization of industrial control systems, but also brought a series of new security challenges. Various new attack technologies and means against industrial control systems have emerged in an endless stream, which has had a serious impact on national security, economic development, and social stability, and has attracted the attention of governments around the world. As the nerve unit connecting industrial systems, industrial switches are very vulnerable to attacks. The security defense capabilities of industrial switches themselves are often built through firewalls, audits, intrusion detection, etc., and do not have inherent security mechanisms. Once the peripheral defense is breached, it is extremely easy to be implanted with viruses or tampered with configurations, leading to security incidents.

[0003] In the related art, the following two methods are used to verify the executable and linkable format (ELF) file. The first method is to build a shelled ELF shared library file according to the target function list of the ELF file, read the target ELF shared library file for encryption, obtain the ciphertext ELF data, and fill the ciphertext ELF data into the data segment of the shelled ELF file. The second method is to generate a cascade key by using its own information after transformation after the ELF program is compiled and generated; the key header and information of the ELF program are encrypted by using the cascade key to form an encrypted ELF program; when the encrypted ELF program is executed, it is loaded, decrypted and executed by the kernel. Both of the above methods need to modify the ELF file attributes, resulting in a complex file verification method, affecting the verification efficiency of the file, and affecting the execution efficiency of the file. In addition, each time the above two methods execute the above files, the signature value of the entire file needs to be calculated, resulting in slow loading of the file, further affecting the execution efficiency of the file. Summary of the invention

[0004] In view of this, the embodiments of the present application provide a trusted switch file execution method, device, electronic device and storage medium to solve the problem in the prior art that it is necessary to modify the attributes of the to-be-executed file and increase the signature value, and the subsequent verification process of the to-be-executed file is complex and the verification accuracy is low, which affects the execution efficiency of the to-be-executed file.

[0005] According to a first aspect of an embodiment of the present application, a trusted switch file execution method is provided, the method comprising: after a file to be executed is loaded into a memory of a trusted switch, obtaining verification data corresponding to the file to be executed from the memory, and determining a target check value corresponding to the verification data, wherein the verification data is data loaded into the memory by the file to be executed; verifying the target check value by using a trusted check value stored in a trusted platform communications module (TPCM); and executing the file to be executed when the target check value passes the verification.

[0006] According to a second aspect of an embodiment of the present application, a trusted switch file execution device is provided, the device comprising: an acquisition module, used to obtain verification data corresponding to the file to be executed from the memory after the file to be executed is loaded into the memory of the trusted switch, and determine a target check value corresponding to the verification data, wherein the verification data is data loaded into the memory by the file to be executed; a verification module, used to verify the target check value through a trusted check value stored in a trusted platform communications module (TPCM); and an execution module, used to execute the file to be executed when the target check value passes the verification.

[0007] According to a third aspect of an embodiment of the present application, an electronic device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above method when executing the computer program.

[0008] According to a fourth aspect of an embodiment of the present application, a computer-readable storage medium is provided, which stores a computer program, and when the computer program is executed by a processor, the steps of the above method are implemented.

[0009] Compared with the prior art, the embodiments of the present application have the following beneficial effects: in the embodiments of the present application, after the file to be executed is loaded into the memory of the trusted switch, the verification data corresponding to the file to be executed is obtained from the memory, and the target verification value corresponding to the verification data is determined; the target verification value is verified by the trusted verification value stored in the TPCM; when the target verification value is verified, the file to be executed is executed. The above method verifies the file to be executed by obtaining the data loaded into the memory by the file to be executed, and only when the target verification value is verified and it is determined that there is no abnormality in the file to be executed, the file to be executed is executed, thereby ensuring the security when executing the file to be executed, and directly verifying the file to be executed based on the verification data loaded into the memory, thereby improving the verification accuracy and efficiency of the file to be verified, thereby avoiding the need to modify the attributes of the file to be executed and increase the signature value in the related art, and the subsequent verification process of the file to be executed is complicated, which affects the execution efficiency of the file to be executed. In addition, it also avoids the problem in the related art that the key tampering of the file to be executed that has been loaded into the memory cannot be detected, resulting in the execution of abnormal files to be executed, which leads to the easy occurrence of security risks. BRIEF DESCRIPTION OF THE DRAWINGS

[0010] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0011] Figure 1 It is a flowchart of a trusted switch file execution method provided by an embodiment of the present application;

[0012] Figure 2 It is a basic schematic diagram of a memory area provided in an embodiment of the present application;

[0013] Figure 3 It is a flowchart of another trusted switch file execution method provided by an embodiment of the present application;

[0014] Figure 4 It is a flowchart of another trusted switch file execution method provided in an embodiment of the present application;

[0015] Figure 5 It is a flowchart of another trusted switch file execution method provided in an embodiment of the present application;

[0016] Figure 6 It is a flowchart of another trusted switch file execution method provided in an embodiment of the present application;

[0017] Figure 7 It is a flowchart of another optional trusted switch file execution method provided in an embodiment of the present application;

[0018] Figure 8 It is a flowchart of another optional trusted switch file execution method provided in an embodiment of the present application;

[0019] Fig. 9 It is a flowchart of another optional trusted switch file execution method provided in an embodiment of the present application;

[0020] Fig.10 It is a structural diagram of a trusted switch file execution device provided in an embodiment of the present application;

[0021] Fig.11 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0022] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.

[0023] A trusted switch file execution method and device according to an embodiment of the present application will be described in detail below with reference to the accompanying drawings.

[0024] Figure 1 A trusted switch file execution method provided by an embodiment of the present application is as follows: Figure 1 As shown, the method includes:

[0025] S101. After the file to be executed is loaded into the memory of the trusted switch, verification data corresponding to the file to be executed is obtained from the memory, and a target check value corresponding to the verification data is determined, where the verification data is the data loaded into the memory by the file to be executed;

[0026] S102, verifying the target verification value by using the trusted verification value stored in the Trusted Platform Communications Module (TPCM);

[0027] S103: When the target check value passes the check, the to-be-executed file is executed.

[0028] It can be understood that the above-mentioned trusted switch file execution method provided in this example is applied to a trusted switch.

[0029] Among them, the above-mentioned trusted switch is equipped with memory, processor and local storage (such as hard disk), and the above-mentioned trusted switch can be connected to TPCM. TPCM is a hardware core module integrated in the trusted computing platform for establishing and protecting the trust source point, providing integrity measurement, secure storage, trusted reporting and cryptographic services for trusted computing, and is the core control module of trusted applications; in some examples, the above-mentioned TPCM is set inside the trusted switch.

[0030] In some examples, when the trusted switch needs to execute a to-be-executed file, it first loads the to-be-executed file into the memory of the trusted switch. It can be understood that the trusted switch can obtain the above-mentioned to-be-executed file from at least one of local storage (hard disk), network storage (cloud storage, network file system, etc.), other computers (downloading files from remote computers via file transfer protocol), external devices (USB storage devices, optical drives, etc.), temporary storage (RAM Disk), sensors or other external input devices (sensors such as cameras and microphones), and caches (cache servers, memory caches); in some examples, the trusted switch can also obtain the above-mentioned to-be-executed file based on user input.

[0031] In some examples, after loading the file to be executed into the memory and before executing the file to be executed, the present example obtains verification data corresponding to the file to be executed from the memory, and determines a target check value corresponding to the verification data; wherein the verification data is data loaded into the memory area by the file to be executed, and illustratively, the verification data includes but is not limited to at least one of a code segment and a data segment; it can be understood that after the trusted switch loads the file to be executed into the memory, it will load each part of the file to be executed into the allocated memory area in the memory respectively, it can be understood that the file to be executed includes a code segment (.text segment), a data segment (.data segment), a .bss segment (BSS Segment), and a .rodata segment (Read-Only Data Segment), and after the file to be executed is loaded into the memory, the code segment, data segment and .bss segment will be loaded into the allocated memory area respectively, such as Figure 2 As shown, Figure 2 The figure shows a basic schematic diagram of the memory area, wherein the memory is provided with an address range, a file area and a segment distribution area, wherein the above-mentioned code segment (.textsegment), data segment (.data segment), and .bss segment (BSS Segment) are all provided in the LOAD area of ​​the memory.

[0032] Continuing with the above example, based on the above principle, this example can obtain the verification data corresponding to the file to be executed from the memory; after obtaining the above verification data, this example will perform verification calculation on the above verification data, and then obtain the target verification value corresponding to the verification data.

[0033] In some examples, the target check value is checked by the trusted check value stored in the Trusted Platform Communications Module (TPCM); it can be understood that the above TPCM is a hardware module for enhancing system security, and the TPCM stores the trusted check value corresponding to the to-be-executed file. It can be understood that the trusted check value corresponding to the to-be-executed file is pre-added to the TPCM. Specifically, when it is determined that there is no abnormality in the to-be-executed file, the trusted verification data corresponding to the to-be-executed file is obtained, and the trusted check value corresponding to the trusted verification data is determined and added to the TPCM, so that the to-be-executed file can be subsequently checked based on the trusted check value. It can be understood that storing the trusted check value in the TPCM ensures the security and integrity of the trusted check value.

[0034] It can be understood that this example first obtains the trusted check value corresponding to the to-be-executed file from TPCM, and then verifies the target check value based on the trusted check value, and then determines whether the to-be-executed file has an abnormality. Specifically, if the result of verifying the target check value based on the trusted check value is that the target check value verification passes, it is determined that the to-be-executed file has no abnormality, and the to-be-executed file can be executed later; if the result of verifying the target check value based on the trusted check value is that the target check value verification fails, it can be determined that the to-be-executed file has an abnormality, and executing the to-be-executed file is prone to attack, so the to-be-executed file will not be executed.

[0035] According to the technical solution provided in the embodiment of the present application, after the file to be executed is loaded into the memory, the verification data corresponding to the file to be executed is obtained from the memory, and the target verification value corresponding to the verification data is determined; the target verification value is verified by the trusted verification value stored in the TPCM; when the target verification value is verified, the file to be executed is executed. The above method verifies the file to be executed by obtaining the data loaded into the memory by the file to be executed, and only when the target verification value is verified and it is determined that there is no abnormality in the file to be executed, the file to be executed will be executed, thereby ensuring the security when executing the file to be executed, and directly verifying the file to be executed based on the verification data loaded into the memory, thereby improving the verification accuracy and efficiency of the file to be verified, and avoiding the need to modify the attributes of the file to be executed and increase the signature value in the related art, and the subsequent verification process of the file to be executed is complicated, which affects the execution efficiency of the file to be executed. In addition, it also avoids the problem that the key tampering of the file to be executed that has been loaded into the memory cannot be detected in the related art, resulting in the execution of abnormal files to be executed, which leads to the easy occurrence of security risks.

[0036] In some embodiments, the verification data includes: a code segment and a data segment, such as Figure 3 As shown, obtaining verification data corresponding to the to-be-executed file from the memory and determining a target check value corresponding to the verification data includes:

[0037] S301, obtaining a code segment and a data segment corresponding to the file to be executed from the memory;

[0038] S302, performing hash calculation on the code segment to obtain a target check value of the code segment; performing hash calculation on the data segment to obtain a target check value of the data segment.

[0039] Specifically, this example uses the code segment and the data segment as verification data corresponding to the file to be executed. After the file to be executed is loaded into the memory and before the file to be executed, this example obtains the code segment and the data segment corresponding to the file to be executed from the memory. The subsequent target verification values ​​mentioned above include the code segment target verification value and the data segment target verification value.

[0040] After obtaining the above code segment and data segment, this example further performs a hash calculation on the code segment to obtain a target check value of the code segment; and performs a hash calculation on the data segment to obtain a target check value of the data segment.

[0041] It can be understood that the trusted verification value and the above-mentioned target verification value are obtained in the same way, and the target verification value can be verified by the trusted verification value in the subsequent process; illustratively, the target verification value corresponding to the verification data is obtained by hash calculation, and the trusted verification value is also obtained based on the hash calculation.

[0042] It can be understood that this example is not limited to obtaining the above-mentioned target verification value only by hash calculation. Relevant technical personnel can flexibly select the method of obtaining the target verification value according to actual needs; illustratively, relevant technical personnel can set the use of checksum (Checksum), cyclic redundancy check (CRC) and other methods to obtain the target verification value corresponding to the verification data.

[0043] According to the technical solution provided in the embodiment of the present application, the code segment and data segment corresponding to the file to be executed are obtained from the memory; the code segment is hashed to obtain the code segment target verification value; the data segment is hashed to obtain the data segment target verification value, thereby achieving accurate acquisition of the target verification value that can characterize whether the data of the file to be executed is abnormal.

[0044] In some embodiments, Figure 4 As shown, the target check value is checked by the trusted check value stored in the TPCM, including:

[0045] S401, obtaining a file identifier corresponding to the to-be-executed file, searching the TPCM for a trusted check value corresponding to the file identifier, and comparing the trusted check value corresponding to the file identifier with a target check value;

[0046] S402: When the target check value matches the trusted check value corresponding to the file identifier, it is determined that the target check value has passed the check.

[0047] It can be understood that at least one trusted verification value is stored in TPCM. In order to enable the trusted verification value corresponding to each file to be executed to be found in TPCM later, when the trusted verification value is stored in TPCM, the file identifier corresponding to the file to be executed will be obtained (the file identifier is used to uniquely represent the file to be executed, and the file identifier includes but is not limited to: ID, MD5 code, etc.), and the file identifier and the trusted verification value will be associated and stored in TPCM.

[0048] This example then obtains the file identifier corresponding to the to-be-executed file and then searches in TPCM to determine the corresponding trusted check value. After determining the trusted check value, this example compares the trusted check value with the target check value.

[0049] It can be understood that if the file to be executed has not been modified and there is no anomaly, the trusted check value and the target check value should be able to match. If the file to be executed has been maliciously modified and there is an anomaly, the trusted check value and the target check value should not match. Based on the above principle, when the target check value matches the trusted check value corresponding to the file identifier, it is determined that the target check value verification has passed, and the above-mentioned file to be executed can be executed normally subsequently.

[0050] According to the technical solution provided in the embodiment of the present application, the file identifier corresponding to the to-be-executed file is obtained, the trusted verification value corresponding to the file identifier is searched in the TPCM, and the trusted verification value corresponding to the file identifier is compared with the target verification value; when the target verification value matches the trusted verification value corresponding to the file identifier, it is determined that the target verification value has passed the verification, thereby achieving accurate verification of the target verification value, avoiding the problem in the related art that the target verification value cannot be obtained and the target verification value cannot be verified quickly and effectively.

[0051] In some embodiments, the target check value includes a code segment target check value and a data segment target check value, and the trusted check value includes: a code segment trusted check value and a data segment trusted check value, such as Figure 5 As shown, searching the check value corresponding to the file identifier in TPCM, and comparing the check value corresponding to the file identifier with the target check value, including:

[0052] S501, searching the TPCM for a code segment trustworthy check value and a data segment trustworthy check value corresponding to the file identifier;

[0053] S502, comparing the code segment trustworthy check value with the code segment target check value, and comparing the data segment trustworthy check value with the data segment target check value;

[0054] S503: If the code segment trusted check value is the same as the code segment target check value, and the data segment trusted check value is the same as the data segment target check value, then determine that the target check value matches the check value corresponding to the file identifier.

[0055] Specifically, taking the example that the verification data of the to-be-executed file includes a code segment and a data segment, the corresponding target verification value includes a code segment target verification value and a data segment target verification value, and the trusted verification value includes: a code segment trusted verification value and a data segment trusted verification value.

[0056] Continuing with the above example, this example will search for the code segment trusted verification value and the data segment trusted verification value corresponding to the file identifier in TPCM. Specifically, the code segment trusted verification value and the data segment trusted verification value are stored in TPCM, and the above code segment trusted verification value and the data segment trusted verification value are stored in association with the file identifier, so that the code segment trusted verification value and the data segment trusted verification value corresponding to the above file identifier can be obtained based on the file identifier in the subsequent process.

[0057] After obtaining the code segment trusted check value and the code segment target check value, this example will further compare the code segment trusted check value with the code segment target check value, and compare the data segment trusted check value with the data segment target check value. If the code segment trusted check value is the same as the code segment target check value, and the data segment trusted check value is the same as the data segment target check value, then it is determined that the target check value matches the check value corresponding to the file identifier, the above-mentioned to-be-executed file has not been maliciously modified, there is no abnormality, and the to-be-executed file can be executed subsequently.

[0058] According to the technical solution provided in the embodiment of the present application, a code segment trusted check value and a data segment trusted check value corresponding to the file identifier are searched in the TPCM; the code segment trusted check value is compared with the code segment target check value, and the data segment trusted check value is compared with the data segment target check value; if the code segment trusted check value is the same as the code segment target check value, and the data segment trusted check value is the same as the data segment target check value, then it is determined that the target check value matches the check value corresponding to the file identifier.

[0059] In some examples, such as Figure 6 As shown, the method also includes:

[0060] S601, if the code segment trustworthy check value is different from the code segment target check value, or the data segment trustworthy check value is different from the data segment target check value, then it is determined that the target check value fails to match the check value corresponding to the file identifier;

[0061] S602: Stop executing the file to be executed and issue an abnormality alarm, where the abnormality alarm is used to indicate that the file to be executed is abnormal.

[0062] It can be understood that if the code segment trustworthy check value is different from the code segment target check value, it indicates that the code segment of the to-be-executed file has been maliciously modified and the to-be-executed file has an abnormality; if the data segment trustworthy check value is different from the data segment target check value, it indicates that the data segment of the to-be-executed file has been maliciously modified and the to-be-executed file has an abnormality. Therefore, when the code segment trustworthy check value is different from the code segment target check value, or the data segment trustworthy check value is different from the data segment target check value, this example will determine that the target check value fails to match the check value corresponding to the file identifier.

[0063] It is understandable that when the target check value fails to match the check value corresponding to the file identifier, it is determined that there is an abnormality in the to-be-executed file. In this case, the trusted switch will not execute the to-be-executed file, so the trusted switch stops executing the to-be-executed file.

[0064] In order to enable relevant personnel to be informed of the abnormality of the file to be executed, the trusted switch will also issue an abnormality alarm, which is used to indicate that the file to be executed has an abnormality.

[0065] In some examples, after stopping the execution of the to-be-executed file, in order to further ensure the information security of the trusted switch, the method provided in this example also clears the loaded to-be-executed file from the memory.

[0066] According to the technical solution provided in the embodiment of the present application, if the trusted check value of the code segment is different from the target check value of the code segment, or the trusted check value of the data segment is different from the target check value of the data segment, it is determined that the target check value fails to match the check value corresponding to the file identifier; the execution of the to-be-executed file is stopped, and an abnormal alarm is issued, so that the trusted switch will not execute the to-be-executed file, thereby avoiding the security risk caused by executing the to-be-executed file when the to-be-executed file is abnormal.

[0067] In some examples, such as Figure 7 As shown, before searching the TPCM for a trusted check value corresponding to the file identifier, the method further includes:

[0068] S701, searching for the file identifier in the TPCM, if the file identifier is not included in the TPCM, obtaining a trusted check value corresponding to the file to be executed;

[0069] S702: Store the file identifier and the trusted check value in association with each other in the TPCM.

[0070] Specifically, before searching for the trusted verification value corresponding to the file identifier in TPCM, this example needs to further determine whether the file identifier is included in TPCM. If the file identifier is not included in TPCM, it indicates that the file to be executed has not been executed and this is the first time the file to be executed is executed. At this time, the method provided in this example directly associates the file identifier and the trusted verification value corresponding to the file to be executed and stores them in TPCM; if the file identifier is included in TPCM, the steps of "searching for the trusted verification value corresponding to the file identifier in TPCM, and comparing the trusted verification value corresponding to the file identifier with the target verification value; when the target verification value matches the trusted verification value corresponding to the file identifier, determining that the target verification value has passed" are executed.

[0071] Exemplarily, taking the example that the verification data of the file to be executed includes a code segment and a data segment, this example first obtains the file identifier corresponding to the file to be executed, and then searches for the file identifier in the TPCM. If the file identifier is not included in the TPCM, this example obtains the code segment trusted verification value corresponding to the code segment, obtains the data segment trusted verification value corresponding to the data segment, and then associates the above-mentioned code segment trusted verification value with the file identifier and stores them in the TPCM, associates the data segment trusted verification value with the file identifier and stores them in the TPCM, and continues to execute the file to be executed.

[0072] According to the technical solution provided in the embodiment of the present application, the file identifier is searched in TPCM. If the file identifier is not included in TPCM, the trusted verification value corresponding to the file to be executed is obtained; the file identifier and the trusted verification value are associated and stored in TPCM, thereby realizing the addition of the trusted verification value corresponding to the file to be executed in TPCM, and the trusted verification value is associated with the file identifier corresponding to the file to be executed, so that the above-mentioned trusted verification value can be obtained from TPCM based on the file identifier corresponding to the file to be executed.

[0073] In some examples, such as Figure 8 As shown, in the process of executing the to-be-executed file, the method further includes:

[0074] S801, re-obtaining a target check value corresponding to the to-be-executed file according to a preset check cycle;

[0075] S802: Verify the re-acquired target verification value using the trusted verification value stored in the TPCM.

[0076] Specifically, in order to avoid the problem of security risks caused by the execution of the file to be executed due to malicious modification of the file to be executed or abnormalities in the file to be executed, during the execution of the above-mentioned file to be executed, the target verification value corresponding to the file to be executed will be re-obtained according to the preset verification period, wherein the specific method of obtaining the target verification value corresponding to the file to be executed refers to the above-mentioned embodiment and will not be repeated here.

[0077] After reacquiring the target verification value according to the verification cycle, this example will verify the reacquired target verification value through the trusted verification value stored in TPCM. If there is an abnormality in the reacquired target verification value, the execution of the above-mentioned to-be-executed file will be stopped. If there is no abnormality in the reacquired target verification value, the above-mentioned to-be-executed file will continue, thereby ensuring the security of the to-be-executed file when executing the above-mentioned to-be-executed file.

[0078] It can be understood that the above verification period can be flexibly set by relevant personnel according to actual needs. The pre-selected value range of the above verification period is 1 second to 10 seconds. Preferably, taking the above verification period as 5 seconds as an example, the trusted switch re-acquires the target verification value corresponding to the file to be executed every 5 seconds, and verifies the re-acquired target verification value through the trusted verification value stored in the TPCM.

[0079] In order to better understand this method, this example provides a more specific example for explanation. This example applies the above method to a trusted switch, and the trusted switch uses a Linux system, such as Fig. 9 As shown, it includes the following steps:

[0080] 1) Create a trusted switch function module through the Linux system's kprobe mechanism (or directly modify the kernel source code) so that the trusted switch can insert a hook function for communication verification with the TPCM before dynamically calling the link function in the Linux system's kernel load_elf_binary function.

[0081] 2) Based on the hook function, calculate the hash values ​​of the text and data segments after the elf file (file to be executed) is loaded into the memory.

[0082] 3) Based on the hook function, the file identifier (file ID) of the elf file, the hash of the text segment, and the hash value of the data segment are transferred to the TPCM module.

[0083] 4) TPCM searches for the stored text segment hash value and data segment hash value based on the file id. If the file id cannot be found, the file id and the text segment hash value and the data segment hash value are associated and recorded in the secure storage space of TPCM. The trusted check value (text segment hash value and data segment hash value) and the judgment process are inside the secure TPCM. The data is transmitted between TPCM and the trusted switch function module through a physical secure channel. It is difficult for an intruder to load a file by tampering with the reference value or failing the judgment process, which ensures the accuracy of the trusted check value.

[0084] 5) The Linux system executes the above elf file normally.

[0085] 6) When the elf file is run again, the hash values ​​of the text and data segments of the elf file (to be executed) after it is loaded into the memory are calculated based on the hook function, and the file id, hash values ​​of the text segment and data segment are transmitted to TPCM

[0086] 7) TPCM searches for the hash values ​​of the corresponding text and data segments based on the file ID, and compares them with the hash values ​​of the text and data segments stored in TPCM. If correct, it returns verification success information to the main control CPU.

[0087] 8) The main control CPU determines whether to terminate the next step of the dynamic link process based on the returned information. If so, the to-be-executed file is executed normally. Otherwise, the to-be-executed file is intercepted and an alarm is issued.

[0088] It can be understood that in the solution provided in this example, the ELF file is executed by the shell calling the program executor. The program executor calls the ELF file into the memory, applies for memory for the ELF file, checks the executable program header, and calls the ELF parser. The above ELF file is a type of executable file.

[0089] This method is based on the verification of ELF file segments of TPCM. By storing the hash whitelist of the text segment and data segment of the elf file in TPCM, hash verification is performed before the program is dynamically linked, and subsequent processing is performed according to the judgment strategy of TPCM.

[0090] The method provided in this example does not sign or tag the executable file, does not change the original file of the executable file, only modifies the linker of the trusted switch, and communicates securely with the TPCM module built into the trusted switch through the linker running on the trusted switch, and records the file node number and the hash value of the TEXT and DATA segments corresponding to the file in the TPCM. The original elf file and the properties of the elf file are not changed, and the initial execution import benchmark value is not required. Only the system exec system call program is modified, and the trusted TPCM is used for judgment. The text segment and data segment are checked in the memory, including the .data, .dynamic, .got.plt, .bss and other sections of the ELF file. The text segment contains the .data.rel.ro.dynamic.got.got.plt.data.bss and other sections. Only the LOAD segment content that is actually loaded into the memory is checked, and all the contents of the entire elf file are not checked, which reduces the computing overhead and achieves the effect of fast and accurate verification of the elf file.

[0091] It can be understood that the present method proposes a verification method for elf file segments based on TPCM, and performs irregular verification on the .data section (hereinafter referred to as data segment) in the core segment text segment and data segment that have been loaded into the memory (in the running process of the to-be-executed file, the text segment and data segment of the to-be-executed file are verified according to a preset cycle). The verification lasts until the last moment of the execution of the to-be-executed file. It can effectively detect the situation where the text segment and data segment of the elf file have been tampered with, prevent most dynamic intrusions, and improve the security of running elf files on trusted switches.

[0092] It can be understood that when loading the elf file of the trusted switch, exec retrieves the hash value of the data segment and text segment in TPCM through the file ID after the segment is loaded. If the search is empty, the corresponding file ID record and the hash value of the data segment and text segment after the text segment is in the memory are recorded in the TPCM secure storage area. If the search is not empty, TPCM compares the corresponding hash value according to the file ID and returns whether it is passed to the exec program.

[0093] The exec program also decides whether to enable the timed verification of the file based on the TPCM internal configuration switches and parameters. If enabled, the timer thread is started to enable the timed measurement of the .data section of the text segment and data segment for the executable program segment, and the measurement results are sent to the TPCM for determination and decision on whether to intercept. The TPCM sends the processing conclusion to the exec program, and the exec program proceeds to the next step based on the processing conclusion.

[0094] According to the technical solution provided in the embodiment of the present application, the target verification value corresponding to the file to be executed is re-acquired according to the preset verification period; the re-acquired target verification value is verified by the trusted verification value stored in the TPCM, thereby realizing the periodic acquisition of the data loaded into the memory by the file to be executed to verify the file to be executed, and only when the target verification value is verified and it is determined that there is no abnormality in the file to be executed, the execution of the file to be executed will be continued, further ensuring the security when executing the file to be executed, and directly verifying the file to be executed based on the verification data loaded into the memory, thereby improving the verification accuracy and verification efficiency of the file to be verified.

[0095] All the above optional technical solutions can be arbitrarily combined to form optional embodiments of the present application, which will not be described one by one here.

[0096] The following are device embodiments of the present application, which can be used to execute the method embodiments of the present application. For details not disclosed in the device embodiments of the present application, please refer to the method embodiments of the present application.

[0097] This embodiment also provides a trusted switch file execution device, such as Fig.10 As shown, the device comprises:

[0098] The acquisition module 1001 is used to obtain verification data corresponding to the to-be-executed file from the memory after the to-be-executed file is loaded into the memory of the trusted switch, and determine a target check value corresponding to the verification data, where the verification data is the data loaded into the memory by the to-be-executed file;

[0099] A verification module 1002, configured to verify a target verification value using a trusted verification value stored in a trusted platform communications module (TPCM);

[0100] The execution module 1003 is used to execute the to-be-executed file when the target verification value passes the verification.

[0101] In some examples, the verification data includes: a code segment and a data segment; the acquisition module 1001 is also used to obtain the code segment and data segment corresponding to the file to be executed from the memory; perform hash calculation on the code segment to obtain the code segment target verification value; perform hash calculation on the data segment to obtain the data segment target verification value.

[0102] In some examples, the verification module 1002 is also used to obtain the file identifier corresponding to the file to be executed, search the TPCM for a trusted verification value corresponding to the file identifier, and compare the trusted verification value corresponding to the file identifier with the target verification value; when the target verification value matches the trusted verification value corresponding to the file identifier, it is determined that the target verification value has passed.

[0103] In some examples, the target check value includes a code segment target check value and a data segment target check value, and the trusted check value includes: a code segment trusted check value and a data segment trusted check value; the check module 1002 is also used to search the code segment trusted check value and the data segment trusted check value corresponding to the file identifier in the TPCM; compare the code segment trusted check value with the code segment target check value, and compare the data segment trusted check value with the data segment target check value; if the code segment trusted check value is the same as the code segment target check value, and the data segment trusted check value is the same as the data segment target check value, then it is determined that the target check value matches the check value corresponding to the file identifier.

[0104] In some examples, the verification module 1002 is also used to determine that the target verification value fails to match the verification value corresponding to the file identifier if the code segment trusted verification value is different from the code segment target verification value, or the data segment trusted verification value is different from the data segment target verification value; stop executing the file to be executed and issue an exception alarm, and the exception alarm is used to indicate that there is an exception in the file to be executed.

[0105] In some examples, the verification module 1002 is further used to search for the file identifier in the TPCM, and if the file identifier is not included in the TPCM, obtain a trusted verification value corresponding to the file to be executed; and store the file identifier and the trusted verification value in association in the TPCM.

[0106] In some examples, the verification module 1002 is further used to re-obtain a target verification value corresponding to the to-be-executed file according to a preset verification cycle; and verify the re-obtained target verification value using a trusted verification value stored in the TPCM.

[0107] According to the technical solution provided by the embodiment of the present application, after the file to be executed is loaded into the memory of the trusted switch, the trusted switch file execution device provided by the embodiment obtains the verification data corresponding to the file to be executed from the memory, and determines the target verification value corresponding to the verification data; verifies the target verification value through the trusted verification value stored in the TPCM; and executes the file to be executed when the target verification value passes the verification. The above method verifies the file to be executed by obtaining the data loaded into the memory by the file to be executed, and only when the target verification value passes the verification and it is determined that there is no abnormality in the file to be executed, the file to be executed will be executed, thereby ensuring the security when executing the file to be executed, and directly verifies the file to be executed based on the verification data loaded into the memory, thereby improving the verification accuracy and verification efficiency of the file to be verified, thereby avoiding the need to modify the attributes of the file to be executed and increase the signature value in the related art, and the verification method is complicated in the subsequent verification process of the file to be executed, which affects the execution efficiency of the file to be executed. In addition, it also avoids the problem that the key tampering of the file to be executed that has been loaded into the memory cannot be detected in the related art, resulting in the execution of abnormal files to be executed, which leads to the problem of easy security risks.

[0108] Fig.11 Schematic diagram of an electronic device 11 provided in an embodiment of the present application. Fig.11 As shown, the electronic device 11 of this embodiment includes: a processor 1101, a memory 1102, and a computer program 1103 stored in the memory 1102 and executable on the processor 1101. When the processor 1101 executes the computer program 1103, the steps in the above-mentioned method embodiments are implemented. Alternatively, when the processor 1101 executes the computer program 1103, the functions of the modules / units in the above-mentioned device embodiments are implemented.

[0109] The electronic device 11 may be a desktop computer, a notebook, a PDA, a cloud server, or other electronic device. The electronic device 11 may include, but is not limited to, a processor 1101 and a memory 1102. Those skilled in the art will appreciate that Fig.11 The electronic device 11 is merely an example and does not limit the electronic device 11 , and may include more or less components than those shown in the figure, or different components.

[0110] Processor 1101 can be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.

[0111] The memory 1102 may be an internal storage unit of the electronic device 11, for example, a hard disk or memory of the electronic device 11. The memory 1102 may also be an external storage device of the electronic device 11, for example, a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card (FlashCard), etc. equipped on the electronic device 11. The memory 1102 may also include both an internal storage unit of the electronic device 11 and an external storage device. The memory 1102 is used to store computer programs and other programs and data required by the electronic device.

[0112] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units.

[0113] If the integrated module / unit 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 present application implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. The computer program may include computer program code, and the computer program code may be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of regional requirements and patent practice. For example, in some areas, according to regional requirements and patent practice, the computer-readable medium does not include electric carrier signals and telecommunication signals.

[0114] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.

Claims

1. A trusted switch file execution method, characterized in that: The method comprises: After the file to be executed is loaded into the memory of the trusted switch, verification data corresponding to the file to be executed is obtained from the memory, and a target check value corresponding to the verification data is determined, wherein the verification data is the data loaded into the memory by the file to be executed; Verifying the target verification value by using a trusted verification value stored in a trusted platform communications module (TPCM); When the target check value passes the check, the to-be-executed file is executed.

2. The method according to claim 1, characterized in that The verification data includes: a code segment and a data segment; obtaining the verification data corresponding to the to-be-executed file from the memory, and determining the target check value corresponding to the verification data, including: Obtaining the code segment and data segment corresponding to the to-be-executed file from the memory; A hash calculation is performed on the code segment to obtain a code segment target check value; a hash calculation is performed on the data segment to obtain a data segment target check value.

3. The method according to claim 1, characterized in that Verifying the target verification value by using the trusted verification value stored in the TPCM includes: Obtaining a file identifier corresponding to the to-be-executed file, searching the TPCM for a trusted check value corresponding to the file identifier, and comparing the trusted check value corresponding to the file identifier with the target check value; When the target verification value matches the trusted verification value corresponding to the file identifier, it is determined that the target verification value passes.

4. The method according to claim 3, characterized in that The target check value includes a code segment target check value and a data segment target check value, and the trusted check value includes a code segment trusted check value and a data segment trusted check value; searching the check value corresponding to the file identifier in the TPCM, and comparing the check value corresponding to the file identifier with the target check value, including: Searching the TPCM for a code segment trustworthy check value and a data segment trustworthy check value corresponding to the file identifier; Compare the code segment trustworthy check value with the code segment target check value, and compare the data segment trustworthy check value with the data segment target check value; If the code segment trusted check value is the same as the code segment target check value, and the data segment trusted check value is the same as the data segment target check value, then it is determined that the target check value matches the check value corresponding to the file identifier.

5. The method according to claim 4, characterized in that The method further comprises: If the code segment trustworthy check value is different from the code segment target check value, or the data segment trustworthy check value is different from the data segment target check value, then it is determined that the target check value fails to match the check value corresponding to the file identifier; Stop executing the file to be executed and issue an abnormality alarm, where the abnormality alarm is used to indicate that the file to be executed is abnormal.

6. The method according to claim 3, characterized in that Before searching the TPCM for a trusted check value corresponding to the file identifier, the method further includes: Searching for the file identifier in the TPCM, and if the TPCM does not contain the file identifier, obtaining the trusted check value corresponding to the to-be-executed file; The file identifier and the trusted verification value are associated and stored in the TPCM.

7. The method according to claim 1, characterized in that In the process of executing the to-be-executed file, the method further includes: According to a preset verification cycle, re-obtaining a target verification value corresponding to the to-be-executed file; The retrieved target check value is verified using the trusted check value stored in the TPCM.

8. A trusted switch file execution device, characterized in that: The device comprises: An acquisition module, configured to acquire verification data corresponding to the to-be-executed file from the memory after the to-be-executed file is loaded into the memory of the trusted switch, and determine a target check value corresponding to the verification data, wherein the verification data is data loaded into the memory by the to-be-executed file; A verification module, configured to verify the target verification value using a trusted verification value stored in a trusted platform communications module (TPCM); The execution module is used to execute the to-be-executed file when the target check value passes the check.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.

Citation Information

Cited By

  • Data processing method and device in assembly line, medium and program product

    CN119883382A

  • Data Processing Method, Device, Medium and Program Product in Pipeline

    CN119883382B