Target calling behavior determination method and device, equipment and computer storage medium
By vectorized conversion of the container's function call sequence and encoding and decoding of the autoencoder model, the container exception behavior is identified, which solves the problem of failure to identify unknown exception behavior in the prior art, and improves detection accuracy and container security.
Patent Information
- Application Number
- CN202410921204.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-10
- Publication Date
- 2024-11-22
AI Technical Summary
In the prior art, when detecting container exception calling behavior, unknown exception calling behavior cannot be recognized, resulting in low detection accuracy.
By obtaining the function call sequence of the target container, performing vectorized transformation, and using the encoding and decoding of the autoencoder model to identify the exception calling behavior, and identifying the exception behavior based on the unsupervised learning model itself, rather than relying on known kernel system functions.
It improves the accuracy of abnormal call behavior detection, not only can identify known abnormal behavior, but also can detect unknown abnormal behavior, enhancing the container's safe detection capability.
Smart Images

Figure CN119011186A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of computer security technology, and in particular, relates to a method, device, equipment and computer storage medium for determining a target calling behavior. Background Art
[0002] With the rapid development of cloud computing technology, more and more companies are choosing to migrate their businesses to the cloud and deploy services in lightweight and fast containers. Containers (such as Docker and Kubernetes) share the kernel with the host. Once abnormal calling behavior occurs, security incidents such as data leakage may occur, and even lateral spread may occur, thereby endangering all containers in the host or the entire container cluster. Therefore, it is crucial to detect abnormal calling behavior in containers.
[0003] In the prior art, samples are usually constructed using call sequences of target kernel system functions, and traditional supervised learning classification models are trained. The trained model is used to detect whether there is call information of the target kernel system function in the container. When the call information of the target kernel system function or a kernel system function similar to the target kernel system function is detected, it is determined that the container has abnormal call behavior. However, this detection method can only detect known abnormal call behaviors, and cannot identify the presence of unknown abnormal call behaviors, and the accuracy of abnormal call behavior detection is low. Summary of the invention
[0004] The embodiments of the present application provide a method, apparatus, device and computer storage medium for determining a target call behavior, which can not only identify known abnormal call behaviors, but also detect situations where unknown abnormal call behaviors exist, thereby improving the accuracy of abnormal call behavior detection.
[0005] In a first aspect, an embodiment of the present application provides a method for determining a target calling behavior, including:
[0006] Acquire a first function call sequence of the target container, where the first function call sequence includes a plurality of kernel system function call information, and each kernel system function call information includes a kernel system function and a call time;
[0007] Performing vectorization conversion on the first function call sequence to obtain a first function call sequence vector;
[0008] Inputting the first function call sequence vector into the behavior detection model, encoding the first function call sequence vector using an encoder in the behavior detection model to obtain an encoding vector, and decoding the encoding vector using a decoder in the behavior detection model to obtain a reconstructed function call sequence vector;
[0009] When the difference between the first function call sequence vector and the reconstructed function call sequence vector is greater than a first preset value, it is determined that the target call behavior exists in the first function call sequence of the target container.
[0010] In a possible implementation, performing vectorization conversion on the first function call sequence to obtain a first function call sequence vector includes:
[0011] Add a flag bit at a preset position of the first function call sequence to obtain a second function call sequence;
[0012] Determine a word vector sequence of a second function call sequence by using a mapping relationship between a preset kernel system function and a preset word vector and a mapping relationship between a preset flag bit and a preset word vector;
[0013] Using a preset bidirectional encoder model, vectorize the word vector sequence of the second function call sequence to obtain a second function call sequence vector;
[0014] The vector corresponding to the flag bit in the second function call sequence vector is deleted to obtain the first function call sequence vector.
[0015] In one possible implementation, before inputting the function call sequence vector into the behavior detection model, the method further includes:
[0016] Acquire a function call sequence sample of the target container, the function call sequence sample including a plurality of kernel system function call information samples, each kernel system function call information including a kernel system function sample and a call time sample;
[0017] Performing vectorization conversion on the function call sequence samples to obtain function call sequence vector samples;
[0018] Inputting the function call sequence vector sample into the initial behavior detection model, encoding the function call sequence vector sample using the initial encoder in the initial behavior detection model to obtain an encoded vector sample, and decoding the encoded vector sample using the initial decoder in the initial behavior detection model to obtain a reconstructed function call sequence vector sample;
[0019] Determine the loss value of the initial behavior detection model according to the function call sequence vector sample and the reconstructed function call sequence vector sample;
[0020] When the loss value of the initial behavior detection model does not meet the training stop condition, the parameters of the initial encoder and the initial decoder in the initial behavior detection model are updated to obtain an updated initial behavior detection model, the function call sequence vector samples are input into the updated initial behavior detection model, and the reconstructed function call sequence vector samples are updated until the loss value of the initial behavior detection model meets the training stop condition to obtain the behavior detection model.
[0021] In a possible implementation, when the difference between the first function call sequence vector and the reconstructed function call sequence vector is greater than a first preset value, determining that the target call behavior exists in the first function call sequence of the target container includes:
[0022] Determine the difference between the first function call sequence vector and the reconstructed function call sequence vector as a target reconstruction error value;
[0023] According to the relationship between the preset reconstruction error value and the preset target call behavior level, the target call behavior level corresponding to the target reconstruction error value is determined, which is the target level of the target call behavior existing in the first function call sequence. The preset reconstruction error value includes the target reconstruction error value, and the preset target call behavior level includes the target level.
[0024] In a possible implementation, after determining, according to the relationship between the preset reconstruction error value and the preset target call behavior level, that the target call behavior level corresponding to the target reconstruction error value is the target level of the target call behavior existing in the first function call sequence of the target container, the method further includes:
[0025] According to the relationship between the preset target calling behavior level and the alarm push method, determine the target alarm push method corresponding to the target level;
[0026] Use the target alarm push method to send alarm information to the target device.
[0027] In a possible implementation, obtaining a first function call sequence of a target container includes:
[0028] Get the initial function call sequence of the target container;
[0029] A first function calling sequence consistent with a preset kernel system function is extracted from the initial function calling sequence.
[0030] In a second aspect, an embodiment of the present application provides a device for determining a target calling behavior, including:
[0031] An acquisition module, used to acquire a first function call sequence of a target container, where the first function call sequence includes a plurality of kernel system function call information, and each kernel system function call information includes a kernel system function and a call time;
[0032] A conversion module, used for performing vectorization conversion on the first function call sequence to obtain a first function call sequence vector;
[0033] A determination module is used to input the first function call sequence vector into the behavior detection model, encode the first function call sequence vector using an encoder in the behavior detection model to obtain an encoding vector, and decode the encoding vector using a decoder in the behavior detection model to obtain a reconstructed function call sequence vector;
[0034] The determination module is further configured to determine that there is a target call behavior in the first function call sequence of the target container when the difference between the first function call sequence vector and the reconstructed function call sequence vector is greater than a first preset value.
[0035] In a third aspect, an embodiment of the present application provides an electronic device, the device comprising:
[0036] a processor and a memory storing computer program instructions;
[0037] A method for determining a target calling behavior to implement any of the above items when a processor executes computer program instructions.
[0038] In a fourth aspect, an embodiment of the present application provides a computer storage medium, on which computer program instructions are stored. When the computer program instructions are executed by a processor, a method for determining a target calling behavior of any one of the above items is implemented.
[0039] In a fifth aspect, an embodiment of the present application provides a computer program product, characterized in that when the instructions in the computer program product are executed by a processor of an electronic device, the electronic device is enabled to execute any of the above-mentioned methods for determining the target calling behaviors.
[0040] The method, apparatus, device and computer storage medium for determining target call behavior of the embodiments of the present application include: obtaining a first function call sequence of a target container, the first function call sequence including multiple kernel system function call information, each kernel system function call information including a kernel system function and a call time; performing vectorization conversion on the first function call sequence to obtain a first function call sequence vector; inputting the first function call sequence vector into a behavior detection model, encoding the first function call sequence vector using an encoder in the behavior detection model to obtain an encoding vector, and decoding the encoding vector using a decoder in the behavior detection model to obtain a reconstructed function call sequence vector; and determining that the target call behavior exists in the first function call sequence of the target container when the difference between the first function call sequence vector and the reconstructed function call sequence vector is greater than a first preset value.
[0041] In this way, the kernel system function call sequence vector corresponding to the kernel system function call sequence of the target container is reconstructed by utilizing the encoding and decoding of the target call behavior detection model. When the reconstruction error is large, it indicates that an abnormal call behavior has occurred in the target container. That is, based on the unsupervised target call behavior detection model, the kernel system function call sequence of the target container itself is utilized to identify abnormal call behavior, rather than identifying abnormal call behavior based on the target kernel system function. This method can not only identify known abnormal call behaviors, but also detect situations in which unknown abnormal call behaviors exist, thereby improving the accuracy of abnormal call behavior detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] In order to more clearly illustrate the technical solution of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0043] Figure 1 It is a structural diagram of a system for determining a target calling behavior provided by an embodiment of the present application;
[0044] Figure 2 is a flowchart of a method for determining a target calling behavior provided by another embodiment of the present application;
[0045] Figure 3 is a flowchart of a method for determining a target calling behavior provided by another embodiment of the present application;
[0046] Figure 4 is a flowchart of a method for determining a target calling behavior provided by yet another embodiment of the present application;
[0047] Figure 5 is a flowchart of a method for determining a target calling behavior provided by yet another embodiment of the present application;
[0048] Figure 6 is a flowchart of a method for determining a target calling behavior provided by yet another embodiment of the present application;
[0049] Figure 7 is a flowchart of a method for determining a target calling behavior provided by yet another embodiment of the present application;
[0050] Figure 8 is a structural diagram of a device for determining a target calling behavior provided by yet another embodiment of the present application;
[0051] Fig. 9 It is a structural diagram of an electronic device provided in yet another embodiment of the present application. DETAILED DESCRIPTION
[0052] The features and exemplary embodiments of various aspects of the present application will be described in detail below. In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain the present application, rather than to limit the present application. For those skilled in the art, the present application can be implemented without the need for some of these specific details. The following description of the embodiments is only to provide a better understanding of the present application by illustrating the examples of the present application.
[0053] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the statement "include..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0054] With the rapid development of cloud computing technology, more and more companies are choosing to migrate their businesses to the cloud and deploy services in lightweight and fast containers. Containers (such as Docker and Kubernetes) share the kernel with the host. Once abnormal calling behavior occurs, security incidents such as data leakage may occur, and even lateral spread may occur, thereby endangering all containers in the host or the entire container cluster. Therefore, it is crucial to detect abnormal calling behavior in containers.
[0055] At present, container security is divided into two parts, image and container runtime. Image is a layered structure, each layer stores the relationship between programs and libraries, and the whole represents the static state when the application is not running. Image intrusion detection generally adopts static scanning. The principle is to scan the software installation directory in the image layer, compare the software information with the CVE vulnerability database, and determine whether it contains vulnerabilities. Container runtime is the image that interacts with the host kernel through the container engine to realize the operation of the application process. It is difficult to determine whether a container has been invaded by monitoring the host process or resources, that is, whether some non-business abnormal operations are performed inside it, such as SQL (SQL language, which is the abbreviation of Structured Query Language) injection, transmission of sensitive data, etc. In the commonly used container security management, taking docker and kubernetes as examples, the basic protection method is to prevent access to certain sensitive files through permission management, or limit the container's call to certain system functions, and use non-root users to run containers. The essence is to prohibit risky behaviors to achieve the purpose of protection.
[0056] In the prior art, samples are usually constructed using call sequences of target kernel system functions, and traditional supervised learning classification models are trained. The trained model is used to detect whether there is call information of the target kernel system function in the container. When the call information of the target kernel system function or a kernel system function similar to the target kernel system function is detected, it is determined that the container has abnormal call behavior. However, this detection method can only detect known abnormal call behaviors, and cannot identify the presence of unknown abnormal call behaviors, and the accuracy of abnormal call behavior detection is low.
[0057] Permission control can be used as a basic security strategy. The cost of learning and using it is high, and the operation and maintenance personnel need to have a clear understanding of the permissions required for the business. In addition, its protection effect is limited, and some vulnerability attacks cannot be identified. All operations during container runtime need to interact with the kernel. The kernel system function call sequence can comprehensively record the behavior of the container, so it can characterize the behavior of the container. By analyzing the kernel system function call sequence, it can be determined whether the container process has abnormal behavior.
[0058] The current detection method still faces the following problems. First, host anomaly detection cannot be directly extended to container anomaly detection. The characteristic of a container is that as a process, a single container focuses on completing a specific function. The kernel system function call pattern is relatively fixed, while the host process is more chaotic and complex. Although the host anomaly detection model can greatly improve the detection rate, the efficiency is low due to the wide detection range. Second, in the process of vectorizing the kernel system function call sequence, CBOW (continuous bag of words) and other methods are usually used without considering the order of calling functions. In fact, the order of kernel system functions in the call chain is different, and the process behaviors represented may be quite different, which will lead to false detection. Third, the kernel system function sequence is unlabeled data. Container abnormal behavior detection is essentially an unsupervised learning problem. Traditional supervised learning classification algorithms need to add labels to normal process data and train with the maintained intrusion behavior knowledge base data. For example, the call chain data needs to be labeled before training with the C4.5 algorithm, which makes it impossible to identify unknown intrusion behaviors. Therefore, how to process the kernel system function call sequence, handle container detection problems according to the characteristics of the container, and identify abnormal behaviors in a timely manner have become urgent issues to be solved in the direction of container security.
[0059] In order to solve the problems of the prior art, the embodiments of the present application provide a method, device, equipment and computer storage medium for determining a target call behavior. The method for determining a target call behavior provided in the embodiments of the present application is applied to a system for determining a target call behavior. Figure 1As shown, the target call behavior determination system 100 includes a control subsystem 110 and a working subsystem 120. The control subsystem 110 includes a system management module 111, which is responsible for managing the entire target call behavior determination system, including configuration management, authentication management, alarm information setting, etc., and provides a user interface and services for users to query, view and manage the intrusion detection results of the container or the working subsystem information, such as model parameters, data volume, system permissions and alarm content, etc. The working subsystem 120 is in the container and includes a data collection module 121, a data processing module 122, a model training module 123, an abnormal behavior detection module 124 and an alarm push module 125. The data collection module 121 acquires data according to the amount of data in the system management module 111, is responsible for regularly updating the workload of the container cluster, and collects the kernel system function call sequence information of the corresponding container in real time; the data processing module 122 is used to process the acquired data, including vectorization, etc.; the model training module 123 trains the model based on the parameters of the model in the system management module 111; the abnormal behavior detection module 124 is used to identify abnormal call behavior; the alarm push module 125 is used to send alarm information to the target device. It should be noted that the working subsystem 120 can be a subsystem in multiple containers, that is, the target call behavior determination system can detect abnormal call behavior for multiple containers, and adopts a distributed architecture to ensure timeliness while reducing the computing loss of the server. It can manage a large number of clusters and improve the efficiency of detection.
[0060] The application scenarios of the method for determining the target calling behavior provided in the embodiment of the present application may include, but are not limited to, home IoT (Internet of Things) services.
[0061] The following first introduces the method for determining the target calling behavior provided in the embodiment of the present application. Figure 2 A flowchart of a method for determining a target calling behavior provided by an embodiment of the present application is shown.
[0062] like Figure 2 As shown, the method for determining the target calling behavior provided by the embodiment of the present application includes the following steps.
[0063] S210: Acquire a first function call sequence of a target container, where the first function call sequence includes a plurality of kernel system function call information, and each kernel system function call information includes a kernel system function and a call time.
[0064] Here, the target container may include, but is not limited to, Docker and Kubernetes. The kernel system function represents the action performed by the container. There may be multiple target containers.
[0065] In some embodiments, the first function call sequence can be obtained based on strace. The first function call sequence includes multiple kernel system function call information, each kernel system function call information includes a kernel system function and a call time and a process ID. It can be understood that the multiple kernel system function call information can be context information of the kernel system function.
[0066] For example, the function call sequence of the mkdir command is: {execve, mmap, access, fstat, mmap, mprotect, munmap, set_robust_list, rt_sigaction, rt_sigprocmask, open}, where execve, mmap, access, etc. are kernel system functions.
[0067] S220. Perform vectorization conversion on the first function call sequence to obtain a first function call sequence vector.
[0068] In some embodiments, the calling sequence of each kernel system function in the first function calling sequence is sequential, and the sequence cannot be changed during the vectorization conversion process. Specifically, a flag bit can be added to the sequence, or the position of each kernel system function can be marked, so as to achieve the purpose of keeping the calling sequence of each kernel system function unchanged during the vectorization conversion.
[0069] S230. Input the first function call sequence vector into the behavior detection model, use the encoder in the behavior detection model to encode the first function call sequence vector to obtain an encoded vector, and use the decoder in the behavior detection model to decode the encoded vector to obtain a reconstructed function call sequence vector.
[0070] Here, the behavior detection model can be trained in advance.
[0071] In some embodiments, the behavior detection model can be an autoencoder (AE) model of a fully connected neural network. The AE model uses the input data itself as supervision to guide the neural network to learn a mapping relationship and obtain a reconstructed output data. The AE model includes an encoder and a decoder. The encoder maps the input data to a low-dimensional code, thereby forcing the neural network to learn the most informative features, and the decoder maps the low-dimensional code back to a high-dimensional space. For normal kernel system function call behavior, the trained decoder approximately restores the input data, and the neural network learns the laws of the data itself.
[0072] S240: When the difference between the first function call sequence vector and the reconstructed function call sequence vector is greater than a first preset value, determine that a target call behavior exists in the first function call sequence of the target container.
[0073] In some embodiments, the difference between the first function call sequence vector and the reconstructed function call sequence vector is calculated using formula (1), and formula (1) is as follows:
[0074] y=||H y -g φ (f θ (H y ))||1 (1)
[0075] Among them, H y represents the first function call sequence vector, g φ (f θ (H i )) represents the reconstructed function call sequence vector; f θ is the encoder function, g φ Decoder function.
[0076] It is understandable that if the difference between the first function call sequence vector and the reconstructed function call sequence vector is greater than a first preset value, it indicates that there is a target call behavior in the first function call sequence. The target call behavior may be an abnormal call behavior.
[0077] In this way, the kernel system function call sequence vector corresponding to the kernel system function call sequence of the target container is reconstructed by utilizing the encoding and decoding of the target call behavior detection model. When the reconstruction error is large, it indicates that an abnormal call behavior has occurred in the target container. That is, based on the unsupervised target call behavior detection model, the kernel system function call sequence of the target container itself is utilized to identify abnormal call behavior, rather than identifying abnormal call behavior based on the target kernel system function. This method can not only identify known abnormal call behaviors, but also detect situations in which unknown abnormal call behaviors exist, thereby improving the accuracy of abnormal call behavior detection.
[0078] Based on this, in some embodiments, such as Figure 3 As shown, the above S220 may specifically include:
[0079] S221, adding a flag bit at a preset position of the first function call sequence to obtain a second function call sequence;
[0080] S222, determining a word vector sequence of a second function call sequence by using a mapping relationship between a preset kernel system function and a preset word vector and a mapping relationship between a preset flag bit and a preset word vector;
[0081] S223, using a preset bidirectional encoder model, performing vectorization conversion on the word vector sequence of the second function call sequence to obtain a second function call sequence vector;
[0082] S224. Delete the vector corresponding to the flag bit in the second function call sequence vector to obtain the first function call sequence vector.
[0083] Here, the preset bidirectional encoder model may be pre-set, and the parameters in the preset bidirectional encoder model are also determined based on experience. For example, the weight file is loaded into the initial bidirectional encoder model to obtain the preset bidirectional encoder model.
[0084] In some embodiments, assume that the system call sequence is S = {s1, s2, ..., s d}, where s i Represents the i-th kernel system function. Convert S into a text sequence X containing special flags = {[CLS], s1, s2, …, s d}, where [CLS] indicates the beginning of the sequence and is used to distinguish different sequences. Using the mapping relationship between the preset kernel system function and the preset word vector and the mapping relationship between the preset flag bit and the preset word vector, each kernel system function s i Mapped to the corresponding word vector x i , and add the position code corresponding to the flag to indicate its position in the sequence, and get the word vector sequence X of the second function call sequence ′ ={x0,x1,x2,…,x d}, where x0 represents the word vector of [CLS]. The first function call sequence is mapped to the input format of a preset bidirectional encoder model (such as a BERT model).
[0085] In some embodiments, a preset bidirectional encoder model is used to vectorize the word vector sequence of the second function call sequence to obtain the second function call sequence vector, that is, the mapped X ′ Input the BERT model and obtain the hidden state H={h0,h1,h2,…,h d Since the flag bit is used in the vectorization process and the order of the sequence is not changed, the vector corresponding to the flag bit in the second function call sequence vector is deleted after vectorization to obtain the first function call sequence vector.
[0086] In this way, a flag is added at a preset position of the first function call sequence, and the system call sequence is vectorized using a preset bidirectional encoder model, fully considering the order of functions in the call chain, thereby improving the accuracy of abnormal call behavior detection.
[0087] Based on this, in some embodiments, such as Figure 4 As shown, before the above S230, the method may further include:
[0088] S310, obtaining a function call sequence sample of the target container, where the function call sequence sample includes a plurality of kernel system function call information samples, and each kernel system function call information includes a kernel system function sample and a call time sample;
[0089] S320, performing vectorization conversion on the function call sequence sample to obtain a function call sequence vector sample;
[0090] S330, inputting the function call sequence vector sample into the initial behavior detection model, encoding the function call sequence vector sample using the initial encoder in the initial behavior detection model to obtain an encoded vector sample, and decoding the encoded vector sample using the initial decoder in the initial behavior detection model to obtain a reconstructed function call sequence vector sample;
[0091] S340, determining a loss value of an initial behavior detection model according to the function call sequence vector sample and the reconstructed function call sequence vector sample;
[0092] S350. When the loss value of the initial behavior detection model does not meet the training stop condition, update the parameters of the initial encoder and the initial decoder in the initial behavior detection model to obtain an updated initial behavior detection model, input the function call sequence vector sample into the updated initial behavior detection model, and update the reconstructed function call sequence vector sample until the loss value of the initial behavior detection model meets the training stop condition to obtain the behavior detection model.
[0093] Here, the behavior detection model can be an autoencoder model. For example, Figure 5 As shown, it is an architecture diagram of the autoencoder model, which includes an encoder and a decoder.
[0094] In some embodiments, considering that the function call sequence of container initialization usually does not encounter intrusion behavior, it is assumed that the system call sequence in the initialization phase is a normal call, and this part of data is used to train the model. Therefore, the function call sequence sample of the target container can be the function call sequence within a short period of time after the container is initialized. Here, the autoencoder model does not need negative data, which solves the problem of unlabeled function call sequences obtained in anomaly detection.
[0095] In some embodiments, the function call sequence sample of the target container may include N function call sequences, and the first N function call sequences of the container are selected as model training data, where N is a positive integer and the size of N may be set in advance.
[0096] In some embodiments, the reconstruction error is used as the loss function of the AE model to calculate the difference between the original input data and the reconstructed data output by the decoder, and the Manhattan distance is used as the error measurement function, which can measure the difference between vectors. The difference for abnormal data will be more obvious, so it is suitable for capturing abnormal behavior. Therefore, according to the function call sequence vector sample and the reconstructed function call sequence vector sample, the loss value of the initial behavior detection model is determined using the calculation formula (2) of the loss function. Formula (2) is as follows:
[0097]
[0098] Among them, H i represents the i-th function call sequence vector sample, N represents the number of function call sequence vector samples, g φ (f θ (H i )) represents the reconstructed data obtained by the decoder decoding the i-th function call sequence vector sample, and the weights θ and φ are the parameters of the encoder and decoder functions respectively. and Indicates the complexity of the model; λ is a fixed parameter. The larger the λ, the better the generalization ability of the model. Here, L2 regularization is used to prevent overfitting.
[0099] In some embodiments, the hyperparameters in the initial behavior detection model can be set in advance. The hyperparameters mainly include the number of layers and nodes of the encoder and decoder. The number of layers of the encoder and decoder affects the expressiveness of the model. The more layers, the more abstract and complex feature representations can be learned, but the amount of calculation is also increased. 3-6 layers can take into account both effect and efficiency. The number of nodes in each layer reflects the width of the layer and also affects the amount of calculation. Generally, a gradually decreasing trend is adopted, with the first layer being larger (512-1024) and the last layer being smaller (64-128). Select the parameters with the best precision and recall rate on the verification set based on network search. In the embodiments provided in the present application, the hyperparameters in the initial behavior detection model can be set according to experience.
[0100] In some embodiments, stochastic gradient descent (SGD), back propagation or other optimization algorithms can be selected to update the parameters of the model and minimize the loss function of the AE model.
[0101] In this way, by training the behavior detection model with a large number of samples, the parameters of the model can be better optimized, so that the model can accurately identify abnormal call behavior, thereby improving the accuracy of abnormal call behavior detection.
[0102] Based on this, in some embodiments, such as Figure 6As shown, the above S240 may specifically include:
[0103] S241, determining the difference between the first function call sequence vector and the reconstructed function call sequence vector as a target reconstruction error value;
[0104] S242. According to the relationship between the preset reconstruction error value and the preset target call behavior level, determine the target call behavior level corresponding to the target reconstruction error value, which is the target level of the target call behavior existing in the first function call sequence. The preset reconstruction error value includes the target reconstruction error value, and the preset target call behavior level includes the target level.
[0105] In some embodiments, different levels of abnormal call behaviors can also be set according to the reconstruction error determined by the model. The trained model is used to perform real-time abnormal behavior detection on the function call sequence of the container. Different levels of alarm thresholds can be set according to the abnormal call behavior level corresponding to the reconstruction error value, and the abnormality can be divided into high-risk, serious, prompt, etc., and the alarm level can be generated in time based on the reconstruction error value.
[0106] In this way, the user can start different maintenance plans according to the different target levels of the target calling behaviors existing in the first function calling sequence, thereby improving the user experience.
[0107] Based on this, in some embodiments, such as Figure 7 As shown, after the above S242, the method may further include:
[0108] S243, determining a target alarm push mode corresponding to the target level according to a relationship between a preset target call behavior level and an alarm push mode;
[0109] S244: Send alarm information to the target device using the target alarm push method.
[0110] In some embodiments, different levels of alarms may be set with different push plans, and alarm notifications may be sent to administrators or other relevant personnel via message queues, API interfaces, emails, and the like.
[0111] In this way, users can use the received alarm information to promptly understand the function call status in the container and troubleshoot abnormal calls in a timely manner, thereby improving the security of the container.
[0112] Based on this, in some embodiments, obtaining the first function call sequence of the target container includes:
[0113] Get the initial function call sequence of the target container;
[0114] A first function calling sequence consistent with a preset kernel system function is extracted from the initial function calling sequence.
[0115] Here, the default kernel system function is set in advance.
[0116] In some embodiments, the initial function call sequence of the target container includes a large number of interference factors. Data cleaning is required. For example, word segmentation, removal of function parameters, return values, error prompts, removal of invalid symbols, unified synonyms, etc., and then extracting the first function call sequence consistent with the preset kernel system function from the initial function call sequence. Among them, unified synonyms can form standardized function names and improve the model's understanding ability. Effective data cleaning can improve the accuracy of model training and abnormal behavior detection.
[0117] In this way, data cleaning can be performed through the setting of preset kernel system functions to eliminate interference factors, thereby obtaining the first function call sequence, reducing the amount of calculation, and improving the accuracy and efficiency of target call behavior detection.
[0118] Based on the above embodiments, the method for determining the target calling behavior provided by the present application is summarized as follows. The specific process is as follows:
[0119] (1) First, after the system management module is authenticated by adding the container cluster, the data collection module interacts with the cloud platform through the API. Then, the proxy service is deployed in the cluster. After the service is successfully deployed, it interacts with the system management module through websocket.
[0120] (2) Obtain and update the cluster workload list by interacting with the cluster API, obtain the function call data of each workload, and obtain N initial function call sequences S = {s1, s2, ..., s d}.
[0121] (3) Vectorize the initial function call sequence to form training data that meets the AE model input format:
[0122]
[0123] (4) Use grid search to select appropriate hyperparameters based on accuracy and recall, or set hyperparameters in advance, and use gradient descent algorithms to update model parameters for training to obtain encoder and decoder function parameters. Use the gradient descent algorithm to minimize the loss function, randomly select a sample from the training data each time, and then calculate the partial derivative of the loss function with respect to the model parameters, update the model parameters in the opposite direction of the gradient, and control the step size of the parameter update. The whole process will be iterated multiple times until the loss function converges.
[0124] (5) In actual applications, the function call sequence of the container is captured in real time and the reconstruction error is calculated. If the reconstruction error exceeds the threshold, it is determined to be an abnormal process.
[0125] (6) According to the push address and subscription method configured by the system management module, send alarm information to administrators or other relevant personnel through message queues, API interfaces, emails, etc.
[0126] In the embodiments provided in the present application, first, the Bert algorithm is used to vectorize the system call sequence, taking full account of the order of functions in the call chain. Secondly, an unsupervised model AE model is used. The AE model is a neural network model commonly used in unsupervised learning, which can be used for data dimension reduction, feature extraction and reconstruction. The sequence of function calls within a short period of time after the container is initialized is used as training data to train an AE model, which reconstructs the function call sequence by learning the encoding and decoding process of the input sequence. The function call sequence collected subsequently is reconstructed, and the difference between the reconstructed sequence and the original sequence is compared to detect whether there is abnormal calling behavior. This method is based on unsupervised learning of container process behavior, and can detect abnormal behavior without prior labels, effectively solve the problem of no labels, greatly improve the scope of application of the model, and ensure detection accuracy while improving generalization performance.
[0127] In the embodiments provided in this application, the training of the autoencoder model consumes less resources, which improves the accuracy and efficiency of container intrusion detection. Unknown types of intrusions can be identified without maintaining an abnormal behavior knowledge base. The learning cost of operation and maintenance personnel is reduced, and the whole process is intelligent. Multi-cluster management and unified configuration are possible. Only cluster authentication, data collection and processing, model training process and alarm process are all automatically processed without the intervention of operation and maintenance personnel.
[0128] Based on the target call behavior determination method provided in the above embodiment, the present application also provides a specific implementation of the target call behavior determination device. Please refer to the following embodiment.
[0129] See first Figure 8 , the target calling behavior determination device 400 provided in the embodiment of the present application includes:
[0130] An acquisition module 410 is used to acquire a first function call sequence of a target container, where the first function call sequence includes a plurality of kernel system function call information, and each kernel system function call information includes a kernel system function and a call time;
[0131] A conversion module 420, configured to perform vectorization conversion on the first function call sequence to obtain a first function call sequence vector;
[0132] A determination module 430 is used to input the first function call sequence vector into the behavior detection model, encode the first function call sequence vector using an encoder in the behavior detection model to obtain an encoding vector, and decode the encoding vector using a decoder in the behavior detection model to obtain a reconstructed function call sequence vector;
[0133] The determination module 430 is further configured to determine that there is a target call behavior in the first function call sequence of the target container when the difference between the first function call sequence vector and the reconstructed function call sequence vector is greater than a first preset value.
[0134] Based on this, in some embodiments, the conversion module 420 may be specifically used to:
[0135] Add a flag bit at a preset position of the first function call sequence to obtain a second function call sequence;
[0136] Determine a word vector sequence of a second function call sequence by using a mapping relationship between a preset kernel system function and a preset word vector and a mapping relationship between a preset flag bit and a preset word vector;
[0137] Using a preset bidirectional encoder model, vectorize the word vector sequence of the second function call sequence to obtain a second function call sequence vector;
[0138] The vector corresponding to the flag bit in the second function call sequence vector is deleted to obtain the first function call sequence vector.
[0139] Based on this, in some embodiments, the apparatus 400 may further include:
[0140] The acquisition module 410 is further used to acquire a function call sequence sample of the target container before inputting the function call sequence vector into the behavior detection model, where the function call sequence sample includes a plurality of kernel system function call information samples, and each kernel system function call information includes a kernel system function sample and a call time sample;
[0141] The conversion module 420 is further used to perform vectorization conversion on the function call sequence sample to obtain a function call sequence vector sample;
[0142] The determination module 430 is further used to input the function call sequence vector sample into the initial behavior detection model, encode the function call sequence vector sample using the initial encoder in the initial behavior detection model to obtain the encoded vector sample, and decode the encoded vector sample using the initial decoder in the initial behavior detection model to obtain the reconstructed function call sequence vector sample;
[0143] The determination module 430 is further used to determine the loss value of the initial behavior detection model according to the function call sequence vector sample and the reconstructed function call sequence vector sample;
[0144] Determination module 430 is also used to update the parameters of the initial encoder and the initial decoder in the initial behavior detection model when the loss value of the initial behavior detection model does not meet the training stop condition, to obtain an updated initial behavior detection model, input the function call sequence vector sample into the updated initial behavior detection model, and update the reconstructed function call sequence vector sample until the loss value of the initial behavior detection model meets the training stop condition to obtain the behavior detection model.
[0145] Based on this, in some embodiments, the determination module 430 may be specifically used to:
[0146] Determine the difference between the first function call sequence vector and the reconstructed function call sequence vector as a target reconstruction error value;
[0147] According to the relationship between the preset reconstruction error value and the preset target call behavior level, the target call behavior level corresponding to the target reconstruction error value is determined, which is the target level of the target call behavior existing in the first function call sequence. The preset reconstruction error value includes the target reconstruction error value, and the preset target call behavior level includes the target level.
[0148] Based on this, in some embodiments, the apparatus 400 may further include:
[0149] The determination module 430 is further configured to determine, according to the relationship between the preset target call behavior level and the alarm push mode, a target alarm push mode corresponding to the target level after determining that the target call behavior level corresponding to the target reconstruction error value is the target level of the target call behavior existing in the first function call sequence of the target container;
[0150] The sending module is used to send alarm information to the target device using the target alarm push method.
[0151] Based on this, in some embodiments, the acquisition module 410 may be specifically used to:
[0152] Get the initial function call sequence of the target container;
[0153] A first function calling sequence consistent with a preset kernel system function is extracted from the initial function calling sequence.
[0154] The various modules of the target call behavior determination device provided in the embodiment of the present application can realize the functions of the various steps of the target call behavior determination method provided above and achieve the corresponding technical effects, which will not be repeated here for the sake of concise description.
[0155] Based on the same inventive concept, an embodiment of the present application also provides an electronic device.
[0156] Fig. 9 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application is shown.
[0157] The electronic device may include a processor 501 and a memory 502 storing computer program instructions.
[0158] Specifically, the processor 501 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.
[0159] The memory 502 may include a large capacity memory for data or instructions. By way of example and not limitation, the memory 502 may include a hard disk drive (HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive or a combination of two or more of these. In appropriate cases, the memory 502 may include a removable or non-removable (or fixed) medium. In appropriate cases, the memory 502 may be inside or outside the integrated gateway disaster recovery device. In a specific embodiment, the memory 502 is a non-volatile solid-state memory.
[0160] The memory may include a read-only memory (ROM), a random access memory (RAM), a magnetic disk storage medium device, an optical storage medium device, a flash memory device, an electrical, optical or other physical / tangible memory storage device. Therefore, generally, the memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., a memory device) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the method according to one aspect of the present disclosure.
[0161] The processor 501 implements any one of the methods for determining a target calling behavior in the above embodiments by reading and executing computer program instructions stored in the memory 502 .
[0162] In one example, the electronic device may further include a communication interface 503 and a bus 510. Fig. 9 As shown, the processor 501, the memory 502, and the communication interface 503 are connected via a bus 510 and communicate with each other.
[0163] The communication interface 503 is mainly used to implement communication between various modules, devices, units and / or equipment in the embodiments of the present application.
[0164] The bus 510 includes hardware, software or both, coupling the components of the electronic device to each other. For example, but not limitation, the bus may include an accelerated graphics port (Accelerated Graphics Port, AGP) or other graphics bus, an enhanced industry standard architecture (Extended Industry Standard Architecture, EISA) bus, a front side bus (Front Side Bus, FSB), a hypertransport (Hyper Transport, HT) interconnection, an industry standard architecture (Industry Standard Architecture, ISA) bus, an infinite bandwidth interconnection, a low pin count (Linear Predictive Coding, LPC) bus, a memory bus, a micro channel architecture (MicroChannel Architecture, MCA) bus, a peripheral component interconnect (Peripheral Component Interconnect, PCI) bus, a PCI-Express (Peripheral Component Interconnect-X, PCI-X) bus, a serial advanced technology attachment (Serial Advanced Technology Attachment, SATA) bus, a video electronics standard association local (VESA Local Bus, VLB) bus or other suitable bus or a combination of two or more of these. Where appropriate, the bus 510 may include one or more buses. Although the embodiments of the present application describe and illustrate a specific bus, the present application considers any suitable bus or interconnection. The electronic device can execute the target call behavior determination method in the embodiments of the present invention, thereby implementing the above target call behavior determination method.
[0165] In addition, in combination with the target call behavior determination method in the above embodiment, the embodiment of the present application can provide a computer storage medium for implementation. The computer storage medium stores computer program instructions; when the computer program instructions are executed by the processor, any target call behavior determination method in the above embodiment is implemented.
[0166] The present application also provides a computer program product. When the instructions in the computer program product are executed by a processor of an electronic device, the electronic device executes each process of an embodiment of a method for determining any one of the above-mentioned target calling behaviors.
[0167] It should be clear that the present application is not limited to the specific configuration and processing described above and shown in the figures. For the sake of simplicity, a detailed description of the known method is omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present application is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between the steps after understanding the spirit of the present application.
[0168] The functional blocks shown in the structural block diagram described above can be implemented as hardware, software, firmware or a combination thereof. When implemented in hardware, it can be, for example, an electronic circuit, an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), appropriate firmware, plug-in, function card, etc. When implemented in software, the elements of the present application are programs or code segments used to perform the required tasks. The program or code segment can be stored in a machine-readable medium, or transmitted on a transmission medium or communication link by a data signal carried in a carrier. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, read-only memory (Read-Only Memory, ROM), flash memory, erasable read-only memory (Erasable ReadOnly Memory, EROM), floppy disks, compact disc read-only memory (Compact Disc Read-Only Memory, CD-ROM), optical discs, hard disks, optical fiber media, radio frequency (Radio Frequency, RF) links, etc. The code segment can be downloaded via a computer network such as the Internet, an intranet, etc.
[0169] It should also be noted that the exemplary embodiments mentioned in this application describe some methods or systems based on a series of steps or devices. However, this application is not limited to the order of the above steps, that is, the steps can be performed in the order mentioned in the embodiment, or in a different order from the embodiment, or several steps can be performed simultaneously.
[0170] Aspects of the present disclosure are described above with reference to the flowchart and / or block diagram of the method, device (system) and computer program product according to the embodiment of the present disclosure. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device to produce a machine so that these instructions executed by the processor of the computer or other programmable data processing device enable the implementation of the function / action specified in one or more boxes of the flowchart and / or block diagram. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor, or a field programmable logic circuit. It can also be understood that each box in the block diagram and / or flowchart and the combination of boxes in the block diagram and / or flowchart can also be implemented by dedicated hardware that performs a specified function or action, or can be implemented by a combination of dedicated hardware and computer instructions.
[0171] The above are only specific implementation methods of the present application. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working processes of the systems, modules and units described above can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here. It should be understood that the protection scope of the present application is not limited to this. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in this application, and these modifications or replacements should be included in the protection scope of this application.
Claims
1. A method for determining a target calling behavior, characterized in that: include: Acquire a first function call sequence of a target container, where the first function call sequence includes a plurality of kernel system function call information, and each kernel system function call information includes a kernel system function and a call time; Performing vectorization conversion on the first function call sequence to obtain a first function call sequence vector; Inputting the first function call sequence vector into a behavior detection model, encoding the first function call sequence vector using an encoder in the behavior detection model to obtain an encoding vector, and decoding the encoding vector using a decoder in the behavior detection model to obtain a reconstructed function call sequence vector; When the difference between the first function call sequence vector and the reconstructed function call sequence vector is greater than a first preset value, it is determined that a target call behavior exists in the first function call sequence of the target container.
2. The method for determining target calling behavior according to claim 1, characterized in that: The vectorizing the first function call sequence to obtain a first function call sequence vector includes: Add a flag bit at a preset position of the first function call sequence to obtain a second function call sequence; Determine a word vector sequence of the second function call sequence by using a mapping relationship between a preset kernel system function and a preset word vector and a mapping relationship between a preset flag bit and the preset word vector; Using a preset bidirectional encoder model, vectorize the word vector sequence of the second function call sequence to obtain a second function call sequence vector; The vector corresponding to the flag bit in the second function call sequence vector is deleted to obtain a first function call sequence vector.
3. The method for determining target calling behavior according to claim 1, characterized in that: Before inputting the function call sequence vector into the behavior detection model, the method further includes: Acquire a function call sequence sample of the target container, wherein the function call sequence sample includes a plurality of kernel system function call information samples, and each kernel system function call information includes a kernel system function sample and a call time sample; Performing vectorization conversion on the function call sequence sample to obtain a function call sequence vector sample; Inputting the function call sequence vector sample into an initial behavior detection model, encoding the function call sequence vector sample using an initial encoder in the initial behavior detection model to obtain an encoded vector sample, and decoding the encoded vector sample using an initial decoder in the initial behavior detection model to obtain a reconstructed function call sequence vector sample; Determining a loss value of the initial behavior detection model according to the function call sequence vector sample and the reconstructed function call sequence vector sample; When the loss value of the initial behavior detection model does not meet the training stop condition, the parameters of the initial encoder and the initial decoder in the initial behavior detection model are updated to obtain an updated initial behavior detection model, the function call sequence vector sample is input into the updated initial behavior detection model, and the reconstructed function call sequence vector sample is updated until the loss value of the initial behavior detection model meets the training stop condition to obtain the behavior detection model.
4. The method for determining target calling behavior according to claim 1, characterized in that: The step of determining that a target call behavior exists in the first function call sequence of the target container when the difference between the first function call sequence vector and the reconstructed function call sequence vector is greater than a first preset value includes: Determine a difference between the first function call sequence vector and the reconstruction function call sequence vector as a target reconstruction error value; According to the relationship between the preset reconstruction error value and the preset target call behavior level, the target call behavior level corresponding to the target reconstruction error value is determined, which is the target level of the target call behavior existing in the first function call sequence, the preset reconstruction error value includes the target reconstruction error value, and the preset target call behavior level includes the target level.
5. The method for determining target calling behavior according to claim 4, characterized in that: After determining, according to the relationship between the preset reconstruction error value and the preset target calling behavior level, that the target calling behavior level corresponding to the target reconstruction error value is the target level of the target calling behavior existing in the first function calling sequence of the target container, the method further includes: According to the relationship between the preset target calling behavior level and the alarm pushing method, determining the target alarm pushing method corresponding to the target level; The target alarm push method is used to send alarm information to the target device.
6. The method for determining target calling behavior according to claim 1, characterized in that: The step of obtaining a first function call sequence of a target container includes: Get the initial function call sequence of the target container; A first function calling sequence consistent with a preset kernel system function is extracted from the initial function calling sequence.
7. A device for determining a target calling behavior, characterized in that: include: An acquisition module, configured to acquire a first function call sequence of a target container, wherein the first function call sequence includes a plurality of kernel system function call information, each of the kernel system function call information includes a kernel system function and a call time; A conversion module, used for performing vectorization conversion on the first function call sequence to obtain a first function call sequence vector; A determination module, configured to input the first function call sequence vector into a behavior detection model, encode the first function call sequence vector using an encoder in the behavior detection model to obtain an encoding vector, and decode the encoding vector using a decoder in the behavior detection model to obtain a reconstructed function call sequence vector; The determination module is further configured to determine that a target call behavior exists in the first function call sequence of the target container when a difference between the first function call sequence vector and the reconstructed function call sequence vector is greater than a first preset value.
8. An electronic device, characterized in that: The device comprises: a processor and a memory storing computer program instructions; When the processor executes the computer program instructions, the method for determining the target call behavior according to any one of claims 1 to 6 is implemented.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer program instructions, and when the computer program instructions are executed by a processor, the method for determining a target call behavior according to any one of claims 1 to 6 is implemented.
10. A computer program product, characterized in that When the instructions in the computer program product are executed by a processor of an electronic device, the electronic device is enabled to execute the method for determining the target call behavior as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Abnormal behavior detection method and device during container running and a model training method and device
CN112860484A
Operation and maintenance alarm method, device, equipment and medium
CN115174350A
Entity type fused BERT knowledge graph completion method and system
CN116010622A
Malicious software detection method based on semantic analysis and bidirectional coding representation
CN116432184A
Traffic anomaly alarm method, device and equipment and storage medium
CN116743544A
