Host sequence intrusion detection method

Through the lasso linear regression model and K nearest neighbor classification method, the problem of low accuracy of host sequence intrusion detection under the condition of small training samples and unbalanced samples is solved, achieving higher detection effect and efficiency, and the accuracy and interpretability of selected features. sex.

CN112699368BActive Publication Date: 2024-09-10GUANGDONG INFORMATION SECURITY EVALUATION CENT
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110015796.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-01-05
Publication Date
2024-09-10
Estimated Expiration
2041-01-05

AI Technical Summary

Technical Problem

When there are few training samples, the accuracy of existing host system call sequence intrusion detection methods is low. Especially when the samples are unbalanced, it is difficult to effectively detect abnormal attack behaviors.

Method used

The lasso linear regression model is used to extract features, and the optimal penalty constraint coefficient is obtained through multiple cross-validation, the feature space is reconstructed, and the detection results are generated by combining the K nearest neighbor classification method to improve the accuracy and efficiency of detection.

Benefits of technology

In the case of sample imbalance, the detection effect, accuracy and interpretability of selected features are improved. Experiments show that it has a higher accuracy when there are fewer training samples, and reduces the false alarm rate and calculated vector dimensions. , improving the efficiency of the classification algorithm.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112699368B
    Figure CN112699368B
Patent Text Reader

Abstract

The present invention discloses a host sequence intrusion detection method, comprising: constructing a feature space according to different command dimensions of the host intrusion sequence, and randomly dividing the feature space into training data and test data according to a set ratio; regularizing the training data and the test data to generate training independent variables and test independent variables, training dependent variables and test dependent variables respectively; obtaining the optimal penalty constraint term coefficient of the lasso linear regression model; refitting the training independent variables according to the optimal penalty constraint term coefficient to generate a fitting result; removing the items with a coefficient of 0 from the fitting result, and using the remaining items as the dimensions after screening; forming new training data and new test data according to the remaining items; for each host sequence in the new test data, performing K nearest neighbor classification according to the reconstructed feature space, generating a judgment category, and generating a detection result. The present invention has a high accuracy rate.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of network intrusion detection, and in particular to a host sequence intrusion detection method. Background Art

[0002] At present, there are generally three methods for extracting intrusion detection features based on host system call sequences.

[0003] The first one is based on serialization features, represented by N-Gram feature modeling technology. This method records normal sequence sets through a sliding window mechanism, and trains the window size to finally obtain a suitable window size. Among them, N-Gram is an algorithm based on a statistical language model, and each byte segment is called a gram; the basic idea of ​​the algorithm is to perform a sliding window operation of size N on the content of the text according to the bytes, forming a byte segment sequence of length N.

[0004] The second type is based on frequency statistics. For example, the sequence is regarded as text, and the commands in the sequence are regarded as words. Several characteristic commands of the sequence are counted through natural language processing methods to model the command set. Typical statistical methods include TF-IDF (term frequency–inverse document frequency), HMM (Hidden Markov Model), bag-of-words model, etc.

[0005] The third type is an embedding model based on word vectors. Through the NLP (natural language processing) method, the distance features of the commands are extracted from the high-dimensional space, the sequence is trained into a shallow neural network, and each command or each string of sub-commands in the training set is mapped to a vector space of a specified dimension, and then the dimension is reduced.

[0006] The common technical problem of the above methods is that the accuracy is low when there are fewer training samples.

[0007] The disclosure of the above background technology content is only used to assist in understanding the inventive concept and technical solution of the present invention. It does not necessarily belong to the prior art of the present invention. In the absence of clear evidence that the above content has been disclosed on the application date of the present invention, the above background technology should not be used to evaluate the novelty and creativity of the present invention. Summary of the invention

[0008] The present invention provides a host sequence intrusion detection method with high accuracy.

[0009] In a first aspect, the present invention provides a host sequence intrusion detection method, comprising:

[0010] Constructing a feature space of the host intrusion sequence according to different command dimensions, and randomly dividing the feature space into training data and test data according to a set ratio;

[0011] Regularizing the training data and the test data to generate a training independent variable X_train and a test independent variable X_test, a training dependent variable Y_train and a test dependent variable Y_test;

[0012] Using the training independent variable X_train to train the lasso linear regression model, to obtain the optimal penalty constraint term coefficient of the lasso linear regression model;

[0013] Refitting the training independent variable X_train according to the optimal penalty constraint term coefficient to generate a fitting result;

[0014] For the fitting results, the items with coefficients of 0 are removed, and the remaining items are used as the dimensions after screening;

[0015] Reconstructing the feature space according to the remaining items to form new training data and new test data;

[0016] For each host sequence in the new test data, K nearest neighbor classification is performed according to the reconstructed feature space to generate a determination category;

[0017] A detection result is generated according to the determination category.

[0018] In some preferred embodiments, the lasso linear regression model is trained using the training independent variable X_train to obtain the optimal penalty constraint term coefficient of the lasso linear regression model, including: solving the optimal penalty constraint term coefficient by multiple cross-validation.

[0019] In some preferred embodiments, the lasso linear regression model is trained using the training independent variable X_train to obtain the optimal penalty constraint term coefficient of the lasso linear regression model, including:

[0020] Divide the training independent variable X_train into a test set and a training set;

[0021] Using the training set to train the lasso linear regression model with different penalty constraint term coefficients, and using the test set to test the response value of the trained lasso linear regression model, and recording the mean square prediction error of different penalty constraint term coefficients;

[0022] The penalty constraint term coefficient corresponding to the minimum mean square prediction error is used as the optimal penalty constraint term coefficient of the lasso linear regression model.

[0023] In some preferred embodiments, the training independent variable X_train is divided into a test set and a training set, including:

[0024] The training independent variable X_train is randomly divided into N groups, one of which is used as a test set, and the remaining N-1 groups are used as training sets.

[0025] In some preferred embodiments, the following is repeated N times:

[0026] Randomly divide the training independent variable X_train into N groups, use one group as a test set, and use the remaining N-1 groups as training sets;

[0027] The training set is used to train the lasso linear regression model with different penalty constraint term coefficients, and the test set is used to test the response value of the trained lasso linear regression model, and the mean square prediction error of different penalty constraint term coefficients is recorded.

[0028] In some preferred embodiments, for each host sequence in the new test data, K nearest neighbor classification is performed according to the reconstructed feature space to generate a judgment category, including: finding K vectors with the closest Euclidean distance from the reconstructed feature space, and taking the category with a larger number in the label categories of the K vectors according to the voting principle as the judgment category of the host sequence in each new test data.

[0029] In a second aspect, the present invention provides a computer-readable storage medium having program instructions stored therein, wherein the program instructions, when executed by a processor of a computer, cause the processor to perform the above method.

[0030] Compared with the prior art, the present invention has the following beneficial effects:

[0031] In the case of sample imbalance, that is, when the proportion of normal samples is much larger than that of abnormal samples, the method provided by the present invention can achieve better detection effects compared with traditional methods; compared with frequency-based methods, the method provided by the present invention is more accurate in selecting features and the selection results are more interpretable; experiments show that the method provided by the present invention can have a higher accuracy rate when there are fewer training samples. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] Figure 1 A schematic diagram of a process flow of a host sequence intrusion detection method provided by an embodiment of the present invention;

[0033] Figure 2 An overall flow chart of a host sequence intrusion detection method provided by an embodiment of the present invention;

[0034] Figure 3 It is a schematic diagram of the detection rate and false alarm rate of abnormal samples by various detection methods under imbalanced data;

[0035] Figure 4 This is a schematic diagram of the detection rate and false alarm rate of abnormal samples by various detection methods after data balancing;

[0036] Figure 5 Schematic diagram showing the time consumption comparison of the classification process of various feature selection-based detection methods. DETAILED DESCRIPTION

[0037] In order to make the technical problems, technical solutions and beneficial effects to be solved by the embodiments of the present invention more clear, the following Figures 1 to 5 It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.

[0038] In the description of the embodiments of the present invention, “plurality” means two or more than two, unless otherwise clearly and specifically defined.

[0039] This embodiment provides a host sequence intrusion detection method for detecting abnormal attack behaviors through host sequences, specifically a host sequence intrusion detection method based on lasso feature extraction, wherein lasso stands for leastabsolute shrinkage and selection operator, which can be called lasso algorithm.

[0040] This embodiment adopts a detection method based on Lasso-kNN to address the sparsity characteristics of one-hot representation of host sequence commands, that is, using lasso regression to extract features, remodeling and then using kNN classification (k-nearest neighbor) for detection.

[0041] Among them, one-hot encoding, also known as one-bit effective encoding, mainly uses N-bit state registers to encode N states, each state has its own independent register bit, and only one bit is valid at any time. One-hot encoding is the representation of categorical variables as binary vectors.

[0042] refer to Figure 1 and Figure 2 The host sequence intrusion detection method provided in this embodiment includes steps A1 to A8.

[0043] Step A1: construct a feature space for the host intrusion sequence according to different command dimensions, and randomly divide the feature space into training data and test data according to a set ratio.

[0044] A host intrusion sequence may also be referred to as a host sequence.

[0045] Step A2: Regularize the training data and the test data to generate training independent variables X_train and test independent variables X_test, training dependent variables Y_train and test dependent variables Y_test.

[0046] Step A1 and step A2 are data processing and initialization, specifically processing and initializing the host sequence to obtain training data distri_train and test data distri_test, and then obtaining training independent variables X_train and test independent variables X_test, training dependent variables Y_train and test dependent variables Y_test through regularization based on the training data distri_train and test data distri_test.

[0047] Step A3, using the training independent variable X_train to train the lasso linear regression model to obtain the optimal penalty constraint term coefficient of the lasso linear regression model.

[0048] Step A3 is to solve the optimal penalty constraint coefficient of the lasso linear regression model.

[0049] A linear regression model can be set as:

[0050]

[0051] Among them, β0 and β=(β1,β2,...,βp) are unknown parameters, e i is the error term, and p is the number of model coefficients; these parameters are usually estimated by the least squares method. With n samples, the loss function is

[0052]

[0053] Often all the least squares estimates in the above formula are not zero. If the p value is large, the final model will become difficult to interpret; and when p>n, the result of the least squares estimate is not unique, there are infinite solutions that can make the objective function zero, and most solutions will overfit the data.

[0054] The lasso linear regression model adds the L1 norm as a penalty constraint on the basis of the ordinary linear regression model, and λ is the coefficient of the penalty constraint term. When the coefficient λ of the penalty constraint term is sufficiently large, some coefficients to be estimated can be accurately shrunk to 0, thereby achieving the effect of effectively reducing the dimensionality of sparse data. That is, its loss function is as follows:

[0055]

[0056] Among them, p is the number of coefficients in the model, that is, the number of different commands in all host sequences, which can usually reach hundreds of dimensions. n represents the number of samples, which is predefined; there is no specific requirement for the value of n, but when n takes a small value, especially when n < p, the method described in this embodiment performs more prominently.

[0057] In this embodiment, a multiple cross-validation method is used to solve the optimal penalty constraint term coefficient of the lasso linear regression model, which specifically includes steps A31 to A33.

[0058] Step A31: Divide the training independent variable X_train into a test set and a training set.

[0059] Randomly divide the training independent variable X_train into N groups, usually choose 5 or 10, take one of the groups as the test set, and take the remaining N - 1 groups as the training set.

[0060] Step A32: Use the training set to train the lasso linear regression model with different penalty constraint term coefficients, and use the test set to test the response values of the trained lasso linear regression model, and record the mean square prediction errors of different penalty constraint term coefficients.

[0061] After dividing the training independent variable X_train into a test set and a training set, train the lasso linear regression model with different penalty constraint term coefficient λ values on the training set, use the test set to test the response values of the trained model, and record the mean square prediction errors of different penalty constraint term coefficient λ values at the same time.

[0062] The process from step A31 to step A32 is repeated at least N times so that each group of data has the opportunity to be used as the test data (i.e., the test set), and the other N - 1 groups are used as the training data (i.e., the training set).

[0063] Step A33: Take the penalty constraint term coefficient corresponding to the minimum mean square prediction error as the optimal penalty constraint term coefficient of the lasso linear regression model.

[0064] For a series of penalty constraint term coefficients λ, at least N different prediction error estimates can be obtained through steps A31 to A32, where the penalty constraint term coefficient λ corresponding to the minimum mean square prediction error is the required optimal estimate value, that is, the optimal penalty constraint term coefficient.

[0065] Step A4: Refit the training independent variable X_train according to the optimal penalty constraint term coefficient to generate a fitting result.

[0066] Step A5: Remove the terms with a coefficient of 0 from the fitting result, and take the remaining terms as the screened dimensions.

[0067] Step A5 is dimensionality reduction, specifically using lasso linear regression to effectively reduce the dimensionality of sparse high-dimensional data. According to the fitting results of step A4, the items with coefficients of 0 are removed, and the remaining items are used as the filtered dimensions.

[0068] Step A6: Reconstruct the feature space based on the remaining items to form new training data and new test data.

[0069] Step A6 is to reconstruct the feature space. In the process of solving the penalty constraint coefficient, the penalty constraint coefficient λ is trained by multiple cross-validation method to obtain the best penalty constraint coefficient λ, and then the dimension with a coefficient of 0 is screened out, and the remaining dimensions are selected to reconstruct the feature space, so as to perform fitting again.

[0070] In this way, according to the items after dimension reduction in step A6, the feature space is reconstructed to form new training data X_tr_lasso and new test data X_te_lasso.

[0071] Step A7: for each host sequence in the new test data, K nearest neighbor classification is performed according to the reconstructed feature space to generate a judgment category.

[0072] Step A7 is K nearest neighbor classification. For each host sequence in the test data, find the K vectors with the closest Euclidean distance from the feature space reconstructed in step A6, and take the category with the larger number (for example, the category with the largest number) among the label categories of the K vectors (the label category can be normal or abnormal) according to the voting principle as the judgment category of the host sequence.

[0073] Step A8: Generate a detection result according to the determined category.

[0074] Step A7 has determined the judgment category of the host sequence, and then a detection result can be generated based on it, such as whether an intrusion is detected or not.

[0075] The method provided in this embodiment adopts a method based on lasso regression to perform reasonable and effective feature selection; in the training of lasso parameters, a multiple cross-validation method is used to iteratively perform pre-training, so as to obtain the optimal value of the penalty constraint term coefficient λ; after feature selection, the feature vector space is reconstructed, and the dimension of the reconstructed feature vector is greatly reduced, which can improve the efficiency of the classification algorithm.

[0076] The method provided in this embodiment is experimented with the ADFA-LD dataset. The method provided in this embodiment (referred to as Lasso-kNN) is compared with traditional methods such as STIDE (threat modeling method), TF-IDF-KNN (TF-IDF is term frequency-inverse document frequency), TextRank-KNN and other algorithms in the case of balanced normal / abnormal data and unbalanced case (the ratio of normal to abnormal data is 6:1).

[0077] The experimental results show that no matter the data is balanced or unbalanced, the detection rate and false alarm rate of the method provided in this embodiment are better than those of other methods.

[0078] refer to Figure 3 In the case of data imbalance, the abnormal sequence detection rate of the method provided in this embodiment is improved by 54% compared with the traditional STIDE method, and by 5.7% compared with the TF-IDF-KNN and TextRank-KNN methods; the false alarm rate is reduced by 83% compared with the STIDE method, and by 57% compared with the TF-IDF-KNN and TextRank-KNN methods.

[0079] refer to Figure 4 After the data is balanced by the generative adversarial network, the abnormal sample detection rate of the method provided in this embodiment is still significantly better, which is 15% higher than that of the STIDE method and 1% higher than that of TF-IDF-KNN and TextRank-KNN. In terms of false alarm rate, it is 60% lower than that of TF-IDF-KNN and TextRank-KNN, and slightly higher than that of the STIDE method.

[0080] refer to Figure 5 In the KNN classification process, compared with other feature extraction-based methods, the method provided by this embodiment effectively reduces the vector dimension, thereby reducing the time for calculating the Euclidean distance of the vector. In the experiment, due to the reduction of the dimension, the method provided by this embodiment effectively improves the calculation efficiency during classification.

[0081] The method provided in this embodiment is a part of the host sequence intrusion detection engine algorithm, wherein the lasso parameter training part (i.e., steps A1 to A3) can be pre-built in the engine, and the KNN classification part (i.e., step A7) can be implemented during the detection application.

[0082] According to the above, in the case of sample imbalance, that is, when the proportion of normal samples is much larger than that of abnormal samples, the method provided by this embodiment can achieve better detection results than the traditional method. Compared with the frequency-based method, the method provided by this embodiment selects features more accurately and the selection results are more interpretable. It is an anomaly detection method with low requirements for training data and good performance.

[0083] Those skilled in the art can understand that all or part of the processes in the embodiment method can be completed by a computer program to instruct the relevant hardware, and the program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the various method embodiments. The aforementioned storage medium includes: ROM or random access memory RAM, magnetic disk or optical disk and other media that can store program codes.

[0084] The above contents are further detailed descriptions of the present invention in combination with specific / preferred embodiments, and it cannot be determined that the specific implementation of the present invention is limited to these descriptions. For ordinary technicians in the technical field to which the present invention belongs, they can also make several substitutions or modifications to these described embodiments without departing from the concept of the present invention, and these substitutions or modifications should be regarded as belonging to the protection scope of the present invention.

Claims

1. A host sequence intrusion detection method, It is characterized in that include: Constructing a feature space of the host intrusion sequence according to different command dimensions, and randomly dividing the feature space into training data and test data according to a set ratio; Regularizing the training data and the test data to generate a training independent variable X_train and a test independent variable X_test, a training dependent variable Y_train and a test dependent variable Y_test; Using the training independent variable X_train to train the lasso linear regression model, to obtain the optimal penalty constraint term coefficient of the lasso linear regression model; Refitting the training independent variable X_train according to the optimal penalty constraint term coefficient to generate a fitting result; For the fitting results, the items with coefficients of 0 are removed, and the remaining items are used as the dimensions after screening; Reconstructing the feature space according to the remaining items to form new training data and new test data; For each host sequence in the new test data, K nearest neighbor classification is performed according to the reconstructed feature space to generate a determination category; A detection result is generated according to the determination category.

2. The method according to claim 1, It is characterized in that The lasso linear regression model is trained using the training independent variable X_train to obtain the optimal penalty constraint term coefficient of the lasso linear regression model, including: solving the optimal penalty constraint term coefficient by a multiple cross-validation method.

3. The method according to claim 1, It is characterized in that The lasso linear regression model is trained using the training independent variable X_train to obtain the optimal penalty constraint term coefficient of the lasso linear regression model, including: Divide the training independent variable X_train into a test set and a training set; Using the training set to train the lasso linear regression model with different penalty constraint term coefficients, and using the test set to test the response value of the trained lasso linear regression model, and recording the mean square prediction error of different penalty constraint term coefficients; The penalty constraint term coefficient corresponding to the minimum mean square prediction error is used as the optimal penalty constraint term coefficient of the lasso linear regression model.

4. The method according to claim 3, It is characterized in that The training independent variable X_train is divided into a test set and a training set, including: The training independent variable X_train is randomly divided into N groups, one of which is used as a test set, and the remaining N-1 groups are used as training sets.

5. The method according to claim 4, It is characterized in that Repeat N times: Randomly divide the training independent variable X_train into N groups, use one group as a test set, and use the remaining N-1 groups as training sets; The training set is used to train the lasso linear regression model with different penalty constraint term coefficients, and the test set is used to test the response value of the trained lasso linear regression model, and the mean square prediction error of different penalty constraint term coefficients is recorded.

6. The method according to claim 1, It is characterized in that For each host sequence in the new test data, K nearest neighbor classification is performed according to the reconstructed feature space to generate a judgment category, including: finding K vectors with the closest Euclidean distance from the reconstructed feature space, and taking the category with a larger number in the label categories of the K vectors according to the voting principle as the judgment category of the host sequence in each new test data.

7. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores program instructions, and when the program instructions are executed by a processor of a computer, the processor is caused to execute the method according to any one of claims 1 to 6.