A container image trust measurement method combining linear chain and unbalanced binary tree

By combining the structure of linear chains and unbalanced binary trees, a trusted measurement method for container images is solved, and the problems of container images are effectively tamper detection and tamper-proof capabilities are achieved, which is suitable for terminal devices with limited resources.

CN119759484APending Publication Date: 2025-04-04STATE GRID SHANGHAI ENERGY INTERCONNECTION RES INST CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411626252.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-14
Publication Date
2025-04-04

AI Technical Summary

Technical Problem

How to enhance the tamper-proof capability of container mirroring and achieve efficient integrity measurement and tamper detection without relying on special hardware.

Method used

Combining the dual structure of linear chains and unbalanced binary trees, a trusted metric method for container mirroring is constructed. By performing hashing operations on each file in the container image, a linear hash link is built, and these hash values ​​are used as leaf nodes to build an unbalanced binary hash tree. Compare the root node of the unbalanced binary hash tree with the root node of the benchmark unbalanced binary hash tree in the whitelist, and perform tamper-location detection if it is different.

Benefits of technology

It realizes efficient integrity measurement and tamper detection capabilities of container mirroring, enhances tamper-proof capabilities, and provides flexible security solutions without relying on special hardware, suitable for terminal devices with limited resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119759484A_ABST
    Figure CN119759484A_ABST
Patent Text Reader

Abstract

The present invention relates to a container image trust measurement method combining a linear chain and an unbalanced binary tree, comprising: constructing an unbalanced binary hash tree according to an existing container image; comparing the root node of the unbalanced binary hash tree with the root node of a reference unbalanced binary hash tree in a whitelist; if the hash value of the root node of the unbalanced binary hash tree is the same as the hash value of the root node of the reference unbalanced binary hash tree, it is considered that the container image has not been tampered with; if the hash value of the root node of the unbalanced binary hash tree is different from the hash value of the root node of the reference unbalanced binary hash tree, tampering location detection is performed on the container image. The present invention not only enhances the anti-tampering capability of the container image, but also realizes efficient integrity measurement and tampering detection while ensuring computational efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of power terminal network security technology, and in particular to a method for measuring the trustworthiness of container images by combining linear chains and unbalanced binary trees. Background Technology

[0002] With the rapid development of cloud computing and edge computing technologies, smart terminal devices have been widely used in various industries, from smartphones and IoT devices to industrial automation systems. These devices typically rely on lightweight operating environments, and container technology, with its advantages of low resource consumption and fast startup speed, has become an ideal choice. Container images, as a core component of container technology, hold a crucial position. However, the accompanying security issues are becoming increasingly prominent, especially how to ensure the integrity of container images and prevent malicious tampering, which has become a challenge that urgently needs to be addressed.

[0003] The development of cloud-native technologies and the widespread adoption of Docker containerized deployment have led many experts and scholars to conduct research on image security in recent years, achieving significant results. Jain et al. outlined several existing image scanning tools. For example, Anchore uses the Syft component to create a detailed list of packages and combines it with the Grype module to perform a comprehensive scan of container images to ensure their security and compliance. Docker Scan tools focus on the network layer, aiming to discover images in remote repositories and perform security audits on potentially sensitive data. Brady et al. proposed a method based on a multi-stage CI / CD process to enhance the security assessment of Docker images. Building upon Clair, they constructed a dynamic API scanning tool adapted to the AWS environment to further improve image security. Furthermore, Kwon et al. developed a system called DIVDS, which uses the IVD component to identify potential vulnerabilities in Docker images and uses the IVE component to score these vulnerabilities, determining whether the image is suitable for building a secure Docker container runtime environment based on the score. Some research also attempts to protect container images through trusted computing. For instance, Wang Juan et al. designed a method to extract detailed information from Roofts files and calculate their hash values. Subsequently, these hash values ​​are combined for secondary hashing and encrypted using the bind command of the TPM (Trusted Platform Module), ultimately saving the encrypted data. Shen et al. suggested performing a hash verification on the downloaded image file using the SHA-256 algorithm before container startup, storing the resulting hash value in the cloud. Whenever a container needs to be run, the SHA-256 hash calculation is re-executed and compared with the value stored in the cloud to verify the integrity and consistency of the container image file. Liu Guojie et al., on the other hand, used TCM technology to conduct comprehensive trust measurement of the hardware platform, container service, compute nodes, and management nodes in the container cloud environment, successfully building a trusted container cloud ecosystem. However, their solution has shortcomings in fine-grained integrity measurement of container images, and using TPM or TCM chips as the root of trust places high demands on the terminal hardware environment. Summary of the Invention

[0004] The technical problem to be solved by this invention is to provide a container image trust measurement method that combines linear chains and unbalanced binary trees, which not only enhances the anti-tampering capability of container images, but also achieves efficient integrity measurement and tamper detection while ensuring computational efficiency.

[0005] The technical solution adopted by this invention to solve its technical problem is: to provide a container image trust measurement method combining linear chains and unbalanced binary trees, including the following steps:

[0006] Build an unbalanced binary hash tree based on an existing container image;

[0007] The root node of the unbalanced binary hash tree is compared with the root node of the benchmark unbalanced binary hash tree in the whitelist.

[0008] If the hash value of the root node of the unbalanced binary hash tree is the same as the hash value of the root node of the benchmark unbalanced binary hash tree, then the container image is considered to have not been tampered with.

[0009] If the hash value of the root node of the unbalanced binary hash tree is different from the hash value of the root node of the benchmark unbalanced binary hash tree, then the container image is tampered with and located.

[0010] The baseline unbalanced binary hash tree in the whitelist is obtained in the following way:

[0011] Perform a hash operation on each file in the container image to construct a linear chain of hash values, forming the base hash value of the container image;

[0012] The basic hash value of each container image is obtained using a linear chain, and an unbalanced binary hash tree is constructed using the basic hash value as the leaf node.

[0013] The unbalanced binary hash tree is used as the base unbalanced binary hash tree and stored in the whitelist.

[0014] The container image trust measurement method combining linear chains and unbalanced binary trees also includes:

[0015] Determine whether the contents of the container image have undergone legal changes;

[0016] If the contents of the container image undergo a legitimate change, an integrity check is performed on the files in the container image that have undergone the legitimate change, and the corresponding part of the baseline unbalanced binary hash tree in the whitelist is modified.

[0017] The construction of an unbalanced binary hash tree based on an existing container image specifically includes:

[0018] Calculate the hash value of each file in each existing container image by performing a hash operation, and construct a linear chain of hash values ​​for each container image to obtain the hash value of each container image;

[0019] The hash value of each container image is obtained using a linear chain, and the hash value is used as a leaf node to construct an unbalanced binary hash tree.

[0020] The tampering location detection of the container image specifically includes:

[0021] Find the node in the unbalanced binary hash tree whose hash value is different from that of the node in the baseline unbalanced binary hash tree;

[0022] Determine whether the node is a leaf node. If the number of existing container images is 1, then the root node is a leaf node; otherwise, determine whether the node has child nodes.

[0023] If the node is a leaf node, then the file of the container image corresponding to the leaf node has been tampered with;

[0024] If the node is not a leaf node, then the left child node of the node is compared with the corresponding left child node of the benchmark unbalanced binary hash tree, and the right child node of the node is compared with the corresponding right child node of the benchmark unbalanced binary hash tree.

[0025] If the hash value of the left child node of the node is the same as the hash value of the corresponding left child node of the baseline unbalanced binary hash tree, then it is considered that the file of the container image corresponding to the left child node of the node has not been tampered with.

[0026] If the hash value of the right child node of the node is the same as the hash value of the corresponding right child node of the baseline unbalanced binary hash tree, then it is considered that the file of the container image corresponding to the right child node of the node has not been tampered with.

[0027] If the hash value of the left child node of the node is different from the hash value of the corresponding left child node of the baseline unbalanced binary hash tree, or if the hash value of the right child node of the node is different from the hash value of the corresponding right child node of the baseline unbalanced binary hash tree, then the node of the unbalanced binary hash tree that is found to have a different hash value from the node of the baseline unbalanced binary hash tree is returned, until the leaf node corresponding to the file of the tampered container image is located.

[0028] The technical solution adopted by this invention to solve its technical problem is: to provide a container image trust measurement device combining linear chains and unbalanced binary trees, comprising:

[0029] Build modules are used to construct unbalanced binary hash trees from existing container images;

[0030] The comparison module is used to compare the root node of the unbalanced binary hash tree with the root node of the benchmark unbalanced binary hash tree in the whitelist.

[0031] The confirmation module is used to determine that the container image has not been tampered with when the hash value of the root node of the unbalanced binary hash tree is the same as the hash value of the root node of the benchmark unbalanced binary hash tree.

[0032] The location detection module is used to detect tampering of the container image when the hash value of the root node of the unbalanced binary hash tree is different from the hash value of the root node of the benchmark unbalanced binary hash tree.

[0033] The container image trust measurement device combining linear chains and unbalanced binary trees further includes a whitelist creation module, which includes:

[0034] The basic hash value forming unit is used to perform hash operations on each file in the container image to construct a linear hash value chain, forming the basic hash value of the container image;

[0035] A baseline building unit is used to obtain the base hash value of each container image in a linear chain manner, and to construct an unbalanced binary hash tree using the base hash value as a leaf node.

[0036] The add unit is used to store the unbalanced binary hash tree as the base unbalanced binary hash tree into the whitelist.

[0037] The container image trust measurement device combining linear chains and unbalanced binary trees further includes a monitoring module, which includes:

[0038] A valid change determination unit is used to determine whether the content of the container image has undergone a valid change;

[0039] The modification unit is used to perform an integrity check on the files in the container image that have undergone a legitimate change when the content of the container image has undergone a legitimate change, and to modify the corresponding part of the baseline unbalanced binary hash tree in the whitelist.

[0040] The building module includes:

[0041] The hash calculation unit is used to perform hash operations on each file of each existing container image, construct a linear hash value chain for each container image, and obtain the hash value of each container image.

[0042] The building unit is used to obtain the hash value of each container image in a linear chain manner, and to construct an unbalanced binary hash tree using the hash value as a leaf node.

[0043] The positioning detection module includes:

[0044] A search unit is used to find nodes in the unbalanced binary hash tree whose hash values ​​are different from those of nodes in the baseline unbalanced binary hash tree.

[0045] The leaf node determination unit is used to determine whether the node is a leaf node. If the number of existing container images is 1, then the root node is a leaf node; otherwise, it is determined whether the node has child nodes. If there are no child nodes, then it is a leaf node.

[0046] The first confirmation unit is used to confirm that the file of the container image corresponding to the leaf node has been tampered with when the node is a leaf node.

[0047] The child node comparison unit is used to compare the left child node of the node with the corresponding left child node of the benchmark unbalanced binary hash tree when the node is not a leaf node, and to compare the right child node of the node with the corresponding right child node of the benchmark unbalanced binary hash tree.

[0048] The second confirmation unit is used to determine that the file of the container image corresponding to the left child node of the node has not been tampered with when the hash value of the left child node of the node is the same as the hash value of the corresponding left child node of the benchmark unbalanced binary hash tree.

[0049] The third confirmation unit is used to determine that the file of the container image corresponding to the right child node of the node has not been tampered with when the hash value of the right child node of the node is the same as the hash value of the corresponding right child node of the benchmark unbalanced binary hash tree.

[0050] The return unit is configured to return the node in the unbalanced binary hash tree whose hash value is different from that of the corresponding left child node in the baseline unbalanced binary hash tree if the hash value of the node's left child node is different from that of the corresponding right child node in the baseline unbalanced binary hash tree, until the leaf node corresponding to the file of the tampered container image is located.

[0051] The technical solution adopted by the present invention to solve its technical problem is: to provide an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, it implements the steps of the above-mentioned container image trust measurement method combining linear chains and unbalanced binary trees.

[0052] The technical solution adopted by the present invention to solve its technical problem is: to provide a computer-readable storage medium on which a computer program is stored, wherein when the computer program is executed by a processor, the steps of the above-mentioned container image trust measurement method combining linear chain and unbalanced binary tree are implemented.

[0053] Beneficial effects

[0054] By employing the above-described technical solution, this invention offers the following advantages and positive effects compared to existing technologies: By combining a linear chain and an unbalanced binary tree structure, this invention not only achieves efficient integrity measurement of container images but also enhances the ability to detect tampering. It provides a more flexible security solution without relying on special hardware, making it particularly suitable for resource-constrained terminal device scenarios. Furthermore, the dual-layer structure ensures system scalability, supporting dynamic updates and additions to images. Attached Figure Description

[0055] Figure 1 This is a flowchart of the first embodiment of the present invention, which combines a linear chain and an unbalanced binary tree for measuring the trustworthiness of container images.

[0056] Figure 2 This is a flowchart of the measurement and acquisition process in the first embodiment of the present invention;

[0057] Figure 3 This is a schematic diagram of the linear chain hash algorithm based on mirror ID in the first embodiment of the present invention;

[0058] Figure 4 This is a schematic diagram of the algorithm for constructing an unbalanced binary hash tree in the first embodiment of the present invention;

[0059] Figure 5 This is a time comparison chart of three system measurement methods;

[0060] Figure 6 This is a schematic diagram of the construction of an unbalanced binary tree under four mirror scenarios. Detailed Implementation

[0061] The present invention will be further illustrated below with reference to specific embodiments. It should be understood that these embodiments are for illustrative purposes only and are not intended to limit the scope of the invention. Furthermore, it should be understood that after reading the teachings of this invention, those skilled in the art can make various alterations or modifications to the invention, and these equivalent forms also fall within the scope defined by the appended claims.

[0062] The first embodiment of this invention relates to a container image trust measurement method combining linear chains and unbalanced binary trees, aiming to provide an efficient method for verifying the integrity of image files. Specifically, in the initial measurement stage, the system performs hash operations on each file in the container image to construct a linear chain of hash values, forming the base hash value of the image. In real-time measurement, considering that smart terminals in practical applications typically contain multiple independent images, a linear chain approach is first used to quickly obtain the hash value of each image, and then these hash values ​​are used as leaf nodes to construct an unbalanced binary hash tree. This design enables the system to accurately identify the specific image that has been tampered with while maintaining high efficiency, thereby improving the efficiency of terminal image integrity measurement.

[0063] In this implementation, when the system detects that the container image has been tampered with, it will activate a detection mechanism to locate the tampered container image, such as... Figure 1 As shown, the specific steps include:

[0064] First, an unbalanced binary hash tree V-NH-Tree is constructed based on the existing container image. Then, the root node of the unbalanced binary hash tree V-NH-Tree is compared with the root node of the baseline unbalanced binary hash tree T-NH-Tree in the whitelist. If the hash value of the root node of the unbalanced binary hash tree V-NH-Tree is the same as the hash value of the root node of the baseline unbalanced binary hash tree T-NH-Tree, the container image is considered to have not been tampered with. If the hash value of the root node of the unbalanced binary hash tree V-NH-Tree is different from the hash value of the root node of the baseline unbalanced binary hash tree T-NH-Tree, tamper detection is performed on the container image.

[0065] The baseline unbalanced binary hash tree (T-NH-Tree) in the whitelist is obtained through a baseline collection method, specifically as follows: First, the base hash value of the terminal's container image needs to be collected, and this base hash value is used as the comparison standard for subsequent verification. For example... Figure 2As shown, the chain tree combined with image integrity measurement is divided into two parts: one is the collection of linear chain hashes for a single image, and the other is the construction of an unbalanced hash tree for all images in the entire terminal. The collection of linear chain hashes for a single image specifically involves performing a hash operation on each file in the container image to construct a linear chain of hash values, forming the base hash value of the container image. The construction of the unbalanced hash tree for all images in the entire terminal specifically involves obtaining the base hash value of each container image using a linear chain approach, and then using the base hash values ​​of all container images to construct an unbalanced binary hash tree, which is used as the baseline unbalanced binary hash tree. After collection, this baseline unbalanced binary hash tree is stored in a whitelist, which contains not only the ImageID and its linear hash for each image but also the entire unbalanced hash tree.

[0066] Based on the layered structure of Docker images, a Docker image consists of multiple read-only layers and one read-write layer. Local image files are stored locally in a multi-layered read-only manner. Taking the overlay2 storage driver as an example, container images are stored locally with image metadata completely separated from the image files. This concept is consistent with the design of image storage in a repository. The image metadata storage path is ` / var / lib / docker / image / overlay2`, and the image file storage path is ` / var / lib / docker / overlay2`. The local metadata of the image file includes repository, image, layer, and distribution. Because images are stored in layers, the repository and image metadata do not have corresponding physical image files, while the layer and distribution metadata do have corresponding physical image layer files. The actual local storage location of the image is obtained through a CacheID index. Therefore, the integrity of a Docker image is its static integrity. Static integrity refers to the integrity of various static files, mainly including the application, modules, and shared libraries loaded at runtime. The metadata of each layer of the image and the actual stored data of the image file are the objects that static integrity needs to measure. For a single image, a linear chain hash algorithm based on the image ID is as follows: Figure 3 As shown.

[0067] To make the construction algorithm as concise and efficient as possible, and to improve terminal space utilization, this implementation uses an unbalanced binary hash tree. Each terminal has an unbalanced hash tree as its metric benchmark, corresponding to all its mirror images. The leaf k of the tree represents the linear chain hash value corresponding to mirror l, and the root is the set of metric evidence for the entire terminal. The entire tree is stored on the terminal as a file. Furthermore, the unbalanced binary hash tree supports the dynamic addition of leaf nodes, thus supporting mirror update operations. The construction algorithm for the unbalanced binary hash tree is as follows: Figure 4 As shown. Figure 6 The diagram shows an unbalanced binary tree constructed with four container images.

[0068] After system startup, before the business image runs, a chain tree combined with metric verification is triggered to achieve real-time measurement and verification of the container image on the terminal. The monitoring module monitors update, deletion, and download operations of the container image (i.e., determines whether the content of the container image has undergone legitimate changes). When these events are triggered (i.e., the content of the container image has undergone legitimate changes), the monitoring module performs integrity checks on the files in the container image with the legitimate changes and synchronizes them to the corresponding part of the baseline unbalanced binary hash tree in the whitelist. The monitoring module in this embodiment is implemented based on the LSM (Linux Security Module) framework, which places hook functions in the kernel source code. When image files are access controlled, such as by write operations, renaming operations, or moving operations, triggering the monitoring module, the monitoring module can call the corresponding security module through the hook function to modify the whitelist.

[0069] Therefore, when the container image file undergoes legitimate changes, this implementation method can quickly rebuild the baseline unbalanced binary hash tree, realize the dynamic addition and updating of the leaf nodes of the baseline unbalanced binary hash tree structure, and ensure the flexibility and maintainability of the system.

[0070] When performing tampering location detection, this implementation method can locate the tampered file. Specifically, when the hash value of the root node of an unbalanced binary hash tree is found to be inconsistent with the hash value of the root node of the baseline unbalanced binary hash tree, it will further determine whether the node is a leaf node. If the number of container images is 1, the root node is considered a leaf node; if this node is a leaf node, the corresponding image file has been tampered with. If the node is not a leaf node, then the following operations are performed on its left and right child nodes in sequence: compare the left child node of the node with the corresponding left child node of the benchmark unbalanced binary hash tree, and compare the right child node of the node with the corresponding right child node of the benchmark unbalanced binary hash tree; if the hash value of the left child node of the node is the same as the hash value of the corresponding left child node of the benchmark unbalanced binary hash tree, then it is considered that the file of the container image corresponding to the left child node of the node has not been tampered with; if the hash value of the right child node of the node is the same as the hash value of the corresponding right child node of the benchmark unbalanced binary hash tree, then it is considered that the file of the container image corresponding to the right child node of the node has not been tampered with; if the hash value of the left child node of the node is different from the hash value of the corresponding left child node of the benchmark unbalanced binary hash tree, or the hash value of the right child node of the node is different from the hash value of the corresponding right child node of the benchmark unbalanced binary hash tree, then repeat the above judgment, recursively, layer by layer, to finally locate the leaf node corresponding to the tampered image file.

[0071] This embodiment uses a prototype system to simulate a power terminal and its internal containers to further verify the feasibility of this implementation method. The performance of chained hashing, Merkle tree hashing, and the combined chain-tree hashing method of this embodiment are compared and analyzed. The experimental environment is shown in the table below.

[0072] name parameter PC hardware environment IntelXeonProcessor(Cascadelake)2.494GHz4G operating system Ubuntu 18.04 Docker version 26.1.4 kernel version 5.4.0-48-generic storage driver overlay2

[0073] To test the performance of the chain-tree combined metric method, the following experimental mirrors were selected: the first group consisted of alpine:3.20.3, neo4j:ubi9, langchain:0.1.0, and python:3.10; the second group was generated by repeating the first group 10 times; and the third group was generated by repeating the first group 50 times. Multiple metric tests were conducted on the three groups of mirrors with different numbers of mirrors using the three metric methods, and the average metric time cost was calculated by averaging the test data. Figure 5 As shown. From Figure 5 As can be seen, the time overhead of all three measurement methods increases with the increase of mirror layers. However, the time of the chain-tree combined hashing in this implementation is consistently lower than that of Merkle tree hashing. The performance advantage of the chain-tree combined hashing becomes increasingly apparent as the number of mirrors increases.

[0074] It is easy to see that this implementation significantly reduces computational overhead by introducing a linear chain structure, especially in image measurement and routine verification processes, greatly improving system efficiency. This implementation, through the application of an unbalanced binary tree, enables the system to accurately locate the specific image file when the container image is tampered with, effectively avoiding the problem of difficulty in locating tampered files in traditional linear chain schemes.

[0075] A second embodiment of the present invention relates to a container image trust measurement device combining linear chains and unbalanced binary trees, comprising:

[0076] Build modules are used to construct unbalanced binary hash trees from existing container images;

[0077] The comparison module is used to compare the root node of the unbalanced binary hash tree with the root node of the benchmark unbalanced binary hash tree in the whitelist.

[0078] The confirmation module is used to determine that the container image has not been tampered with when the hash value of the root node of the unbalanced binary hash tree is the same as the hash value of the root node of the benchmark unbalanced binary hash tree.

[0079] The location detection module is used to detect tampering of the container image when the hash value of the root node of the unbalanced binary hash tree is different from the hash value of the root node of the benchmark unbalanced binary hash tree.

[0080] The container image trust measurement device combining linear chains and unbalanced binary trees further includes a whitelist creation module, which includes:

[0081] The basic hash value forming unit is used to perform hash operations on each file in the container image to construct a linear hash value chain, forming the basic hash value of the container image;

[0082] A baseline building unit is used to obtain the base hash value of each container image in a linear chain manner, and to construct an unbalanced binary hash tree using the base hash value as a leaf node.

[0083] The add unit is used to store the unbalanced binary hash tree as the base unbalanced binary hash tree into the whitelist.

[0084] The container image trust measurement device combining linear chains and unbalanced binary trees further includes a monitoring module, which includes:

[0085] A valid change determination unit is used to determine whether the content of the container image has undergone a valid change;

[0086] The modification unit is used to perform an integrity check on the files in the container image that have undergone a legitimate change when the content of the container image has undergone a legitimate change, and to modify the corresponding part of the baseline unbalanced binary hash tree in the whitelist.

[0087] The building module includes:

[0088] The hash calculation unit is used to perform hash operations on each file of each existing container image, construct a linear hash value chain for each container image, and obtain the hash value of each container image.

[0089] The building unit is used to obtain the hash value of each container image in a linear chain manner, and to construct an unbalanced binary hash tree using the hash value as a leaf node.

[0090] The positioning detection module includes:

[0091] A search unit is used to find nodes in the unbalanced binary hash tree whose hash values ​​are different from those of nodes in the baseline unbalanced binary hash tree.

[0092] The leaf node determination unit is used to determine whether the node is a leaf node. If the number of existing container images is 1, then the root node is a leaf node; otherwise, it is determined whether the node has child nodes. If there are no child nodes, then it is a leaf node.

[0093] The first confirmation unit is used to confirm that the file of the container image corresponding to the leaf node has been tampered with when the node is a leaf node.

[0094] The child node comparison unit is used to compare the left child node of the node with the corresponding left child node of the benchmark unbalanced binary hash tree when the node is not a leaf node, and to compare the right child node of the node with the corresponding right child node of the benchmark unbalanced binary hash tree.

[0095] The second confirmation unit is used to determine that the file of the container image corresponding to the left child node of the node has not been tampered with when the hash value of the left child node of the node is the same as the hash value of the corresponding left child node of the benchmark unbalanced binary hash tree.

[0096] The third confirmation unit is used to determine that the file of the container image corresponding to the right child node of the node has not been tampered with when the hash value of the right child node of the node is the same as the hash value of the corresponding right child node of the benchmark unbalanced binary hash tree.

[0097] The return unit is configured to return the node in the unbalanced binary hash tree whose hash value is different from that of the corresponding left child node in the baseline unbalanced binary hash tree if the hash value of the node's left child node is different from that of the corresponding right child node in the baseline unbalanced binary hash tree, until the leaf node corresponding to the file of the tampered container image is located.

[0098] A third embodiment of the present invention relates to an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the container image trust measurement method combining linear chains and unbalanced binary trees of the first embodiment.

[0099] The fourth embodiment of the present invention relates to a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the container image trust measurement method combining linear chains and unbalanced binary trees of the first embodiment.

[0100] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product implemented on one or more computer-usable storage media (including, but not limited to, disk storage and optical storage) containing computer-usable program code.

[0101] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0102] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction methods implemented in a process. Figure 1One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0103] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0104] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any modifications or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be based on the scope of protection of the claims.

Claims

1. A container image trust measurement method combining linear chain and unbalanced binary tree, characterized in that: The following steps are involved: Build an unbalanced binary hash tree based on the existing container image; Compare the root node of the unbalanced binary hash tree with the root node of the benchmark unbalanced binary hash tree in the whitelist; If the hash value of the root node of the unbalanced binary hash tree is the same as the hash value of the root node of the reference unbalanced binary hash tree, it is considered that the container image has not been tampered with; If the hash value of the root node of the unbalanced binary hash tree is different from the hash value of the root node of the reference unbalanced binary hash tree, a tampering location detection is performed on the container image.

2. The container image trust measurement method combining linear chain and unbalanced binary tree according to claim 1 is characterized in that: The benchmark unbalanced binary hash tree in the whitelist is obtained in the following way: Perform hash operations on each file in the container image to construct a linear hash value chain to form a basic hash value of the container image; A linear chain is used to obtain the base hash value of each container image, and an unbalanced binary hash tree is constructed using the base hash value as a leaf node. The unbalanced binary hash tree is stored in a whitelist as a benchmark unbalanced binary hash tree.

3. The container image trust measurement method combining linear chain and unbalanced binary tree according to claim 1 is characterized in that: Also includes: Determine whether legal changes have occurred to the content of the container image; If the content of the container image has legal changes, an integrity check is performed on the files in the container image that has legal changes, and the corresponding part of the benchmark unbalanced binary hash tree in the whitelist is modified.

4. The container image trust measurement method combining linear chain and unbalanced binary tree according to claim 1 is characterized in that: The unbalanced binary hash tree is constructed according to the existing container image, specifically including: Calculate each file of each existing container image and perform hash operation, build a linear hash value link for each container image, and obtain the hash value of each container image; A linear chain is used to obtain the hash value of each container image, and the hash value is used as a leaf node to build an unbalanced binary hash tree.

5. The container image trust measurement method combining linear chain and unbalanced binary tree according to claim 1 is characterized in that: The tampering location detection of the container image specifically includes: Find a node of the unbalanced binary hash tree having a different hash value from a node of the benchmark unbalanced binary hash tree; Determine whether the node is a leaf node. If the number of existing container images is 1, the root node is a leaf node. Otherwise, determine whether the node has child nodes. If the node is a leaf node, the file of the container image corresponding to the leaf node has been tampered with; If the node is not a leaf node, the left child node of the node is compared with the corresponding left child node of the benchmark unbalanced binary hash tree, and the right child node of the node is compared with the corresponding right child node of the benchmark unbalanced binary hash tree; If the hash value of the left child node of the node is the same as the hash value of the corresponding left child node of the reference unbalanced binary hash tree, it is considered that the file of the container image corresponding to the left child node of the node has not been tampered with; If the hash value of the right child node of the node is the same as the hash value of the corresponding right child node of the reference unbalanced binary hash tree, it is considered that the file of the container image corresponding to the right child node of the node has not been tampered with; If the hash value of the left child node of the node is different from the hash value of the corresponding left child node of the benchmark unbalanced binary hash tree, or the hash value of the right child node of the node is different from the hash value of the corresponding right child node of the benchmark unbalanced binary hash tree, then the node of the unbalanced binary hash tree whose hash value is different from that of the node of the benchmark unbalanced binary hash tree is returned until the leaf node corresponding to the file of the tampered container image is located.

6. A container image trust measurement device combining a linear chain and an unbalanced binary tree, characterized in that: include: A construction module for building an unbalanced binary hash tree from an existing container image; A comparison module, configured to compare the root node of the unbalanced binary hash tree with the root node of a benchmark unbalanced binary hash tree in a whitelist; A confirmation module, configured to determine that the container image has not been tampered with when the hash value of the root node of the unbalanced binary hash tree is the same as the hash value of the root node of the reference unbalanced binary hash tree; A positioning detection module is used to perform tampering positioning detection on the container image when the hash value of the root node of the unbalanced binary hash tree is different from the hash value of the root node of the reference unbalanced binary hash tree.

7. The container image trust measurement device combining linear chain and unbalanced binary tree according to claim 6 is characterized in that: Also included is a whitelist creation module, the whitelist creation module comprising: A basic hash value forming unit, used to perform a hash operation on each file in the container image, construct a linear hash value link, and form a basic hash value of the container image; A benchmark construction unit, used to obtain a base hash value of each container image in a linear chain manner, and construct an unbalanced binary hash tree using the base hash value as a leaf node; The adding unit is used to store the unbalanced binary hash tree as a reference unbalanced binary hash tree into a whitelist.

8. The container image trust measurement device combining linear chain and unbalanced binary tree according to claim 6 is characterized in that: Also includes a monitoring module, the monitoring module includes: A legal change judgment unit, used to judge whether the content of the container image has legally changed; The modification unit is used to perform an integrity check on the files in the container image that has undergone legal changes when the content of the container image has undergone legal changes, and to modify the corresponding part of the benchmark unbalanced binary hash tree in the whitelist.

9. The container image trust measurement device combining linear chain and unbalanced binary tree according to claim 6, characterized in that: The building blocks include: A hash calculation unit is used to perform hash operations on each file of each existing container image, build a linear hash value link for each container image, and obtain the hash value of each container image; The construction unit is used to obtain the hash value of each container image in a linear chain manner, and use the hash value as a leaf node to construct an unbalanced binary hash tree.

10. The container image trust measurement device combining linear chain and unbalanced binary tree according to claim 6, characterized in that: The positioning detection module comprises: A search unit, configured to find a node of the unbalanced binary hash tree having a hash value different from that of a node of the reference unbalanced binary hash tree; A leaf node judgment unit is used to judge whether the node is a leaf node. If the number of existing container images is 1, the root node is a leaf node. Otherwise, it is judged whether the node has child nodes. If there are no child nodes, it is a leaf node. A first confirmation unit, configured to confirm, when the node is a leaf node, that a file of a container image corresponding to the leaf node has been tampered with; A child node comparison unit, configured to compare the left child node of the node with the corresponding left child node of the reference unbalanced binary hash tree, and compare the right child node of the node with the corresponding right child node of the reference unbalanced binary hash tree when the node is not a leaf node; A second confirmation unit is used to consider that the file of the container image corresponding to the left child node of the node has not been tampered with when the hash value of the left child node of the node is the same as the hash value of the corresponding left child node of the reference unbalanced binary hash tree; A third confirmation unit is used to consider that the file of the container image corresponding to the right child node of the node has not been tampered with when the hash value of the right child node of the node is the same as the hash value of the corresponding right child node of the reference unbalanced binary hash tree; A return unit is used to return the node of the unbalanced binary hash tree whose hash value is different from that of the node of the benchmark unbalanced binary hash tree, until a leaf node corresponding to the file of the tampered container image is located, if the hash value of the left child node of the node is different from the hash value of the corresponding left child node of the benchmark unbalanced binary hash tree, or the hash value of the right child node of the node is different from the hash value of the corresponding right child node of the benchmark unbalanced binary hash tree.

11. 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 container image trust measurement method combining a linear chain and an unbalanced binary tree as described in any one of claims 1 to 5 are implemented.

12. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the container image trust measurement method combining a linear chain and an unbalanced binary tree as described in any one of claims 1 to 5 are implemented.