Application Intrusion Detection Methods
Through the combination of N-Gram algorithm and K nearest neighbor algorithm, the problem of high storage space and false positive rate in the existing technology is solved, and high-accuracy system call anomaly detection is achieved, which is suitable for intrusion detection of applications in containers.
Patent Information
- Application Number
- CN202011579484.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-28
- Publication Date
- 2024-09-27
- Estimated Expiration
- 2040-12-28
AI Technical Summary
Existing system call anomaly detection methods are difficult to maintain high accuracy while ensuring less storage space, and have a high false positive rate, and cannot effectively detect malicious attacks on applications running in containers.
The N-Gram algorithm is used to divide system call records into multiple byte fragments to generate system call packages, and through the update of the normal behavior database and abnormal behavior database and the pre-classification of the K nearest neighbor algorithm, the storage space requirements and false alarm rate are reduced. Improve detection accuracy.
It achieves high-accuracy intrusion detection with less storage space. By continuously updating the database and using the K nearest neighbor algorithm, the false alarm rate is significantly reduced and the detection accuracy is improved.
Smart Images

Figure CN112765599B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computers, and in particular to an intrusion detection method for an application program. Background Art
[0002] Containers are a way to abstract processes and file systems into a single unit that is independent of the kernel. It provides a lightweight virtual environment that groups and isolates a set of processes and resources (such as memory, CPU, disk, etc.) from the host and any other containers. Docker is an example of container technology. By using control groups and security components, the attack surface can be minimized, but attacks on applications running in containers are still possible. As containers become more and more attractive for personal and industrial use, more and more critical tasks are integrated into containers, so real-time detection of malicious attacks is particularly important.
[0003] There are two basic methods for detecting anomalies in system calls: sequence-based method and frequency-based method. The former requires that the system call sequence is completely ordered, which has poor accuracy and high storage requirements, while the latter ignores the system call sequence, which makes the frequency-based technology require less storage space and better performance, but also greatly increases the false alarm rate. Summary of the invention
[0004] Purpose of the invention: The purpose of the present invention is to provide an intrusion detection method for an application program, which can have a high accuracy and false alarm rate while ensuring that less storage space is required.
[0005] Technical solution: The intrusion detection method of the application program described in the present invention comprises the following steps:
[0006] Step 100: Orderly retrieve system call records and generate a real-time system call list;
[0007] Step 200: using the N-Gram algorithm to divide the real-time system call list into multiple byte segments, and generating a system call packet according to the type and frequency of the byte segments appearing in each system call record;
[0008] Step 300: pre-classify the system call packets according to the normal behavior database and the abnormal behavior database through a classification algorithm, count whether the frequency of each system call packet belonging to abnormal behavior exceeds a specified value, and update the normal behavior database and the abnormal behavior database according to the statistical results.
[0009] Furthermore, the normal behavior database and the abnormal behavior database in step 300 are generated by training in the following steps:
[0010] Step 400: When the operation is completed and the system call stops being added, all system call records are retrieved and a copy of the system call list is generated;
[0011] Step 410: using the N-Gram algorithm to divide the system call list copy into multiple byte segments, and counting the occurrence frequency of each byte segment;
[0012] Step 420: Take the top N byte segments in terms of frequency of occurrence from all byte segments, and generate a byte segment index table by marking indexes 1 to N for each byte segment according to the frequency of occurrence, and add index N+1 at the end of the byte segment index table to correspond to all byte segments that do not appear in the byte segment index table, where N is a natural number greater than 0;
[0013] Step 430: Divide the system call list copy into normal behavior samples and abnormal behavior samples according to known normal behaviors and abnormal behaviors, and generate system call packages according to the types and frequencies of byte fragments appearing in each call record in the normal behavior samples and the abnormal behavior samples, count the system call packages generated by the call records in the normal behavior samples and their frequencies of occurrence to build a normal behavior database, and count the types and frequencies of system call packages generated by the call records in the abnormal behavior samples to build an abnormal behavior database.
[0014] Furthermore, the system call packets in step 200 and step 430 are generated according to the byte segment index table in step 420, and the structure of the system call packet is <k1, k2...k n >, where k i Indicates the number of times the byte segment with index i in the byte segment index table appears in this system call.
[0015] Furthermore, the step 300 includes:
[0016] Step 310: pre-classify the system call packet using a classification algorithm according to the normal behavior database and the abnormal behavior database;
[0017] Step 320: directly storing the system call packets belonging to normal behavior into the normal behavior database, and temporarily storing the system call packets belonging to abnormal behavior;
[0018] Step 330: Count the occurrence frequency of each system call packet belonging to abnormal behavior, store the system call packets belonging to abnormal behavior with an occurrence frequency higher than the specified value into the abnormal behavior database, and issue an abnormal reminder, and store the system call packets belonging to abnormal behavior with an occurrence frequency equal to or lower than the specified value into the normal behavior database.
[0019] Furthermore, the classification algorithm in step 300 includes a K-nearest neighbor algorithm.
[0020] Furthermore, the data formats of the normal behavior database and the abnormal behavior database in step 300 are as follows:<BoSC,value> , where BoSC represents the system call package, and value represents the occurrence frequency of the system call package.
[0021] Beneficial effects: Compared with the prior art, the present invention has the following advantages:
[0022] 1. Use the N-Gram algorithm to group system call records to reduce the algorithm's requirements for storage space.
[0023] 2. During the detection process, the normal behavior database and the abnormal behavior database are continuously updated to improve the detection accuracy.
[0024] 3. The K nearest neighbor algorithm is used as the classification algorithm, and the training time complexity is low. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] Figure 1 A flowchart of an application intrusion detection method according to a first embodiment of the present invention;
[0026] Figure 2 A flowchart of a database training process according to an embodiment of the present invention;
[0027] Figure 3 This is a flow chart of an application intrusion detection method according to a second embodiment of the present invention. DETAILED DESCRIPTION
[0028] The technical solution of the present invention is further described below in conjunction with the accompanying drawings.
[0029] Reference Figure 1 According to an embodiment of the present invention, the intrusion detection method for an application program comprises the following steps:
[0030] Step 100: Orderly retrieve system call records and generate a real-time system call list;
[0031] Step 200: using the N-Gram algorithm to divide the real-time system call list into multiple byte segments, and generating a system call packet according to the type and frequency of the byte segments appearing in each system call record;
[0032] Step 300: pre-classify the system call packets according to the normal behavior database and the abnormal behavior database through a classification algorithm, count whether the frequency of each system call packet belonging to abnormal behavior exceeds a specified value, and update the normal behavior database and the abnormal behavior database according to the statistical results.
[0033] According to the intrusion detection method of the application of the above technical solution, the retrieved ordered system call records are divided into multiple byte segments through the N-Gram algorithm, and the frequency of occurrence of each byte segment is counted, and the system call package is generated according to the frequency of occurrence of each byte segment in each system call record, which reduces the algorithm's requirements for storage space. At the same time, after each detection, the system call packages belonging to normal behavior and the system call packages belonging to abnormal behavior in this detection are stored in the normal behavior database and the abnormal behavior database respectively according to the detection results, and the normal behavior database and the abnormal behavior database are updated. In this way, after multiple detection processes, the classification of system call packages based on the normal behavior database and the abnormal behavior database through the classification algorithm will become more and more accurate, so that the above intrusion detection method has a smaller requirement for storage space and can also have a higher accuracy rate.
[0034] In this embodiment, taking the detection of the Docker application in the Linux system as an example, each time the detection is performed, the system call tracking command strace provided by the Linux system is used to track the system calls generated by the Docker process, filter out the parameters, return values, execution time, etc., and generate system call records. The system call records are grouped using the Bi-Gram algorithm in the N-Gram algorithm, that is, each byte segment divided contains two ordered system calls. It is understandable that in actual use, other N-Gram algorithms, such as Tri-Gram, etc., can be selected according to actual conditions, and the number of system calls called each time the detection is called should also be selected according to actual conditions. Appropriate values.
[0035] Reference Figure 2 In some embodiments, the normal behavior database and abnormal behavior database used by the classification algorithm are generated by training in the following steps:
[0036] Step 400: When the operation is completed and the system call stops being added, all system call records are retrieved and a copy of the system call list is generated;
[0037] Step 410: using the N-Gram algorithm to divide the system call list copy into multiple byte segments, and counting the occurrence frequency of each byte segment;
[0038] Step 420: Take the top N byte segments in terms of frequency of occurrence from all byte segments, and generate a byte segment index table by marking indexes 1 to N for each byte segment according to the frequency of occurrence, and add index N+1 at the end of the byte segment index table to correspond to all byte segments that do not appear in the byte segment index table, where N is a natural number greater than 0;
[0039] Step 430: Divide the system call list copy into normal behavior samples and abnormal behavior samples according to known normal behaviors and abnormal behaviors, and generate system call packages according to the types and frequencies of byte fragments appearing in each call record in the normal behavior samples and the abnormal behavior samples, count the system call packages generated by the call records in the normal behavior samples and their frequencies of occurrence to build a normal behavior database, and count the types and frequencies of system call packages generated by the call records in the abnormal behavior samples to build an abnormal behavior database.
[0040] It is understandable that when training the normal behavior database and the abnormal behavior database, the N-Gram algorithm is used to group all system calls until a certain system call is stopped, and during the detection process, a certain number of system call records retrieved in real time are grouped.
[0041] In this embodiment, N in the byte segment index table is 19, that is, there are 20 records in the table, the first 19 records are the top 19 system call packets in the system call records, and the 20th record represents all the remaining system call packets that are not included in the above 19 system call packets. The structure is shown in Table 1.
[0042] Taking the system call sequences [access, access, openat, fstat, mmap, close, access, openat, read, fstat, mmap, mmap], [access, openat, fstat, mmap, close, access, openat, read, fstat, mmap, mmap, close], [openat, fstat, mmap, close, access, openat, read, fstat, mmap, mmap, close, access], [fstat, mmap, close, access, openat, read, fstat, mmap, mmap, close, access, openat], and N as 2 in the N-gram as an example, we can get the byte fragment index in Table 1.
[0043] Table 1 Byte fragment index table
[0044]
[0045] In some embodiments, the system call packets in step 200 and step 430 are generated according to the byte segment index table in step 420, and the specific structure of the system call packet is: n >, where k iIndicates the number of occurrences of the byte segment indexed by i in the byte segment index table in the system call. Each system call sequence can generate a corresponding system call packet according to the above byte segment index table, and system call packets with the same structure are considered to be the same system call packets.
[0046] Referring to Table 2, in some embodiments, the data structure of the normal behavior database and the abnormal behavior database is as follows:<BoSC,value> , where BoSC represents the system call package, and value represents the occurrence frequency of the system call package.
[0047] Table 2 Behavior database structure
[0048]
[0049] Reference Figure 3 In some embodiments, step 300 includes the following steps:
[0050] Step 310: pre-classify the system call packet using a classification algorithm according to the normal behavior database and the abnormal behavior database;
[0051] Step 320: directly storing the system call packets belonging to normal behavior into the normal behavior database, and temporarily storing the system call packets belonging to abnormal behavior;
[0052] Step 330: Count the occurrence frequency of each system call packet belonging to abnormal behavior, store the system call packets belonging to abnormal behavior with an occurrence frequency higher than the specified value into the abnormal behavior database, and issue an abnormal reminder, and store the system call packets belonging to abnormal behavior with an occurrence frequency equal to or lower than the specified value into the normal behavior database.
[0053] It is understandable that in step 330, when the frequency of a system call package belonging to abnormal behavior in the system call sequence called during this detection process is higher than the preset specified value, an abnormal reminder is issued and the system call package is stored in the abnormal behavior database. If the system call package already exists in the abnormal behavior database, the frequency of occurrence during this detection process is added to the value corresponding to the system call package in the abnormal behavior database. If the system call package does not exist in the abnormal behavior database,<BoSC,value> The abnormal behavior database is stored in the form of and assigned a value of 1. The normal behavior database is updated in the same way. Through the above behavior database update method, as the number of detections increases, the behavior database will become more and more complete, and the accuracy of the detection method will become higher and higher.
[0054] In some embodiments, the classification algorithm in step 300 adopts the K nearest neighbor algorithm, that is, K pieces of data that are most similar to the structure of the classified system call packet are selected from the normal behavior database and the abnormal behavior database. If more of the K pieces of data belong to the normal behavior database, the system call packet belongs to normal behavior, and if more of the K pieces of data belong to the abnormal behavior database, the system call packet belongs to abnormal behavior. It can be understood that the number of data K selected from the normal behavior database and the abnormal behavior database should be an odd number. The K nearest neighbor algorithm is an instance-based learning classification algorithm, which has no displayed learning process, low training time complexity and high accuracy.
Claims
1. A method for intrusion detection of an application, characterized in that: The steps include: Step 100: Orderly retrieve system call records and generate a real-time system call list; Step 200: using the N-Gram algorithm to divide the real-time system call list into multiple byte segments, and generating a system call packet according to the type and frequency of the byte segments appearing in each system call record; Step 300: According to the normal behavior database and the abnormal behavior database, the system call packet is pre-classified by the classification algorithm, and the frequency of each system call packet belonging to abnormal behavior exceeds the specified value, and the normal behavior database and the abnormal behavior database are updated according to the statistical results; The normal behavior database and the abnormal behavior database in step 300 are generated by training in the following steps: Step 400: When the operation is completed and the system call stops being added, all system call records are retrieved and a copy of the system call list is generated; Step 410: using the N-Gram algorithm to divide the system call list copy into multiple byte segments, and counting the occurrence frequency of each byte segment; Step 420: Take the top N byte segments in terms of frequency of occurrence from all byte segments, and generate a byte segment index table by marking indexes 1 to N for each byte segment according to the frequency of occurrence, and add index N+1 at the end of the byte segment index table to correspond to all byte segments that do not appear in the byte segment index table, where N is a natural number greater than 0; Step 430: dividing the system call list copy into normal behavior samples and abnormal behavior samples according to known normal behaviors and abnormal behaviors, and generating system call packets according to the types and frequencies of byte segments appearing in each call record in the normal behavior samples and the abnormal behavior samples, counting the system call packets generated by the call records in the normal behavior samples and their frequencies to construct a normal behavior database, and counting the system call packets generated by the call records in the abnormal behavior samples and their frequencies to construct an abnormal behavior database; The system call packets in step 200 and step 430 are generated according to the byte segment index table in step 420. The structure of the system call packet is: ,in Indicates the number of times the byte segment with index i in the byte segment index table appears in this system call, where i is a natural number greater than 0 and less than or equal to N.
2. The intrusion detection method for an application according to claim 1, characterized in that: The step 300 includes: Step 310: pre-classify the system call packet using a classification algorithm according to the normal behavior database and the abnormal behavior database; Step 320: directly storing the system call packets belonging to normal behavior into the normal behavior database, and temporarily storing the system call packets belonging to abnormal behavior; Step 330: Count the occurrence frequency of each system call packet belonging to abnormal behavior, store the system call packets belonging to abnormal behavior with an occurrence frequency higher than the specified value into the abnormal behavior database, and issue an abnormal reminder, and store the system call packets belonging to abnormal behavior with an occurrence frequency equal to or lower than the specified value into the normal behavior database.
3. The intrusion detection method for an application according to claim 1, characterized in that: The classification algorithm in step 300 includes a K-nearest neighbor algorithm.
4. The intrusion detection method for an application according to claim 1 or 2, characterized in that: The data formats of the normal behavior database and the abnormal behavior database in step 300 are as follows:<BoSC,value> , where BoSC represents the system call package, and value represents the occurrence frequency of the system call package.
Citation Information
Patent Citations
Method for n-gram-based multi-feature flow load type detection
CN105871619A
Method for identifying abnormal application program, mobile terminal and server
CN107145782A
Intelligent terminal malicious software dynamic detection method based on system call
CN109753801A
In-container process abnormal behavior detection method and system
CN109858244A
Software behavior sampling method, related equipment and software system
CN110175456A
