Container runtime mandatory access control method, system and device and storage medium

Through eBPF dynamic mounting and sequence diagram analysis, combined with multi-level mitigation strategies, the observability and performance issues of the container mandatory access control system in the Kubernetes environment are solved, real-time defense against container attacks and discovery of potential risks are achieved, improving efficiency Container security and system stability.

CN118627104APending Publication Date: 2024-09-10GUANGZHOU UNIVERSITY
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410242660.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-03-04
Publication Date
2024-09-10

AI Technical Summary

Technical Problem

The existing container runtime mandatory access control system has problems with weak observability, poor performance, and the inability to dynamically respond to changes in security requirements in the Kubernetes environment, resulting in the inability to effectively defend against container attacks and detect potential risks.

Method used

By obtaining the user space policy file, dynamically mount eBPF, generate container feature matching functions and parameter filtering functions, combined with sequence diagram analysis, implement multi-level mitigation of container runtime mandatory access control, dynamically block attacks and analyze potential risks.

Benefits of technology

It improves the security of containers, implements dynamic support for responding to real-time vulnerabilities and changes in security requirements, enhances the ability to observe the security status of Kubernetes clusters, prevents attacks, and improves system stability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118627104A
    Figure CN118627104A
Patent Text Reader

Abstract

The invention discloses a mandatory access control method, system and device during container runtime and a storage medium, and the method comprises the steps: obtaining a first strategy file of a user space, carrying out eBPF dynamic mounting according to the first strategy file to obtain a target mounting point, and generating a container feature matching function and a parameter filtering function in the user space; obtaining first data of the target Pod through the target mounting point, and performing time sequence diagram analysis on the target Pod according to the first data to obtain a state observation result of the target Pod; and obtaining a preset escape right-extracting strategy, and performing mandatory access control during container operation of multi-stage remission according to the escape right-extracting strategy, the container feature matching function, the parameter filtering function and the state observation result. Prevention before an attacker initiates an attack, blocking during attack initiation and analysis after attack initiation are realized, the security of the container is improved, and the method can be widely applied to the technical field of container security.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of container security technology, and in particular to a method, system, device and storage medium for mandatory access control at container runtime. Background Art

[0002] In recent years, container technology has become one of the hot technologies in the field of cloud computing due to its efficient deployment and convenient management. As the de facto standard for container orchestration and management, Kubernetes has become the preferred platform for containerized applications. However, with the widespread application and growth of containers, the security issues of containers have become increasingly prominent, especially in Kubernetes clusters, where the security issues of containers are more complicated.

[0003] Compared with traditional virtual machines and physical machine environments, containers face greater risks due to their different architectures and characteristics. First, containers share host kernel, file system, network and other resources, increasing the attack surface, and once the container is hacked by an attacker, the processes running on the host may also be at risk. Second, containers may introduce vulnerabilities when they are built, such as unreviewed software packages during the build process, malicious code embedded in the container image, and so on.

[0004] In Kubernetes, Pod is the basic scheduling unit of Kubernetes. Pod manages multiple containers running on the same node, sharing the resources of the underlying host operating system and interacting with other nodes in a complex manner. Therefore, in Kubernetes, it is crucial to ensure the security of containers. For example, if there is an escaped container in the Kubernetes cluster, other containers in the cluster will also be threatened, which may have a serious impact on the stability and security of the entire system, leading to sensitive data leakage, system crashes and other problems.

[0005] According to the "Tencent Cloud Container Security White Paper", Tencent Cloud Container Security Service monitored 840,000 suspicious container escape behaviors in 2021 and detected 901 Trojan horse incidents in containers. The rest included 134,000 rebound shell behaviors, 270,000 high-risk system calls, and other suspicious runtime intrusion behaviors.

[0006] Tencent Security continuously tracks and captures ongoing attacks on containers in the wild by deploying a large number of simulated container services on the Internet. In September 2021 alone, Tencent Cloud Security Monitoring captured 108,000 attacks on containers in the wild, with the IP sources of the container attacks coming from China (70,619 times), followed by Russia (11,220 times) and the United States (7,139 times). According to the container in-the-wild attack monitoring data, there are a large number of continuous vulnerability detections and intrusions against container services on the Internet, including unauthorized access detection for containers, container login attempts, and other behaviors. Attackers then use exposed container vulnerabilities, container configuration defects, and other means to launch deeper intrusions into containers, thereby threatening Kubernetes clusters.

[0007] The current research hotspot is to ensure container security through mandatory access control technology. Mandatory access control at container runtime refers to restricting access to processes, files, networks and other resources inside the container during container runtime to protect the container environment, which can effectively reduce the risks brought by the various threats currently faced by containers. However, compared with traditional host scenarios, containers in container scenarios, especially containers in Kubernetes environments, are different in architecture and characteristics, so how to better implement mandatory access control technology for container scenarios is a current research hotspot.

[0008] Current mandatory access control systems rely mainly on the following methods, and there are certain problems:

[0009] 1) Based on Capabilities and Seccomp: Capabilities and Seccomp have similar problems. First, users need to have rich experience in configuring the access control granularity of Capabilities and Seccomp. Otherwise, the configuration may be too loose, resulting in a large attack surface, or too strict configuration may cause the application to fail to run. Secondly, in the actual Kubernetes scenario, the large number of containers in the cluster will make it impossible to manually manage and configure Capabilities and Seccomp, and the normal containers in the cluster cannot defend against attacks from other containers that have escaped.

[0010] 2) Based on Linux Security Module: First, the Linux Security Module was born before the container, so it has limited support for containers at the hook point and weak restrictions on containers. Second, the solution based on the Linux Security Module is essentially a Linux kernel module, so user policies cannot be dynamically updated when the container is running, and as a kernel module, once a crash occurs, it may cause the crash of the entire Kubernetes cluster.

[0011] 3) Based on eBPF: Although eBPF has more hook mounting capabilities and programmability than Linux security modules, first of all, the use of eBPF hook mounting still needs to be mounted in advance, that is, the hooks that users can operate are pre-set during system development. For example, if the system developer writes an eBPF program for the __x64_sys_write function, then the user can only complete the policy configuration through the capabilities provided by this program, such as killing the process when the function parameter is equal to a certain value. Therefore, if there is a more fine-grained security requirement change, such as the scope of the updated vulnerability exceeds the pre-mounted hook, it is impossible to dynamically complete the policy change. Secondly, the pre-mounted hook still depends on the mandatory access control system designer, and cannot provide most of the dynamic capabilities and possible performance losses for expert users.

[0012] As can be seen from the above, the current mandatory access control system has the problems of weak observability, poor performance and inability to detect potential risks. Traditionally, LD_PRELOAD or ptrace is still used to track containers. Although LD_PRELOAD is more transparent and efficient, it can be bypassed by static linking of the application. Ptrace is more powerful in observability, but its disadvantage is that it has a large overhead and is not suitable for most scenarios. Both of them track at the system call level and cannot perceive kernel events. After the introduction of eBPF, the observability and performance of containers have been greatly improved, but the same problems exist as the use of eBPF in mandatory access control. The traditional observation method mainly relies on the judgment of system designers and users on system risks. This method is too dependent on the experience level of designers and users. The performance of providing users with the status of Pods and their Pods is mainly limited by the poor performance of the current observation method. If eBPF is used, due to the limitations of eBPF mentioned above, it will still provide users with status monitoring with too much data noise, so it is impossible to analyze and respond to real-time vulnerabilities and discover potential risks, affecting the security of containers. Summary of the invention

[0013] The purpose of the present invention is to solve one of the technical problems existing in the prior art to at least a certain extent.

[0014] To this end, an object of an embodiment of the present invention is to provide a method for mandatory access control during container runtime, which improves the security of the container.

[0015] Another object of an embodiment of the present invention is to provide a container runtime mandatory access control system.

[0016] In order to achieve the above technical objectives, the technical solutions adopted by the embodiments of the present invention include:

[0017] In a first aspect, an embodiment of the present invention provides a container runtime mandatory access control method, comprising the following steps:

[0018] Obtain a first policy file in the user space, perform eBPF dynamic mounting according to the first policy file to obtain a target mount point, and generate a container feature matching function and a parameter filtering function in the user space;

[0019] Acquire first data of the target Pod through the target mount point, and perform a timing diagram analysis on the target Pod according to the first data to obtain a state observation result of the target Pod;

[0020] Obtain a preset privilege escalation escape strategy, and perform mandatory access control on the container runtime with multi-level mitigation according to the privilege escalation escape strategy, the container feature matching function, the parameter filtering function, and the state observation result.

[0021] Further, in one embodiment of the present invention, the step of obtaining the first policy file of the user space is specifically as follows:

[0022] Obtain the first policy file issued by the user space through Kubernetes / network;

[0023] or,

[0024] The first policy file uploaded locally by the user space is obtained.

[0025] Further, in one embodiment of the present invention, the step of performing eBPF dynamic mounting according to the first policy file to obtain a target mount point, and generating a container feature matching function and a parameter filtering function in the user space specifically includes:

[0026] Performing syntax analysis on the first policy file to obtain a mounting method corresponding to the first policy file;

[0027] Determine a corresponding mount probe according to the mount mode, and perform eBPF dynamic mount on the first policy file through the mount probe to obtain the target mount point;

[0028] A container feature matching function and a parameter filtering function are generated in the user space based on the eBPF tail call mechanism.

[0029] Further, in one embodiment of the present invention, the step of performing eBPF dynamic mounting according to the first policy file to obtain a target mount point and generating a container feature matching function and a parameter filtering function in the user space further includes:

[0030] Generate a custom protocol data packet, the custom protocol data packet including a preset permission change strategy, a parameter monitoring strategy, an alarm operation strategy, and a function parameter type of the target mount point;

[0031] The custom protocol data packet is sent to the kernel space.

[0032] Further, in one embodiment of the present invention, the step of acquiring first data of the target Pod through the target mount point, and performing a timing diagram analysis on the target Pod according to the first data to obtain a state observation result of the target Pod specifically includes:

[0033] Collecting data from the target Pod through the target mount point to obtain the first data;

[0034] Classify and label the first data to obtain second data, and store the second data in kernel space;

[0035] The kernel space is accessed through a timing graph analysis module to obtain the second data, and a timing graph analysis is performed on the target Pod according to the second data, thereby generating a visualized state observation result.

[0036] Further, in one embodiment of the present invention, the step of acquiring first data of the target Pod through the target mount point, and performing a timing diagram analysis on the target Pod according to the first data to obtain a state observation result of the target Pod further includes:

[0037] The kernel data structure of the kernel space is exported, and the kernel data structure is type-converted and then mapped to the timing diagram analysis module.

[0038] Further, in one embodiment of the present invention, the step of performing multi-level mitigation container runtime mandatory access control according to the escape privilege escalation strategy, the container feature matching function, the parameter filtering function and the state observation result specifically includes:

[0039] Implement prevention before launching an attack according to the escape and privilege escalation strategy;

[0040] Implementing blocking in launching attacks according to the container feature matching function and the parameter filtering function;

[0041] The analysis after the attack is launched is implemented according to the state observation result.

[0042] In a second aspect, an embodiment of the present invention provides a container runtime mandatory access control system, including:

[0043] A dynamic mounting module, used to obtain a first policy file in the user space, perform eBPF dynamic mounting according to the first policy file to obtain a target mount point, and generate a container feature matching function and a parameter filtering function in the user space;

[0044] A state observation module, used to obtain first data of the target Pod through the target mount point, and perform a timing diagram analysis on the target Pod according to the first data to obtain a state observation result of the target Pod;

[0045] A multi-level mitigation module is used to obtain a preset escape escalation strategy, and perform multi-level mitigation container runtime mandatory access control according to the escape escalation strategy, the container feature matching function, the parameter filtering function and the state observation result.

[0046] In a third aspect, an embodiment of the present invention provides a container runtime mandatory access control device, including:

[0047] at least one processor;

[0048] at least one memory for storing at least one program;

[0049] When the at least one program is executed by the at least one processor, the at least one processor implements the above-mentioned container runtime mandatory access control method.

[0050] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, which stores a program executable by a processor, and the program executable by the processor is used to execute the above-mentioned container runtime mandatory access control method when executed by the processor.

[0051] The advantages and beneficial effects of the present invention will be partly given in the following description, partly become apparent from the following description, or be understood through the practice of the present invention:

[0052] The embodiment of the present invention optimizes the use of eBPF in a mandatory access control system, so that eBPF can have stronger dynamic capabilities to support the response to real-time vulnerabilities and changes in security requirements. Compared with traditional mandatory access control systems based on LSM, it has stronger restriction capabilities on containers and higher stability. It solves the problems that the existing methods have poor performance and the simple use of eBPF will provide users with status monitoring with too much or too little data noise, resulting in the inability to provide cluster security status observation information to help users analyze and respond to real-time vulnerabilities and discover potential risks. Through the container runtime mandatory access control method with multi-level mitigation, prevention before the attacker launches an attack, blocking during the attack, and analysis after the attack are achieved, thereby improving the security of the container. BRIEF DESCRIPTION OF THE DRAWINGS

[0053] In order to more clearly illustrate the technical solution in the embodiments of the present invention, the following introduction is made to the drawings required for use in the embodiments of the present invention. It should be understood that the drawings introduced below are only for the convenience of clearly describing some embodiments of the technical solution of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.

[0054] Figure 1 A flowchart of a method for mandatory access control at container runtime provided by an embodiment of the present invention;

[0055] Figure 2 A schematic diagram of an application scenario of a container runtime mandatory access control method provided by an embodiment of the present invention;

[0056] Figure 3 A schematic diagram of eBPF dynamic mounting provided by an embodiment of the present invention;

[0057] Figure 4 A schematic diagram of a flow chart of a timing diagram analysis provided by an embodiment of the present invention;

[0058] Figure 5 A schematic diagram of a container runtime mandatory access control with multi-level mitigation provided by an embodiment of the present invention;

[0059] Figure 6 A structural block diagram of a container runtime mandatory access control system provided by an embodiment of the present invention;

[0060] Figure 7 A structural block diagram of a container runtime mandatory access control device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0061] The embodiments of the present invention are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and are not to be construed as limitations of the present invention. For the step numbers in the following embodiments, they are only provided for the convenience of explanation, and the order between the steps is not limited in any way, and the execution order of each step in the embodiment can be adaptively adjusted according to the understanding of those skilled in the art.

[0062] In the description of the present invention, the meaning of "a plurality" is two or more than two. If there is a description of "a first" or "a second", it is only used for the purpose of distinguishing technical features, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features or implicitly indicating the order of the indicated technical features. In addition, unless otherwise defined, all technical and scientific terms used in this document have the same meaning as those commonly understood by those skilled in the art.

[0063] like Figure 2 The figure shows a schematic diagram of an application scenario of a container runtime mandatory access control method provided by an embodiment of the present invention. The embodiment of the present invention unifies the routing of the eBPF Hook points and completes the function distribution from the user space to the kernel space, so as to realize the ability of dynamic eBPF mounting for users, and thereby realize a mandatory access control system with stronger container restriction capability and more stable; based on the optimized eBPF and timing diagram, the problem of not being able to observe the state of the cluster well in the past is solved, and the user is provided with a timing and correlation visualization analysis of the Pod itself and its behavior with other Pods, and thereby automatically configures security policies for extremely dangerous operations such as imperceptible Namespace escape and Capabilities privilege escalation for users, so as to protect the security of the container from the prevention before the attacker launches the attack, the blocking during the attack, and the analysis after the attack is launched in a process different from the previous traditional solutions.

[0064] Reference Figure 1 , an embodiment of the present invention provides a container runtime mandatory access control method, which specifically includes the following steps:

[0065] S101. Obtain a first policy file in the user space, perform eBPF dynamic mounting according to the first policy file to obtain a target mount point, and generate a container feature matching function and a parameter filtering function in the user space.

[0066] As an optional implementation, the step of obtaining the first policy file of the user space is specifically as follows:

[0067] S1011. Obtain the first policy file issued by the user space through Kubernetes / network;

[0068] or,

[0069] S1012: Obtain the first policy file uploaded locally by the user space.

[0070] As an optional implementation, the step of performing eBPF dynamic mounting according to the first policy file to obtain the target mount point and generating a container feature matching function and a parameter filtering function in the user space specifically includes:

[0071] S1013, performing syntax analysis on the first policy file to obtain a mounting method corresponding to the first policy file;

[0072] S1014, determining a corresponding mount probe according to the mount mode, and performing eBPF dynamic mount on the first policy file through the mount probe to obtain a target mount point;

[0073] S1015. Generate a container feature matching function and a parameter filtering function in the user space based on the eBPF tail call mechanism.

[0074] Further as an optional implementation, the step of performing eBPF dynamic mounting according to the first policy file to obtain a target mount point, and generating a container feature matching function and a parameter filtering function in the user space, further includes:

[0075] S1016. Generate a custom protocol data packet, where the custom protocol data packet includes a preset permission change strategy, a parameter monitoring strategy, an alarm operation strategy, and a function parameter type of a target mount point;

[0076] S1017. Send the custom protocol data packet to the kernel space.

[0077] Specifically, Figure 3 The figure shows a schematic diagram of the dynamic mounting of eBPF provided by an embodiment of the present invention. First, the policy file will be sent down in the user space through Kubernetes or the network, or the policy file will be directly uploaded locally, and then the policy analysis module will be entered to perform syntax analysis on the policy file, and different eBPF Hook methods will be distinguished, so as to load them into different probe modules for processing. After that, although each mount point is different, all the mount points required by the user will be mounted to the same virtual universal mount point through unified routing, that is, we will parse the matching parameters (process name, namespace, path, five-tuple, etc.), Filters logic, etc. and write them into eBPF. BTF object, and before mounting the eBPF program, the eBPF bytecode file information required by this kprobe or tracepoint needs to be set in advance (precompilation is required). When mounting, it can be relocated to the general mount point through the Linux kernel, so that users can dynamically add mount points and perform corresponding restricted operations when the mandatory access control system is running. However, this method needs to solve two important problems. The first problem is that the unified routing method will cause the virtual general mount point to lose the parameters of the original Hook point function. The other is that because the eBPF program needs to be precompiled, it is impossible to perform specialized operations on the current Hook function. So the following two methods are used here to solve these two problems.

[0078] In view of the problem that the virtual universal mount point loses the parameters of the original Hook point function, the embodiment of the present invention proposes a communication mechanism between the user state and the kernel state based on the eBPF Map, that is, after the policy module parses the policy file, a custom protocol data packet will be generated, and the data packet will contain the user's policy information on the change of Capabilities and Namespaces permissions and what kind of restrictions and alarm operations should be performed when the parameters of concern are monitored. The key is that the data packet contains not only the user's policy information, but also the type information of the current Hook function parameters. It is necessary to create filter_map and tail_call eBPF Map and load its current protocol data packet into the eBPF Map in the kernel. Therefore, the user needs to set the type information of the parameters of the Hook function of concern in advance. The practical premise here is that all composite data structures are composed of basic data types, so a limited number of parsing can be performed in the protocol analysis module to obtain all type information, and when performing restriction operations, the information we are concerned about is often represented by basic types. Therefore, when designing the protocol data packet, it is necessary to consider the storage of variable-length data in advance.

[0079] In view of the problem that the current Hook function cannot be specialized, the embodiment of the present invention proposes a function distribution method to distribute functions from user state to kernel state. After the policy module parses the policy file, it will generate and load the container feature matching function and parameter filtering function in the user space. For this reason, we summarize the restriction operations on the container based on the current Common Vulnerabilities and Exposures (CVE) about the container, including the matching of process ID, the change of Capabilities and Namespaces permissions, and the filtering and waiting of parameters, but in general, there are limited and quite common features. So, for example, when the user configures blocking three features and filtering two parameters in the policy file, the system will load the corresponding five functions into the kernel space. In addition, because eBPF does not allow non-eBPF programs to be called in the kernel space, the tail call mechanism of eBPF is required to complete the call of these five functions. Finally, when the system passes the Hook point, it will perform feature matching and parameter filtering operations to complete the mandatory access control of the container.

[0080] S102. Acquire first data of the target Pod through the target mount point, and perform a timing diagram analysis on the target Pod according to the first data to obtain a status observation result of the target Pod.

[0081] Further as an optional implementation, the step of obtaining the first data of the target Pod through the target mount point, and performing a timing diagram analysis on the target Pod according to the first data to obtain the state observation result of the target Pod specifically includes:

[0082] S1021. Collect data from the target Pod through the target mount point to obtain first data;

[0083] S1022, classify and label the first data to obtain second data, and store the second data into the kernel space;

[0084] S1023. Access the kernel space through the timing graph analysis module to obtain the second data, and perform a timing graph analysis on the target Pod according to the second data, thereby generating a visualized state observation result.

[0085] Further as an optional implementation manner, the step of obtaining the first data of the target Pod through the target mount point, and performing a timing diagram analysis on the target Pod according to the first data to obtain a state observation result of the target Pod also includes:

[0086] S1024, exporting the kernel data structure of the kernel space, performing type conversion on the kernel data structure and then mapping it to the timing diagram analysis module.

[0087] Specifically, Figure 4 The flowchart of the timing diagram analysis provided by the embodiment of the present invention is shown. Based on the above method, the Hook point configured by the user's policy is used to collect data from the currently active Pod, and then the collected data is preliminarily analyzed, that is, the data is annotated and classified, and then passed to the eBPF Map for storage. Then our timing diagram analysis module will access the eBPF Map in the kernel, obtain the data, perform timing analysis on a single Pod, and wait for the timing analysis results of other Pods to perform correlation analysis, and finally output the visualized content for the user's analysis. There will also be a type conversion before the timing analysis is performed here, which is also a problem that needs to be solved. The embodiment of the present invention exports all kernel data structures of the Linux kernel according to vmlinux.h and maps it to our system. In addition, it can also support composite data structures by extending our previous custom protocol, because any composite data structure is a basic data type to the last layer, but this method requires the user to provide more information.

[0088] S103. Obtain a preset privilege escalation escape strategy, and perform mandatory access control on the container runtime with multi-level mitigation according to the privilege escalation escape strategy, container feature matching function, parameter filtering function, and state observation results.

[0089] As an optional implementation method, the step of performing multi-level mitigation of container runtime mandatory access control based on the escape privilege escalation strategy, container feature matching function, parameter filtering function and state observation results specifically includes:

[0090] S1031. Implement prevention before launching an attack based on the escape and privilege escalation strategy;

[0091] S1032. Blocking the attack is achieved according to the container feature matching function and the parameter filtering function.

[0092] S1033. Perform analysis after launching the attack based on the status observation results.

[0093] Specifically, Figure 5 The diagram shows a multi-level mitigation container runtime mandatory access control provided by an embodiment of the present invention. Based on the aforementioned method, a new multi-level mitigation container runtime mandatory access control system solution is proposed. The first level of mitigation in the solution is to automatically configure extremely dangerous strategies such as Namespace escape and Capabilities privilege escalation for users without perception. Different from the traditional method of using LSM or other kernel security, the eBPF method can achieve more fine-grained access control, that is, Namespace escape or Capabilities privilege escalation; the second level is to perform mandatory access control according to the user-defined policy file in S101, the core of which is the unified routing and function distribution optimized eBPF method; the third level is to provide users with a visual analysis of the timing and correlation of the Pod itself and its behavior with other Pods in S102, so as to protect the security of the container from the prevention before the attacker launches the attack, the blocking during the attack, and the analysis after the attack.

[0094] The above is a description of the method steps of the embodiment of the present invention. It can be understood that the embodiment of the present invention optimizes the use of eBPF in a mandatory access control system, so that eBPF can have stronger dynamic capabilities to support the response to real-time vulnerabilities and the requirements of changes in security requirements. Compared with the traditional mandatory access control system based on LSM, it has stronger restriction capabilities and higher stability for containers, and solves the problem that the existing method has poor performance and the use of eBPF alone will provide users with state monitoring with too much or too little data noise, resulting in the inability to provide cluster security status observation information to help users analyze and respond to real-time vulnerabilities and discover potential risks. Through the multi-level mitigation container runtime mandatory access control method, prevention before the attacker launches an attack, blocking during the attack, and analysis after the attack are achieved, thereby improving the security of the container.

[0095] Compared with the prior art, the embodiments of the present invention also have the following advantages:

[0096] 1) A mandatory access control method based on unified routing and function distribution, a cluster security status observation method based on eBPF and timing diagram, and a more fine-grained multi-level mitigation method based on eBPF are proposed. Traditional mandatory access control methods mainly use a single user policy to restrict containers / processes, which cannot provide a certain security capability for the entire attack process, and cannot dynamically face changes in security trends and fine-grained security requirements. Therefore, the present invention greatly improves the protection capability of the mandatory access control solution during traditional container runtime.

[0097] 2) Unified routing and function distribution avoids the need for pre-mounting when using eBPF, enhancing its dynamic capabilities. It also uses it to implement a mandatory access control system. It solves the problem of insufficient container restriction capabilities of traditional Capabilities and Seccomp solutions and LSM-based methods, and has a certain degree of originality.

[0098] 3) The optimized eBPF is used to implement the observation method to provide users with cluster security status observation information so that they can analyze and respond to real-time vulnerabilities and discover potential risks. Traditionally, there is no cluster observation method, because providing users with the status of Pods and their Pods is mainly limited by the poor performance of current observation methods. If eBPF is used, due to the limitations of eBPF, there is still a state monitoring that provides users with too much or too little data noise. Therefore, the present invention can improve the security monitoring capability of the overall container runtime mandatory access control solution.

[0099] Reference Figure 6 , an embodiment of the present invention provides a container runtime mandatory access control system, including:

[0100] A dynamic mounting module is used to obtain a first policy file in the user space, perform eBPF dynamic mounting according to the first policy file to obtain a target mount point, and generate a container feature matching function and a parameter filtering function in the user space;

[0101] A status observation module is used to obtain first data of a target Pod through a target mount point, and perform a timing diagram analysis on the target Pod according to the first data to obtain a status observation result of the target Pod;

[0102] The multi-level mitigation module is used to obtain the preset escape and privilege escalation strategy, and perform multi-level mitigation container runtime mandatory access control based on the escape and privilege escalation strategy, container feature matching function, parameter filtering function and state observation results.

[0103] The contents of the above method embodiments are all applicable to the present system embodiments. The functions specifically implemented by the present system embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.

[0104] Reference Figure 7 , an embodiment of the present invention provides a container runtime mandatory access control device, comprising:

[0105] at least one processor;

[0106] at least one memory for storing at least one program;

[0107] When the at least one program is executed by the at least one processor, the at least one processor implements the container runtime mandatory access control method.

[0108] The contents of the above method embodiments are all applicable to the present device embodiments. The functions specifically implemented by the present device embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.

[0109] An embodiment of the present invention further provides a computer-readable storage medium, which stores a program executable by a processor. When the program executable by the processor is executed by the processor, it is used to execute the above-mentioned container runtime mandatory access control method.

[0110] A computer-readable storage medium in an embodiment of the present invention can execute a container runtime mandatory access control method provided by a method embodiment of the present invention, can execute any combination of implementation steps of the method embodiment, and has the corresponding functions and beneficial effects of the method.

[0111] The embodiment of the present invention also discloses a computer program product or a computer program, wherein the computer program product or the computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. A processor of a computer device can read the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes Figure 1 The method shown.

[0112] In some selectable embodiments, the function / operation mentioned in the block diagram may not occur in the order mentioned in the operation diagram. For example, depending on the function / operation involved, the two boxes shown in succession can actually be executed substantially simultaneously or the above-mentioned boxes can sometimes be executed in reverse order. In addition, the embodiment presented and described in the flow chart of the present invention is provided by way of example, for the purpose of providing a more comprehensive understanding of technology. The disclosed method is not limited to the operation and logic flow presented herein. Selectable embodiments are expected, wherein the order of various operations is changed and the sub-operation of a part for which is described as a larger operation is performed independently.

[0113] In addition, although the present invention is described in the context of functional modules, it should be understood that, unless otherwise specified to the contrary, one or more of the above-mentioned functions and / or features can be integrated into a single physical device and / or software module, or one or more functions and / or features can be implemented in a separate physical device or software module. It is also understood that a detailed discussion of the actual implementation of each module is unnecessary for understanding the present invention. More specifically, in view of the properties, functions and internal relationships of the various functional modules in the device disclosed herein, the actual implementation of the module will be understood within the conventional skills of the engineer. Therefore, those skilled in the art can implement the present invention set forth in the claims without excessive experimentation using ordinary techniques. It is also understood that the specific concepts disclosed are merely illustrative and are not intended to limit the scope of the present invention, which is determined by the full scope of the appended claims and their equivalents.

[0114] If the above functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the above methods of each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.

[0115] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in conjunction with such instruction execution systems, devices or apparatuses. For the purposes of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in conjunction with such instruction execution systems, devices or apparatuses.

[0116] More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (electronic device), a portable computer disk case (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and editable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be a paper or other suitable medium on which the above-mentioned program is printed, since the above-mentioned program can be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, deciphering or processing in other suitable ways as necessary, and then stored in a computer memory.

[0117] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, a plurality of steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.

[0118] In the above description of this specification, the description with reference to the terms "one embodiment / example", "another embodiment / example" or "certain embodiments / examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.

[0119] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the claims and their equivalents.

[0120] The above is a specific description of the preferred implementation of the present invention, but the present invention is not limited to the above embodiments. Those skilled in the art may make various equivalent modifications or substitutions without violating the spirit of the present invention. These equivalent modifications or substitutions are all included in the scope defined by the claims of this application.

Claims

1. A container runtime mandatory access control method, characterized in that: The following steps are involved: Obtain a first policy file in the user space, perform eBPF dynamic mounting according to the first policy file to obtain a target mount point, and generate a container feature matching function and a parameter filtering function in the user space; Acquire first data of the target Pod through the target mount point, and perform a timing diagram analysis on the target Pod based on the first data to obtain a status observation result of the target Pod; Obtain a preset escape and privilege escalation strategy, and perform multi-level mitigation container runtime mandatory access control based on the escape and privilege escalation strategy, the container feature matching function, the parameter filtering function, and the state observation result.

2. A container runtime mandatory access control method according to claim 1, characterized in that: The step of obtaining the first policy file of the user space is specifically as follows: Obtain the first policy file issued by the user space through Kubernetes / network; or, Acquire the first policy file uploaded locally by the user space.

3. A container runtime mandatory access control method according to claim 1, characterized in that: The step of performing eBPF dynamic mounting according to the first policy file to obtain a target mount point and generating a container feature matching function and a parameter filtering function in the user space specifically includes: Performing syntax analysis on the first policy file to obtain a mounting method corresponding to the first policy file; Determining a corresponding mount probe according to the mount mode, and performing eBPF dynamic mount on the first policy file through the mount probe to obtain the target mount point; The eBPF-based tail call mechanism generates a container feature matching function and a parameter filtering function in the user space.

4. A container runtime mandatory access control method according to claim 3, characterized in that: The step of performing eBPF dynamic mounting according to the first policy file to obtain a target mount point and generating a container feature matching function and a parameter filtering function in the user space further includes: Generate a custom protocol data packet, the custom protocol data packet including a preset permission change strategy, a parameter monitoring strategy, an alarm operation strategy, and a function parameter type of the target mount point; The custom protocol data packet is sent to the kernel space.

5. The method for mandatory access control during container runtime according to claim 1, wherein: The step of obtaining first data of the target Pod through the target mount point, and performing a timing diagram analysis on the target Pod according to the first data to obtain a status observation result of the target Pod specifically includes: Collecting data from the target Pod through the target mount point to obtain the first data; Classify and label the first data to obtain second data, and store the second data in kernel space; The kernel space is accessed through a timing diagram analysis module to obtain the second data, and a timing diagram analysis is performed on the target Pod according to the second data, thereby generating a visualized state observation result.

6. A container runtime mandatory access control method according to claim 5, characterized in that: The step of acquiring first data of the target Pod through the target mount point, and performing a timing diagram analysis on the target Pod based on the first data to obtain a status observation result of the target Pod further includes: The kernel data structure of the kernel space is exported, and the kernel data structure is type-converted and then mapped to the timing diagram analysis module.

7. A container runtime mandatory access control method according to any one of claims 1 to 6, characterized in that: The step of performing multi-level mitigation container runtime mandatory access control based on the escape privilege escalation strategy, the container feature matching function, the parameter filtering function, and the state observation result specifically includes: Implementing prevention before launching an attack based on the escape and privilege escalation strategy; Blocking the attack according to the container feature matching function and the parameter filtering function; An analysis after launching the attack is performed based on the state observation result.

8. A container runtime mandatory access control system, characterized in that: include: A dynamic mounting module is used to obtain a first policy file in the user space, perform eBPF dynamic mounting according to the first policy file to obtain a target mount point, and generate a container feature matching function and a parameter filtering function in the user space; A status observation module is configured to obtain first data of a target Pod through the target mount point, and perform a timing diagram analysis on the target Pod based on the first data to obtain a status observation result of the target Pod; A multi-level mitigation module is used to obtain a preset escape and privilege escalation strategy, and perform multi-level mitigation container runtime mandatory access control based on the escape and privilege escalation strategy, the container feature matching function, the parameter filtering function and the state observation results.

9. A container runtime mandatory access control device, characterized in that: include: at least one processor; at least one memory for storing at least one program; When the at least one program is executed by the at least one processor, the at least one processor implements the container runtime mandatory access control method according to any one of claims 1 to 7.

10. A computer-readable storage medium storing a program executable by a processor, characterized in that: The processor-executable program is used to execute a container runtime mandatory access control method according to any one of claims 1 to 7 when executed by the processor.

Citation Information

Cited By

  • File protection method and apparatus, system, device, storage medium and program product

    WO2026108470A1