Kernel vulnerability detection method, device and storage medium
By using the memory manager to obtain the memory address and distribution information of the kernel object when the target process creates and destroys the kernel object, and judging the kernel pool injection behavior, the problem of inaccurate kernel vulnerability detection in the existing technology is solved, and the detection of kernel vulnerabilities is realized. Efficient detection and prevention.
Patent Information
- Application Number
- CN201911050802.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-10-31
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2040-10-06
AI Technical Summary
Kernel vulnerability detection methods in the existing technology are not accurate enough and are difficult to detect kernel vulnerabilities of hackers without elevating their rights, resulting in the inability to effectively prevent system attacks.
By using the memory manager to obtain the memory address and distribution information of the kernel object when the target process creates and destroys the kernel object, it determines whether there is kernel pool injection behavior, thereby determining the vulnerability exploitation situation.
It improves the accuracy of kernel vulnerability detection and can effectively detect and prevent hacker system attacks.
Smart Images

Figure CN110826073B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer security technology, and in particular to a kernel vulnerability detection method, device and storage medium. Background Art
[0002] Malicious network behavior refers to the behavior that the hardware, software and data of the network system are damaged, changed or leaked due to malicious code attacks, which makes the system unable to run continuously and reliably, and the network service is interrupted. With the popularization of informatization and the emergence of a large number of new network applications, the behaviors exhibited by network malicious codes are also emerging in an endless stream. At present, the most popular network malicious behaviors are web page Trojans, account theft, port scanning, vulnerability scanning, Address Resolution Protocol (ARP) spoofing, Internet Protocol (IP) hijacking, Distributed Denial of Service (DDOS) attacks, overflow attacks, Trojan attacks, etc.
[0003] A vulnerability is a defect in the specific implementation of hardware, software, or a protocol, or in the system security policy, which can enable an attacker to access or damage the system without authorization. The kernel is the core of the operating system, and how to detect kernel vulnerabilities is of utmost importance in security protection. The kernel vulnerability detection methods in the prior art are: first, kernel vulnerability detection is performed through static features, but this method is easily bypassed, resulting in inaccurate detection and failure to defend against unknown threats; second, kernel vulnerability detection is performed by detecting the behavior of hackers who, when invading the system, obtain the highest authority of the system (such as administrator authority) by elevating their privileges to gain control of the operating system. However, if the hacker does not elevate his privileges when invading the system, it is difficult to detect kernel vulnerabilities. Therefore, how to effectively detect kernel vulnerabilities and prevent hackers from attacking the system has become a problem that needs to be solved urgently in the prior art. Summary of the invention
[0004] In view of the above problems in the prior art, an object of the present invention is to provide a kernel vulnerability detection method, device and storage medium, which can improve the accuracy of kernel vulnerability detection.
[0005] In order to solve the above problems, the present invention provides a kernel vulnerability detection method, comprising:
[0006] When the target process creates a first kernel object, obtaining relevant information of the first kernel object, the relevant information including a memory address of the first kernel object;
[0007] Saving the first kernel object to a memory manager corresponding to the target process, and determining a first memory area of the memory manager where the first kernel object is located according to the memory address;
[0008] Acquire memory layout information of the first memory area, where the memory layout information includes distribution information of kernel objects in the first memory area;
[0009] Determine whether the target process has kernel pool injection vulnerability exploitation behavior according to the distribution information of the kernel objects in the first memory area.
[0010] Another aspect of the present invention provides a kernel vulnerability detection device, comprising:
[0011] A first acquisition module, configured to acquire relevant information of a first kernel object when a target process creates the first kernel object, wherein the relevant information includes a memory address of the first kernel object;
[0012] A first determining module, configured to save the first kernel object to a memory manager corresponding to the target process, and determine a first memory area of the memory manager where the first kernel object is located according to the memory address;
[0013] A second acquisition module is used to acquire memory layout information of the first memory area, where the memory layout information includes distribution information of kernel objects in the first memory area;
[0014] The second determination module is used to determine whether the target process has a vulnerability exploitation behavior of kernel pool injection according to the distribution information of the kernel objects in the first memory area.
[0015] Another aspect of the present invention provides a kernel vulnerability detection method, comprising:
[0016] When the target process destroys the second kernel object, obtaining relevant information of the second kernel object, the relevant information including the memory address of the second kernel object;
[0017] Determine, according to the memory address, a second memory area of the memory manager where the second kernel object is located, and delete the second kernel object from the second memory area;
[0018] Acquire memory layout information of the second memory area, where the memory layout information includes distribution information of kernel objects in the second memory area;
[0019] Determine whether the target process has kernel pool injection vulnerability exploitation behavior according to the distribution information of the kernel objects in the second memory area.
[0020] Another aspect of the present invention provides a kernel vulnerability detection device, comprising:
[0021] A third acquisition module, configured to acquire relevant information of the second kernel object when the target process destroys the second kernel object, wherein the relevant information includes a memory address of the second kernel object;
[0022] a third determining module, configured to determine, according to the memory address, a second memory area of the memory manager where the second kernel object is located, and delete the second kernel object from the second memory area;
[0023] a fourth acquisition module, configured to acquire memory layout information of the second memory area, wherein the memory layout information includes distribution information of kernel objects in the second memory area;
[0024] The fourth determination module is used to determine whether the target process has a vulnerability exploitation behavior of kernel pool injection according to the distribution information of the kernel objects in the second memory area.
[0025] On the other hand, the present invention provides a server, which includes a processor and a memory, wherein the memory stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by the processor to implement the method as described above.
[0026] On the other hand, the present invention provides a computer-readable storage medium, which stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by a processor to implement the method as described above.
[0027] Due to the above technical solution, the present invention has the following beneficial effects:
[0028] The kernel vulnerability detection method, device and storage medium of the present invention manage the kernel objects created by the target process by using a memory manager. When monitoring the target object to create kernel objects and destroy kernel objects, it is determined whether the target process has vulnerability exploitation behavior of kernel pool injection based on whether the distribution of kernel objects in the memory manager meets the characteristics of kernel pool injection and memory layout, so as to determine whether there is a vulnerability in the kernel, thereby realizing the detection of kernel vulnerabilities and greatly improving the accuracy of kernel vulnerability detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] In order to more clearly illustrate the technical solution of the present invention, the following briefly introduces the drawings required for use in the embodiments or prior art descriptions. Obviously, the drawings described below are only some embodiments of the present invention, and for those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative work.
[0030] Figure 1 It is a schematic diagram of an implementation scenario of a kernel vulnerability detection method provided by an embodiment of the present invention;
[0031] Figure 2 is a flow chart of a kernel vulnerability detection method provided by an embodiment of the present invention;
[0032] Figure 3 is a flow chart of a kernel vulnerability detection method provided by another embodiment of the present invention;
[0033] Figure 4 is a flow chart of a kernel vulnerability detection method provided by another embodiment of the present invention;
[0034] Figure 5 is a schematic diagram of a memory layout provided by an embodiment of the present invention;
[0035] Figure 6 is a flow chart of a kernel vulnerability detection method provided by another embodiment of the present invention;
[0036] Figure 7 is a schematic diagram of a memory layout provided by another embodiment of the present invention;
[0037] Figure 8 is a flow chart of a kernel vulnerability detection method provided by another embodiment of the present invention;
[0038] Fig. 9 is a flow chart of a kernel vulnerability detection method provided by another embodiment of the present invention;
[0039] Fig.10 is a schematic diagram of a memory layout provided by another embodiment of the present invention;
[0040] Fig.11 It is a structural diagram of a kernel vulnerability detection device provided by an embodiment of the present invention;
[0041] Fig.12 is a schematic diagram of the structure of a kernel vulnerability detection device provided by another embodiment of the present invention;
[0042] Fig.13 It is a schematic diagram of the structure of a server provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0043] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0044] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, device, product or equipment that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or equipment.
[0045] In the existing operating system kernel vulnerability exploitation process, each vulnerability has its own characteristics, and there is no universal detection solution. Through the study of previous kernel vulnerability exploitation processes, it is found that hackers often first perform kernel pool (pool) injection and memory layout, and then continue to exploit kernel vulnerabilities. The present invention mainly implements a new kernel vulnerability detection solution by utilizing the characteristics of pool injection and memory layout. In order to make the objectives, technical solutions and advantages disclosed in the embodiments of the present invention clearer, the embodiments of the present invention are further described in detail in combination with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the embodiments of the present invention and are not used to limit the embodiments of the present invention. First, the embodiments of the present invention explain the following concepts:
[0046] Kernel objects: Kernel objects are data structures maintained by the operating system for some system-level objects (such as processes, threads, and semaphores). These data structures store system-level information related to system-level objects. For example, all kernel objects store the reference count of the object, process objects store the process identification (ID), and file objects store the current byte offset, sharing mode, open mode, etc. All kernel objects in the operating system are stored in a memory space, and all processes on the system share this memory space.
[0047] Please refer to the instruction manual Figure 1, which shows a schematic diagram of an implementation scenario of a kernel vulnerability detection method provided by an embodiment of the present invention. In this scenario, the entire kernel vulnerability detection process is implemented in a server. The server is provided with a dynamic detection sandbox. The sample program to be detected runs in the dynamic detection sandbox. The behavior of creating kernel objects by the process or subprocess corresponding to the sample program to be detected is intercepted and analyzed to complete the kernel vulnerability detection and obtain and output the detection result.
[0048] The following describes the kernel vulnerability detection method provided by the embodiment of the present invention. Please refer to the attached manual for details. Figure 2 , which shows the process of a kernel vulnerability detection method provided by an embodiment of the present invention, the kernel vulnerability detection method can be applied to the kernel vulnerability detection device provided by an embodiment of the present invention, and the kernel vulnerability detection device can be configured in a server. The server may include an independently running server, or a distributed server, or a server cluster composed of multiple servers.
[0049] It should be noted that this specification provides method operation steps as described in the embodiments or flow charts, but more or fewer operation steps may be included based on routine or non-creative work. The order of steps listed in the embodiments is only one way of executing the steps among many orders, and does not represent the only order of execution. When the actual system or product is executed, it can be executed in the order of the method shown in the embodiments or the drawings or in parallel (for example, in a parallel processor or multi-threaded processing environment). Figure 2 As shown, the method may include the following steps:
[0050] S210: When the target process creates a first kernel object, obtain relevant information of the first kernel object, where the relevant information includes a memory address of the first kernel object.
[0051] In a possible embodiment, when the target process creates the first kernel object, before obtaining the relevant information of the first kernel object, the following may also be included:
[0052] When the system creates the target process, obtaining the process identifier of the target process;
[0053] A memory manager corresponding to the target process is created according to the process identifier.
[0054] In the embodiment of the present invention, the event of the system creating a target process can be monitored by registering a process monitoring program (Process Notify Routine). When the event of the system creating a target process occurs, a memory manager corresponding to the target process can be created according to the process ID of the target process to save the type and quantity of kernel objects created by the target process and the memory distribution of each kernel object. It should be noted that other methods can also be used to monitor the event of the system creating a target process, and the embodiment of the present invention does not limit this.
[0055] In another possible embodiment, Figure 3 As shown, when the target process creates a first kernel object, obtaining relevant information of the first kernel object may include:
[0056] S211: Monitor the event of the target process creating a first kernel object, and when the event of the target process creating the first kernel object occurs, obtain the object body information of the first kernel object.
[0057] S212: Determine the object header information of the first kernel object according to the object body information.
[0058] S213: Determine the memory address of the first kernel object according to the object header information.
[0059] In the embodiment of the present invention, several common kernel functions such as object creation function (nt! ObCreateObject), desktop heap allocation function (win32k! DesktopAlloc) and object allocation function (win32k! AllocateObject) can be hooked to monitor the event of the target process creating the first kernel object. When the event of the target process creating the first kernel object occurs, the object body information of the created first kernel object is obtained, and the object header information of the first kernel object is calculated based on the object body information. According to the object header information, the type of the first kernel object can be determined, and the memory address of the first kernel object and other information can be calculated. It should be noted that other methods can also be used to monitor the event of the target process creating the first kernel object, and the embodiment of the present invention does not limit this.
[0060] S220: Save the first kernel object to a memory manager corresponding to the target process, and determine a first memory area of the memory manager where the first kernel object is located according to the memory address.
[0061] In an embodiment of the present invention, after obtaining various information of the first kernel object, the various information of the first kernel object can be saved in a memory manager corresponding to the target process so as to manage the kernel object created by the target process. The first memory area may include a continuous memory area storing a plurality of kernel objects with adjacent memory addresses. In a possible embodiment, the relevant information of the pool where the kernel object is located can be determined based on the relevant information of the kernel object, and the relevant information can be encapsulated into a structure and inserted into the memory manager corresponding to the target process.
[0062] In a possible embodiment, saving the first kernel object to a memory manager corresponding to the target process, and determining the first memory area where the first kernel object is located according to the memory address may include:
[0063] Acquire a target kernel object in the memory manager that is adjacent to the memory address of the first kernel object;
[0064] The memory address of the first kernel object is merged with the target memory area where the target kernel object is located to form a first memory area.
[0065] Specifically, the kernel objects created by the target process are managed in the memory manager. If the memory addresses of two or more kernel objects are adjacent, the memory addresses of the two or more kernel objects can be merged to form a continuous memory area, and the type and number of kernel objects and the memory size of the current memory area are recorded. When the memory manager stores a target kernel object adjacent to the memory address of the first kernel object, the memory address of the first kernel object can be merged with the target memory area where the target kernel object is located to form a first memory area.
[0066] S230: Obtain memory layout information of the first memory area, where the memory layout information includes distribution information of kernel objects in the first memory area.
[0067] In the embodiment of the present invention, the distribution information of the kernel objects may include information such as the type, quantity and memory address of the kernel objects.
[0068] S240: Determine whether the target process has a kernel pool injection vulnerability exploitation behavior according to the distribution information of the kernel objects in the first memory area.
[0069] In an embodiment of the present invention, the distribution information of the kernel object may include information such as the type, quantity and memory address of the kernel object. By judging whether the distribution information of the kernel object in the first memory area satisfies a preset distribution state, it can be determined whether the target process has kernel pool injection vulnerability exploitation behavior.
[0070] In one possible embodiment, Figure 4 As shown, determining whether the target process has a kernel pool injection vulnerability exploitation behavior according to the distribution information of the kernel objects in the first memory area may include:
[0071] S2411: Determine a kernel object set according to distribution information of kernel objects in the first memory area, wherein the kernel object set includes a plurality of consecutively created kernel objects with adjacent memory addresses, and each of the kernel objects is of the same type.
[0072] S2412: If the number of kernel objects in the kernel object set is greater than a first preset threshold, it is determined that the target process has a kernel pool injection vulnerability exploitation behavior.
[0073] In the embodiment of the present invention, it is possible to determine whether a vulnerability exploitation behavior pool spray occurs by determining whether a large number of kernel objects of the same type and whose memory addresses are all adjacent appear in the first memory area. Figure 5 , the first memory area stores multiple continuously created kernel objects 51 of the same type and with adjacent memory addresses. When the number of the kernel objects 51 exceeds a first preset threshold (for example, it can be set to 500), it can be determined that the target process has a pool injection vulnerability exploitation behavior.
[0074] In another possible embodiment, Figure 6 As shown, determining whether the target process has a kernel pool injection vulnerability exploitation behavior according to the distribution information of the kernel objects in the first memory area may include:
[0075] S2421: If the memory layout information of the first memory area is in pages, determine a memory page set according to the distribution information of the kernel objects in the first memory area, the memory page set comprising a plurality of consecutive memory pages, and the type and quantity of the kernel objects in each of the memory pages are the same;
[0076] S2422: If the number of memory pages in the memory page set is greater than a second preset threshold, it is determined that the target process has a kernel pool injection vulnerability exploitation behavior.
[0077] In the embodiment of the present invention, since the memory page of the memory manager may have a remaining memory area, the memory size of the remaining memory area cannot accommodate a kernel object, which may cause the memory address of the kernel object between two adjacent memory pages to be discontinuous and cannot be used. Figure 4 The vulnerability detection method shown in the figure is used to determine the vulnerability exploitation behavior. At this time, the memory layout information in multiple memory pages can be used to determine whether the vulnerability exploitation behavior pool injection occurs. Figure 7 , the memory layout information of the first memory area is in pages, the memory addresses of each memory page 71 are continuous, and each memory page 71 stores the same number of kernel objects 72 of the same type and adjacent memory addresses. When the number of the memory pages 71 exceeds a second preset threshold (for example, it can be set to 40), it can be determined that the target process has a pool injection vulnerability exploitation behavior.
[0078] In summary, the kernel vulnerability detection method of the present invention manages the kernel objects created by the target process by using a memory manager. When the target object is monitored to create a kernel object, it is determined whether the target process has a vulnerability exploitation behavior of kernel pool injection based on whether the distribution of kernel objects in the memory manager meets the characteristics of kernel pool injection and memory layout, so as to determine whether there is a vulnerability in the kernel, thereby realizing the detection of kernel vulnerabilities, and greatly improving the accuracy of kernel vulnerability detection.
[0079] Please refer to the instruction manual Figure 8 , which shows the process of a kernel vulnerability detection method provided by another embodiment of the present invention. The kernel vulnerability detection method can be applied to the kernel vulnerability detection device provided by an embodiment of the present invention, and the kernel vulnerability detection device can be configured in a server. Figure 8 As shown, the method may include the following steps:
[0080] S810: When the target process destroys the second kernel object, obtain relevant information of the second kernel object, where the relevant information includes a memory address of the second kernel object.
[0081] In the embodiment of the present invention, several common kernel functions such as object destruction function (nt! ObfDereferenceObject), desktop heap release function (win32k! FreeDesktop), and object release function (win32k! FreeObjec) can be hooked to monitor the event of the target process destroying the second kernel object. When the event of the target process destroying the second kernel object occurs, the object body information of the second kernel object to be destroyed is obtained, and the object header information of the second kernel object is calculated based on the object body information. According to the object header information, the type of the second kernel object can be determined, and the memory address of the second kernel object and other information can be calculated. It should be noted that other methods can also be used to monitor the event of the target process destroying the second kernel object, and the embodiment of the present invention does not limit this.
[0082] S820: Determine a second memory area of the memory manager where the second kernel object is located according to the memory address, and delete the second kernel object from the second memory area.
[0083] In the embodiment of the present invention, after obtaining various information of the second kernel object, the second memory area of the memory manager where the second kernel object is located can be determined according to the memory address, and the second memory area can include a continuous memory area storing a plurality of kernel objects with adjacent memory addresses. At the same time, the second kernel object can be deleted from the second memory area.
[0084] S830: Obtain memory layout information of the second memory area, where the memory layout information includes distribution information of kernel objects in the second memory area.
[0085] In the embodiment of the present invention, the distribution information of the kernel objects may include information such as the type, quantity and memory address of the kernel objects.
[0086] S840: Determine whether the target process has a kernel pool injection vulnerability exploitation behavior based on the distribution information of the kernel objects in the second memory area.
[0087] In the embodiment of the present invention, whether the target process has a pool injection vulnerability exploitation behavior can be determined by judging whether the distribution information of the kernel objects in the second memory area satisfies a preset distribution state.
[0088] In one possible embodiment, Fig. 9 As shown, determining whether the target process has a kernel pool injection vulnerability exploitation behavior according to the distribution information of the kernel objects in the second memory area may include:
[0089] S841: Obtain the memory size of the second memory area.
[0090] S842: When the memory size of the second memory area meets a preset condition, determine the number of holes in the second memory area according to distribution information of kernel objects in the second memory area.
[0091] S843: If the number of holes is greater than a third preset threshold, it is determined that the target process has a vulnerability exploitation behavior of kernel pool injection.
[0092] In an embodiment of the present invention, the memory size of the second memory area can be determined by the number of kernel objects stored in the second memory area. If the maximum number of kernel objects with adjacent memory addresses stored in the second memory area is greater than a preset number, it can be determined that the memory size of the second memory area meets a preset condition. The hole may include a hole in the memory space formed after the kernel object is deleted. If the number of holes in the second memory area is greater than a third preset threshold, it can be determined that the target process has a pool injection vulnerability exploitation behavior. Exemplarily, in conjunction with the reference specification, Fig.10 , the second memory area may include multiple kernel objects 101 and multiple holes 102. When the maximum number of kernel objects with adjacent memory addresses stored in the second memory area is greater than a preset number (for example, it can be set to 400), and the number of the holes 102 is greater than a third preset threshold (for example, it can be set to 10), it can be determined that the target process has a pool injection vulnerability exploitation behavior.
[0093] In another possible embodiment, after determining whether the target process has a kernel pool injection vulnerability exploitation behavior according to the distribution information of the kernel objects in the second memory area, the method may further include:
[0094] When the system destroys the target process, obtaining the process identifier of the target process;
[0095] The memory manager corresponding to the target process is destroyed according to the process identifier.
[0096] In the embodiment of the present invention, the event of the system destroying the target process can also be monitored by a process monitoring program. When the event of the system destroying the target process occurs, the memory manager corresponding to the target process can be destroyed according to the ID of the target process. It should be noted that other methods can also be used to monitor the event of the system destroying the target process, and the embodiment of the present invention does not limit this.
[0097] In summary, the kernel vulnerability detection method of the present invention manages the kernel objects created by the target process by using a memory manager. When it is monitored that the target object destroys the kernel object, it is determined whether the target process has a vulnerability exploitation behavior of kernel pool injection according to whether the distribution of kernel objects in the memory manager meets the characteristics of kernel pool injection and memory layout, so as to determine whether there is a vulnerability in the kernel, thereby realizing the detection of kernel vulnerabilities, and greatly improving the accuracy of kernel vulnerability detection.
[0098] It should be noted that Figure 2 The kernel vulnerability detection method provided by the method embodiment shown is Figure 8 The kernel vulnerability detection method provided by the illustrated method embodiment may be implemented separately to perform kernel vulnerability detection, or may be implemented simultaneously to perform kernel vulnerability detection. Figure 2 The kernel vulnerability detection method provided by the method embodiment shown is Figure 8 The kernel vulnerability detection method provided by the illustrated method embodiment is implemented simultaneously to perform kernel vulnerability detection, which can further improve the accuracy of kernel vulnerability detection.
[0099] Please refer to the instruction manual Fig.11 , which shows the structure of a kernel vulnerability detection device provided by an embodiment of the present invention, such as Fig.11 As shown, the device 1100 may include:
[0100] A first acquisition module 1110, configured to acquire relevant information of a first kernel object when a target process creates the first kernel object, wherein the relevant information includes a memory address of the first kernel object;
[0101] A first determining module 1120 is used to save the first kernel object to a memory manager corresponding to the target process, and determine a first memory area of the memory manager where the first kernel object is located according to the memory address;
[0102] A second acquisition module 1130 is used to acquire memory layout information of the first memory area, where the memory layout information includes distribution information of kernel objects in the first memory area;
[0103] The second determination module 1140 is used to determine whether the target process has a kernel pool injection vulnerability exploitation behavior according to the distribution information of the kernel objects in the first memory area.
[0104] In a possible embodiment, the first acquisition module 1110 may include:
[0105] A first acquisition unit is used to monitor the event that the target process creates the first kernel object, and when the event that the target process creates the first kernel object occurs, acquire the object body information of the first kernel object;
[0106] A first determining unit, configured to determine object header information of the first kernel object according to the object body information;
[0107] The second determining unit is used to determine the memory address of the first kernel object according to the object header information.
[0108] In another possible embodiment, the second determining module 1140 may include:
[0109] a third determining unit, configured to determine a kernel object set according to distribution information of kernel objects in the first memory area, wherein the kernel object set includes a plurality of kernel objects that are created continuously and have adjacent memory addresses, and each of the kernel objects has the same type;
[0110] The first judgment unit is used to determine that the target process has a vulnerability exploitation behavior of kernel pool injection when the number of kernel objects in the kernel object set is greater than a first preset threshold.
[0111] In another possible embodiment, the second determining module 1140 may include:
[0112] a fourth determining unit, configured to determine a memory page set according to distribution information of kernel objects in the first memory area when the memory layout information of the first memory area is in pages, the memory page set comprising a plurality of consecutive memory pages, the type and quantity of kernel objects in each of the memory pages being the same;
[0113] The second judgment unit is used to determine that the target process has a vulnerability exploitation behavior of kernel pool injection when the number of memory pages in the memory page set is greater than a second preset threshold.
[0114] Please refer to the instruction manual Fig.12 , which shows the structure of a kernel vulnerability detection device provided by another embodiment of the present invention, such as Fig.12 As shown, the device 1200 may include:
[0115] A third acquisition module 1210 is used to acquire relevant information of the second kernel object when the target process destroys the second kernel object, wherein the relevant information includes a memory address of the second kernel object;
[0116] A third determining module 1220 is used to determine a second memory area of the memory manager where the second kernel object is located according to the memory address, and delete the second kernel object from the second memory area;
[0117] A fourth acquisition module 1230 is used to acquire memory layout information of the second memory area, where the memory layout information includes distribution information of kernel objects in the second memory area;
[0118] The fourth determination module 1240 is used to determine whether the target process has a vulnerability exploitation behavior of kernel pool injection according to the distribution information of the kernel objects in the second memory area.
[0119] In a possible embodiment, the fourth determining module 1240 may include:
[0120] A second acquiring unit, used to acquire a memory size of the second memory area;
[0121] a fifth determining unit, configured to determine the number of holes in the second memory area according to distribution information of kernel objects in the second memory area when the memory size of the second memory area meets a preset condition;
[0122] The third judgment unit is used to determine that the target process has a vulnerability exploitation behavior of kernel pool injection when the number of holes is greater than a third preset threshold.
[0123] It should be noted that the device provided in the above embodiment, when implementing its functions, only uses the division of the above-mentioned functional modules as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0124] An embodiment of the present invention also provides a server, comprising a processor and a memory, wherein the memory stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by the processor to implement the kernel vulnerability detection method as described in the above method embodiment.
[0125] The memory can be used to store software programs and modules. The processor executes various functional applications and kernel vulnerability detection by running the software programs and modules stored in the memory. The memory can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, application programs required for functions, etc.; the data storage area can store data created according to the use of the device, etc. In addition, the memory can include a high-speed random access memory and can also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. Accordingly, the memory can also include a memory controller to provide the processor with access to the memory.
[0126] In a specific embodiment, please refer to the attached specification Fig.13 , which shows a schematic diagram of the structure of a server provided by an embodiment of the present invention. The server is used to implement the kernel vulnerability detection method provided in the above embodiment. Fig.13 As shown, the server 1300 may have relatively large differences due to different configurations or performances, and may include one or more central processing units (CPU) 1310 (the processor 1310 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 1330 for storing data, and one or more storage media 1320 (such as one or more mass storage devices) for storing application programs 1323 or data 1322. Among them, the memory 1330 and the storage medium 1320 can be short-term storage or permanent storage. The program stored in the storage medium 1320 may include one or more modules, each of which may include a series of instruction operations on the server. Furthermore, the central processing unit 1310 can be configured to communicate with the storage medium 1320 and execute a series of instruction operations in the storage medium 1320 on the server 1300. The server 1300 may also include one or more power supplies 1360, one or more wired or wireless network interfaces 1350, one or more input and output interfaces 1340, and / or one or more operating systems 1321, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.
[0127] The input / output interface 1340 may be used to receive or send data via a network. The specific example of the network may include a wireless network provided by a communication provider of the server 1300. In one example, the input / output interface 1340 includes a network adapter (Network Interface Controller, NIC), which may be connected to other network devices through a base station so as to communicate with the Internet. In one example, the input / output interface 1340 may be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0128] It can be understood by those skilled in the art that Fig.13 The structure shown is for illustration only and does not limit the structure of the above electronic device. Fig.13 More or fewer components as shown, or with Fig.13 Different configurations are shown.
[0129] An embodiment of the present invention also provides a computer-readable storage medium, which can be set in a server to store at least one instruction, at least one program, code set or instruction set related to implementing a kernel vulnerability detection method. The at least one instruction, the at least one program, the code set or instruction set is loaded and executed by a processor to implement the kernel vulnerability detection method provided by the above method embodiment.
[0130] Optionally, in this embodiment, the above-mentioned storage medium may include but is not limited to: a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and other media that can store program codes.
[0131] It should be noted that the sequence of the embodiments of the present invention described above is for description only and does not represent the advantages and disadvantages of the embodiments. The above describes specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0132] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device, equipment and server embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.
[0133] A person skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware or by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.
[0134] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A kernel vulnerability detection method, characterized in that: include: When the target process creates a first kernel object, obtaining relevant information of the first kernel object, the relevant information including a memory address of the first kernel object; Saving the first kernel object to a memory manager corresponding to the target process, and determining a first memory area of the memory manager where the first kernel object is located according to the memory address; Acquire memory layout information of the first memory area, where the memory layout information includes distribution information of kernel objects in the first memory area; Determining whether the target process has a vulnerability exploitation behavior of kernel pool injection according to the distribution information of the kernel objects in the first memory area; The distribution information of the kernel objects includes the type, quantity and memory address of the kernel objects; and determining whether the target process has a kernel pool injection vulnerability exploitation behavior according to the distribution information of the kernel objects in the first memory area includes: Determine a kernel object set according to the distribution information of the kernel objects in the first memory area, the kernel object set comprising a plurality of consecutively created kernel objects with adjacent memory addresses, each of the kernel objects being of the same type; If the number of kernel objects in the kernel object set is greater than a first preset threshold, it is determined that the target process has a vulnerability exploitation behavior of kernel pool injection; or, If the memory layout information of the first memory area is in pages, a memory page set is determined according to the distribution information of the kernel objects in the first memory area, the memory page set comprising a plurality of consecutive memory pages, and the type and quantity of the kernel objects in each of the memory pages are the same; If the number of memory pages in the memory page set is greater than a second preset threshold, it is determined that the target process has a vulnerability exploitation behavior of kernel pool injection.
2. The method according to claim 1, characterized in that When the target process creates the first kernel object, obtaining relevant information of the first kernel object includes: Monitoring an event that the target process creates a first kernel object, and when the event that the target process creates the first kernel object occurs, obtaining object body information of the first kernel object; Determine the object header information of the first kernel object according to the object body information; A memory address of the first kernel object is determined according to the object header information.
3. The method according to claim 1, characterized in that: The step of saving the first kernel object to a memory manager corresponding to the target process and determining a first memory area where the first kernel object is located according to the memory address comprises: Acquire a target kernel object in the memory manager that is adjacent to the memory address of the first kernel object; The memory address of the first kernel object is merged with the target memory area where the target kernel object is located to form a first memory area.
4. The method according to claim 1, characterized in that: When the target process creates the first kernel object, before obtaining the relevant information of the first kernel object, the method further includes: When the system creates the target process, obtaining the process identifier of the target process; A memory manager corresponding to the target process is created according to the process identifier.
5. A kernel vulnerability detection method, characterized in that: include: When the target process destroys the second kernel object, obtaining relevant information of the second kernel object, the relevant information including the memory address of the second kernel object; Determine, according to the memory address, a second memory area of the memory manager where the second kernel object is located, and delete the second kernel object from the second memory area; Acquire memory layout information of the second memory area, where the memory layout information includes distribution information of kernel objects in the second memory area; Obtaining the memory size of the second memory area; When the memory size of the second memory area meets a preset condition, determining the number of holes in the second memory area according to distribution information of kernel objects in the second memory area; If the number of holes is greater than a third preset threshold, it is determined that the target process has a vulnerability exploitation behavior of kernel pool injection.
6. A kernel vulnerability detection device, characterized in that: include: A first acquisition module, configured to acquire relevant information of a first kernel object when a target process creates the first kernel object, wherein the relevant information includes a memory address of the first kernel object; A first determining module, configured to save the first kernel object to a memory manager corresponding to the target process, and determine a first memory area of the memory manager where the first kernel object is located according to the memory address; A second acquisition module is used to acquire memory layout information of the first memory area, where the memory layout information includes distribution information of kernel objects in the first memory area; A second determination module is used to determine whether the target process has a vulnerability exploitation behavior of kernel pool injection according to the distribution information of the kernel objects in the first memory area; The distribution information of the kernel object includes the type, quantity and memory address of the kernel object, and the second determining module includes: a third determining unit, configured to determine a kernel object set according to distribution information of kernel objects in the first memory area, wherein the kernel object set includes a plurality of kernel objects that are created continuously and have adjacent memory addresses, and each of the kernel objects has the same type; A first judging unit is configured to judge that a kernel pool injection vulnerability exploitation behavior occurs in the target process when the number of kernel objects in the kernel object set is greater than a first preset threshold; Alternatively, the second determining module includes: a fourth determining unit, configured to determine a memory page set according to distribution information of kernel objects in the first memory area when the memory layout information of the first memory area is in pages, the memory page set comprising a plurality of consecutive memory pages, the type and quantity of kernel objects in each of the memory pages being the same; The second judgment unit is used to determine that the target process has a vulnerability exploitation behavior of kernel pool injection when the number of memory pages in the memory page set is greater than a second preset threshold.
7. A kernel vulnerability detection device, characterized in that: include: A third acquisition module, configured to acquire relevant information of the second kernel object when the target process destroys the second kernel object, wherein the relevant information includes a memory address of the second kernel object; a third determining module, configured to determine, according to the memory address, a second memory area of the memory manager where the second kernel object is located, and delete the second kernel object from the second memory area; a fourth acquisition module, configured to acquire memory layout information of the second memory area, wherein the memory layout information includes distribution information of kernel objects in the second memory area; a fourth determination module, configured to determine whether the target process has a vulnerability exploitation behavior of kernel pool injection according to the distribution information of the kernel objects in the second memory area; The fourth determination module comprises: A second acquiring unit, used to acquire a memory size of the second memory area; a fifth determining unit, configured to determine the number of holes in the second memory area according to distribution information of kernel objects in the second memory area when the memory size of the second memory area meets a preset condition; The third judgment unit is used to determine that the target process has a vulnerability exploitation behavior of kernel pool injection when the number of holes is greater than a third preset threshold.
8. A computer-readable storage medium, characterized in that: The storage medium stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by the processor to implement the method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Method and device for detecting malicious flash files
CN102609654A
Detection method and detection device for attack in spray pattern
CN103984898A
Method and device for distributing memory
CN105302738A
Attack detection method and device
CN110059477A
Methods of identifying heap spray attacks using memory anomaly detection
US10430586B1
