Kernel vulnerability detection method and device, equipment, storage medium and vehicle

By obtaining the kernel source code and kernel version information, combined with the preset patch files and module compilation information, the kernel vulnerability of the self-developed system is accurately detected, which solves the problem of inaccurate detection results in traditional methods and improves the accuracy of kernel vulnerability detection. .

CN118606948APending Publication Date: 2024-09-06BEIJING CO WHEELS TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202310212829.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-03-06
Publication Date
2024-09-06

AI Technical Summary

Technical Problem

Traditional kernel vulnerability detection methods in self-developed systems have inaccurate detection results due to kernel trimming and modification, making it difficult to accurately detect open vulnerabilities in the trimmed and modified kernel source code.

Method used

By obtaining the kernel source code and kernel version information of the system kernel, determine the preset patch file corresponding to the kernel version, obtain the module compilation information of the function module to be detected, and use the preset patch file to perform vulnerability detection on the source code of the target function module and determine Does the kernel vulnerability exist?

Benefits of technology

It improves the accuracy of kernel vulnerability detection, can accurately identify kernel vulnerabilities that may affect self-developed systems, and enhances the ability to detect kernel vulnerabilities in self-developed systems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118606948A
    Figure CN118606948A
Patent Text Reader

Abstract

The invention provides a kernel vulnerability detection method and device, equipment, a storage medium and a vehicle, and the method comprises the steps: obtaining a kernel source code and kernel version information of a system kernel, and determining N preset patch files corresponding to the kernel version information in a plurality of preset patch files; after module compiling information of N to-be-detected function modules corresponding to the N preset patch files is obtained, vulnerability detection is conducted on source codes of the target function modules through the preset patch files corresponding to the target function modules, and vulnerability detection results of the target function modules are obtained. Therefore, the kernel vulnerability which can influence the self-research system can be accurately determined, and whether the kernel vulnerability exists or not is detected through the corresponding preset patch file, so that the detection accuracy of the kernel vulnerability is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer security, and in particular to a kernel vulnerability detection method, apparatus, device, storage medium and vehicle. Background Art

[0002] The kernel is the core of the operating system and determines the performance and stability of the system. When a kernel vulnerability occurs in the kernel, if the kernel vulnerability is exploited by criminals, it is likely to cause data loss or tampering, user privacy leakage and other problems. In order to prevent kernel vulnerabilities from being maliciously exploited, it is usually necessary to detect kernel vulnerabilities from time to time so that developers can fix them in time.

[0003] At present, the traditional kernel vulnerability detection method mainly associates the known vulnerability list through kernel modules and kernel version numbers. However, when using traditional methods to detect kernel vulnerabilities in self-developed systems, since the self-developed system will cut and modify the kernel according to needs, the original kernel modules and kernel version numbers are used to detect the self-developed system at this time, and the detection results are not accurate enough. Summary of the invention

[0004] The present application provides a kernel vulnerability detection method, apparatus, device, storage medium and vehicle, which can achieve accurate detection of public vulnerabilities under trimmed and modified kernel source code, thereby improving the accuracy of kernel vulnerability detection.

[0005] In a first aspect, the present application provides a kernel vulnerability detection method, which may include:

[0006] Obtaining kernel source code and kernel version information of the system kernel, wherein the kernel source code includes source codes of multiple functional modules and multiple preset patch files, and the preset patch files are stored in the source codes of the functional modules;

[0007] Determine N preset patch files corresponding to the kernel version information from among the multiple preset patch files, where N is a positive integer;

[0008] Obtaining module compilation information of N to-be-detected function modules, where the N to-be-detected function modules are function modules corresponding to the N preset patch files among the multiple function modules, and the module compilation information is used to indicate whether the to-be-detected function modules are compiled into the system kernel;

[0009] Through the preset patch files corresponding to each target functional module, the source code of the target functional module is tested for vulnerabilities to obtain the vulnerability detection results of the target functional module, wherein the target functional module is one of N functional modules to be detected, and the module compilation information indicates that the target functional module is compiled into the functional module to be detected in the system kernel; the detection result is used to indicate whether the kernel vulnerability of the target functional module exists.

[0010] In a second aspect, the present application provides a kernel vulnerability detection device, the device comprising:

[0011] The first acquisition module is used to acquire the kernel source code and kernel version information of the system kernel, wherein the kernel source code includes the source codes of multiple functional modules and multiple preset patch files, and the preset patch files are stored in the source codes of the functional modules;

[0012] A determination module, used to determine N preset patch files corresponding to the kernel version information from a plurality of preset patch files, where N is a positive integer;

[0013] A second acquisition module is used to acquire module compilation information of N to-be-detected function modules, where the N to-be-detected function modules are function modules corresponding to the N preset patch files among the multiple function modules, and the module compilation information is used to indicate whether the to-be-detected function modules are compiled into the system kernel;

[0014] The detection module is used to perform vulnerability detection on the source code of the target function module through the preset patch file corresponding to each target function module, and obtain the vulnerability detection result of the target function module, wherein the target function module is one of N function modules to be detected, and the module compilation information indicates that the target function module is compiled into the system kernel to be detected; the detection result is used to indicate whether the kernel vulnerability of the target function module exists.

[0015] In a third aspect, the present application provides a kernel vulnerability detection device, the device comprising: a processor and a memory storing computer program instructions; when the processor executes the computer program instructions, the kernel vulnerability detection method of the first aspect is implemented.

[0016] In a fourth aspect, the present application provides a computer-readable storage medium having computer program instructions stored thereon, and when the computer program instructions are executed by a processor, the kernel vulnerability detection method of the first aspect is implemented.

[0017] In a fifth aspect, the present application provides a vehicle, comprising a kernel vulnerability detection device as in the third aspect.

[0018] A kernel vulnerability detection method, device, equipment, storage medium and vehicle of an embodiment of the present application obtains the kernel source code and kernel version information of the system kernel, and determines N preset patch files corresponding to the kernel version information in multiple preset patch files. After obtaining the module compilation information of N to-be-detected functional modules corresponding to the N preset patch files, the source code of the target functional module is subjected to vulnerability detection through the preset patch files corresponding to each target functional module to obtain the vulnerability detection result of the target functional module.

[0019] In this way, by matching the kernel version information of the self-developed system, the corresponding preset patch file is determined, and when the target function module where the preset patch file is located is compiled, the target function module is tested for vulnerabilities through the corresponding preset patch file, and finally the vulnerability detection results of each target function module are obtained. It is possible to accurately determine the kernel vulnerabilities that will affect the self-developed system, and detect whether the kernel vulnerability exists through the corresponding preset patch file, thereby improving the accuracy of kernel vulnerability detection. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] Figure 1 It is a flowchart of a kernel vulnerability detection method provided by an embodiment of the present application;

[0021] Figure 2 It is a flowchart of another kernel vulnerability detection method provided by an embodiment of the present application;

[0022] Figure 3 It is a flowchart of another kernel vulnerability detection method provided by an embodiment of the present application;

[0023] Figure 4 It is a flowchart of another kernel vulnerability detection method provided by an embodiment of the present application;

[0024] Figure 5 It is a flowchart of another kernel vulnerability detection method provided by an embodiment of the present application;

[0025] Figure 6 It is a system architecture diagram of a kernel vulnerability detection system provided by an embodiment of the present application;

[0026] Figure 7 It is a flowchart of a kernel vulnerability detection system provided by an embodiment of the present application;

[0027] Figure 8 It is a structural diagram of a kernel vulnerability detection device provided in an embodiment of the present application;

[0028] Fig. 9 It is a structural diagram of a kernel vulnerability detection device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0029] In order to more clearly understand the above-mentioned objectives, features and advantages of the present disclosure, the scheme of the present disclosure will be further described below. It should be noted that the embodiments of the present disclosure and the features in the embodiments can be combined with each other without conflict.

[0030] In the following description, many specific details are set forth to facilitate a full understanding of the present disclosure, but the present disclosure may also be implemented in other ways different from those described herein; it is obvious that the embodiments in the specification are only part of the embodiments of the present disclosure, rather than all of the embodiments.

[0031] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the term "comprising" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprising a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0032] First, the key terms appearing in the embodiments of the present application are explained.

[0033] Linux kernel source code: mainly includes three parts: kernel core code, including various subsystems and submodules, and other supporting subsystems, such as power management, Linux initialization, etc.; other non-core codes, such as library files (because the Linux kernel is a self-contained kernel, that is, the kernel does not rely on any other software and can be compiled by itself), firmware collection, KVM (virtual machine technology), etc.; auxiliary files such as compilation scripts, configuration files, help documents, copyright notices, etc.

[0034] Linux: A free and open source operating system that can be freely tailored and redeveloped. It is highly flexible and powerful.

[0035] Makefile: Used to build and manage projects, and to specify the compilation order and rules of files in the project.

[0036] Config: The config file referred to in the article is the kernel configuration file in the Linux system.

[0037] Json: A lightweight data exchange format.

[0038] Vulnerability: A flaw in the implementation of hardware, software, a protocol, or a system security policy that could allow an attacker to gain unauthorized access to or damage a system.

[0039] Patch: The patch in the embodiments of the present application refers to a vulnerability repair program.

[0040] Regular matching (or regular expression): A regular expression describes a string matching pattern, which can be used to check whether a string contains a certain substring, replace a matched substring, or extract a substring that meets a certain condition from a string. For example: runoo+b can match runoob, runooob, runoooooob, etc. The + sign means that the preceding character must appear at least once (1 time or more). runoob can match runob, runoob, runoooooob, etc. The question mark means that the preceding character can appear only once or more times (0 times, 1 time, or more). colou? r can match color or colour, and the question mark means that the preceding character can appear at most once (0 times or 1 time). The method of constructing a regular expression is the same as the method of creating a mathematical expression. That is, small expressions can be combined to create larger expressions using a variety of metacharacters and operators. The components of a regular expression can be a single character, a character set, a character range, a choice between characters, or any combination of all these components. A regular expression is a text pattern made up of common characters (such as characters a through z) and special characters (called "metacharacters"). A pattern describes one or more strings to match when searching for text. A regular expression acts as a template to match a pattern of characters against the string being searched.

[0041] In order to solve the problems of the prior art, the embodiments of the present application provide a kernel vulnerability detection method, device, equipment, storage medium and vehicle. The kernel vulnerability detection method provided by the embodiments of the present application is first introduced below.

[0042] Figure 1 FIG. 1 is a flow chart of a kernel vulnerability detection method provided by an embodiment of the present application. Figure 1 As shown, the method comprises the following steps:

[0043] S101: obtaining kernel source code and kernel version information of a system kernel, wherein the kernel source code includes source codes of multiple functional modules and multiple preset patch files, and the preset patch files are stored in the source codes of the functional modules;

[0044] S102: Determine N preset patch files corresponding to the kernel version information from among the plurality of preset patch files, where N is a positive integer;

[0045] S103: Obtaining module compilation information of N to-be-detected function modules, where the N to-be-detected function modules are function modules corresponding to the N preset patch files among the multiple function modules, and the module compilation information is used to indicate whether the to-be-detected function modules are compiled into the system kernel;

[0046] S104: Perform vulnerability detection on the source code of the target function module through the preset patch file corresponding to each target function module to obtain the vulnerability detection result of the target function module, wherein the target function module is one of N function modules to be detected, and the module compilation information indicates that the target function module is compiled into the system kernel to be detected; the detection result is used to indicate whether the kernel vulnerability of the target function module exists.

[0047] In an embodiment of the present application, by obtaining the kernel source code and kernel version information of the system kernel, N preset patch files corresponding to the kernel version information are determined in multiple preset patch files. After obtaining the module compilation information of the N function modules to be detected corresponding to the N preset patch files, the source code of the target function module is subjected to vulnerability detection through the preset patch files corresponding to each target function module, and the vulnerability detection result of the target function module is obtained. In this way, by matching the kernel version information of the self-developed system, the corresponding preset patch file is determined, and when the target function module where the preset patch file is located is compiled, the target function module is subjected to vulnerability detection through the corresponding preset patch file, and finally the vulnerability detection result of each target function module is obtained. It is possible to accurately determine the kernel vulnerabilities that will affect the self-developed system, and detect whether the kernel vulnerability exists through the corresponding preset patch file, thereby improving the accuracy of detecting the kernel vulnerability.

[0048] The specific implementation methods of the above steps are introduced below.

[0049] In S101, in one example, kernel version information and kernel source code of the system kernel can be obtained by receiving kernel version information and kernel source code location input by a user. The preset patch file can be a patch file for repairing a public vulnerability related to the Linux kernel obtained from any public channel. The preset patch file is stored in different functional modules in the kernel source code.

[0050] In order to improve the scalability and maintainability of a single architecture, the Linux operating system uses a new kernel module mechanism. Users can dynamically load or remove function modules from the kernel as needed without recompiling the kernel. Function modules are programs running in kernel space. They are actually a kind of target object file. They are not linked and cannot run independently, but their code can be linked to the system at runtime to run as part of the kernel or removed from the kernel, so as to dynamically expand the kernel's functions. This target code usually consists of a set of functions and data structures to implement a file system, a driver, or other kernel upper-layer functions. The full name of the module mechanism should be a dynamic loadable kernel module (Loadable Kernel Module) or LKM, which is generally referred to as a module. Unlike the process running in the external user space of the microkernel system operating system mentioned above, the function module is not executed as a process, but like other statically linked kernel functions, it is executed on behalf of the current process in kernel state. Due to the introduction of the module mechanism, the Linux kernel can be minimized, that is, some basic functions are implemented in the kernel, such as the interface from the functional module to the kernel, the way the kernel manages all functional modules, etc., and the scalability of the system is left to the functional modules.

[0051] In S102, in one example, among multiple preset patch files, according to the system kernel version affected by the kernel vulnerability corresponding to the preset patch file, the kernel version information is matched to determine N preset patch files corresponding to the kernel version information. For example, among 10 preset patch files, there are 4 preset patch files corresponding to system version v1.0 and 6 preset patch files corresponding to system version v2.0. The existing system version is v1.0, and the 10 preset patch files are matched. Among the 10 preset patch files, 4 preset patch files corresponding to the system version v1.0 are determined.

[0052] In S103, in one example, among the multiple functional modules in the kernel source code, the functional modules corresponding to the N preset patch files determined in S102 are used as the functional modules to be detected. In a specific embodiment, the location of the preset patch file is found in the kernel source code, and the corresponding Makefile file is found, and the configuration item information of the functional module to be detected in the Makefile file is checked. The configuration item information can be determined by checking the corresponding config file. For example, if it is necessary to determine whether the file corresponding to the functional module to be detected, bluetooth.o, is compiled, it is necessary to check whether the configuration item of CONFIG_BT is turned on, and checking the configuration item specifically includes checking whether CONFIG_BT is turned on in the config file. For example, when "CONFIG_BT is not set" is found, it means that the functional module has been trimmed, so the kernel vulnerability involved in the functional module does not affect the system kernel. When "CONFIG_BT=y" is found, it means that the functional module has been introduced, so the kernel vulnerability involved in the functional module will affect the system kernel.

[0053] In S104, in one example, the source code of the target functional module is accurately matched through the preset patch files corresponding to each target functional module to determine whether the kernel vulnerability exists. Until the kernel vulnerabilities corresponding to N preset patch files are detected, the vulnerability detection results are output. In a specific embodiment, according to the number of vulnerability patches, the location of the vulnerability patches and the content of the vulnerability patches obtained by parsing the preset patch files, the location of the patch content is accurately matched in the kernel source code, and regular matching is used to determine whether the vulnerability exists or is repaired.

[0054] like Figure 2 As shown, Figure 2 This is a schematic diagram of the steps before S103 provided in an embodiment of the present application. In one embodiment, before S103, the following steps may also be included:

[0055] S201: Parse N preset patch files to obtain vulnerability description information corresponding to each preset patch file, where the vulnerability description information is information used to describe features of a kernel vulnerability;

[0056] Accordingly, S104 may specifically include:

[0057] S202: performing vulnerability detection on the source code of the target function module according to the vulnerability description information in the preset patch file corresponding to each target function module, and obtaining the vulnerability detection result of the target function module.

[0058] The embodiment of the present application parses N preset patch files to obtain corresponding vulnerability description information, and performs vulnerability detection on the source code of the target functional module according to the vulnerability description information, thereby improving the accuracy of vulnerability detection.

[0059] In S201 , in one example, the vulnerability description information may include the number of vulnerability patches, the location of the vulnerability patches, and the content of the vulnerability patches.

[0060] In S202, in one example, the source code of each target functional module is regularly matched in the kernel source code by the number of vulnerability patches, vulnerability patch location and vulnerability patch content in the preset patch file corresponding to each target functional module to obtain the vulnerability detection result of the target functional module.

[0061] like Figure 3 As shown, Figure 3 This is a schematic diagram of the steps before S103 provided in an embodiment of the present application. In one embodiment, before S103, the following steps may also be included:

[0062] S301: according to the vulnerability description information in the N preset patch files corresponding to the N function modules to be detected, the compiled files of the N function modules to be detected are searched in the kernel source code, and the compiled files are used to compile the function modules to be detected into the system kernel;

[0063] S302: Determine module compilation information of N to-be-detected functional modules according to configuration item information of compilation files of N to-be-detected functional modules.

[0064] The embodiment of the present application searches for compiled files of N functional modules to be detected in the kernel source code based on vulnerability description information in N preset patch files corresponding to N functional modules to be detected, and determines module compilation information of the N functional modules to be detected based on configuration item information of the compiled files. It can determine whether each functional module to be detected is compiled into the system kernel, so as to improve the accuracy of kernel vulnerability detection.

[0065] In S301, in one example, the compiled file may include a Makefile file and a config file. In a specific embodiment, the location of the preset patch file is found in the kernel source code, and the corresponding Makefile file is found, and the configuration item information of the function module to be detected in the Makefile file is checked. The configuration item information can be determined by checking the corresponding config file. For example, if it is necessary to determine whether the file corresponding to the function module to be detected, bluetooth.o, has been compiled, it is necessary to check whether the configuration item of CONFIG_BT is turned on. Checking the configuration item specifically includes checking whether CONFIG_BT is turned on in the config file.

[0066] In an example, the vulnerability description information includes the number of vulnerability patches, the location of the vulnerability patches, and the content of the vulnerability patches; accordingly, S301 may specifically include:

[0067] According to the number, location and content of vulnerability patches in N preset patch files corresponding to the N function modules to be detected, the compiled files of the N function modules to be detected are found in the kernel source code.

[0068] In S302, in one example, the configuration item information may be module definition information in a config file, for example, when "CONFIG_BT is not set" is found, it indicates a non-enabled state, and when "CONFIG_BT=y" is found, it indicates an enabled state.

[0069] like Figure 4 As shown, Figure 4 This is a schematic diagram of the steps before S101 provided in an embodiment of the present application. In one embodiment, before S101, the following steps may also be included:

[0070] S401: Acquire vulnerability information of a public kernel vulnerability and a preset patch file corresponding to the public kernel vulnerability, wherein the vulnerability information is used to indicate a system kernel version affected by the public kernel vulnerability;

[0071] S402: Adding patch files corresponding to public kernel vulnerabilities to multiple preset patch files according to vulnerability information classification.

[0072] In an embodiment of the present application, by classifying and adding the acquired vulnerability information of public kernel vulnerabilities and corresponding preset patch files to multiple preset patch files, the existing preset patch files can be updated to improve the comprehensiveness and accuracy of kernel vulnerability detection.

[0073] In S401, in one example, vulnerability information of public kernel vulnerabilities related to the Linux kernel can be obtained from any public channel through a distributed crawler, and corresponding patch files can be obtained from the Linux official website according to the obtained public kernel vulnerabilities and downloaded and saved.

[0074] In one example, the obtained patch file of the public kernel vulnerability is parsed to obtain the corresponding vulnerability description information, wherein the vulnerability description information may include the number of vulnerability patches, the location of the vulnerability patches, and the content of the vulnerability patches. The vulnerability description information is classified and saved in the form of a json file. It should be noted that the storage method of the vulnerability description information includes but is not limited to the form of a json file, which is not limited here. In order to facilitate machine parsing and file generation to improve network processing efficiency, the embodiment of the present application uses a json file to classify and save the vulnerability description information.

[0075] In S402, in one example, the acquired patch files are classified and saved according to the system kernel versions affected by the public kernel vulnerabilities, so as to update multiple existing preset patch files.

[0076] like Figure 5 As shown, Figure 5 This is a detailed flow chart of S104 provided in an embodiment of the present application. In one embodiment, the above S104 may specifically include the following steps:

[0077] S1041: setting a line number threshold according to the vulnerability description information of each target functional module, where the line number threshold is used to indicate the line number interval where the vulnerability patch is located;

[0078] S1042: According to the number of vulnerability patches, the location of the vulnerability patches, the content of the vulnerability patches and the line number threshold, the source code of the target functional module is subjected to vulnerability detection through regular matching to obtain a vulnerability detection result.

[0079] In an embodiment of the present application, after setting a line number threshold based on the vulnerability description information, vulnerability detection is performed on the source code of the target functional module according to the vulnerability description information and the line number threshold, which can improve the accuracy of matching and thus improve the accuracy of vulnerability detection.

[0080] In S1041, the line number threshold can be set according to actual needs and is not limited here. For example, the line number threshold is set to ±50 to indicate the interval between the first 50 lines and the last 50 lines of the line number where the vulnerability patch is located.

[0081] In S1042, according to the number of vulnerability patches, the location of the vulnerability patches, the content of the vulnerability patches and the line number threshold, the source code of the target functional module is subjected to vulnerability detection by regular matching to obtain a vulnerability detection result. In a specific embodiment, since the location of the vulnerability patches may be different between different versions, the line number threshold is set to ±20 according to actual needs, and according to the number of vulnerability patches, the line number of the vulnerability patch location, the content of the vulnerability patch and the line number threshold, regular matching is performed in the source code of the target functional module to determine whether the kernel vulnerability exists or is repaired.

[0082] The present application is described below by a specific embodiment. Figure 6 This is the system architecture diagram of the vulnerability detection system. Figure 7 Schematic diagram of the vulnerability detection system.

[0083] The specific steps of the system execution process are as follows:

[0084] S701, whether to update vulnerability information (determine whether to update vulnerability information or directly perform vulnerability detection according to needs);

[0085] S702, run a crawler to obtain vulnerability information and classify it (if vulnerability update is selected, run a crawler to obtain vulnerability information (i.e. vulnerability information of public kernel vulnerabilities) and classify it according to the versions affected by the vulnerabilities);

[0086] S703, downloading the vulnerability patch file (downloading the patch file corresponding to the vulnerability (i.e., the patch file corresponding to the public kernel vulnerability) according to the vulnerability information);

[0087] S704, vulnerability patch file analysis;

[0088] S705, extracting vulnerability features (i.e., vulnerability description information) and saving them;

[0089] S706: Whether to perform vulnerability detection;

[0090] S707, input source code location and kernel version (if vulnerability detection is selected, the kernel source code location and kernel version input by the user are obtained);

[0091] S708, determining the number of vulnerability patches that match the version (matching all corresponding vulnerability patch extraction results (i.e., vulnerability description information) according to the kernel version);

[0092] S709, obtaining vulnerability characteristics (i.e., vulnerability description information);

[0093] S710, locate the vulnerable file;

[0094] S711, determining whether the vulnerability module is compiled;

[0095] S712, perform precise matching to confirm whether the vulnerability exists (after confirming whether the vulnerability module (i.e., the target functional module) has been compiled, perform precise matching through the patch quantity, line number, and content (i.e., vulnerability description information) to confirm whether the vulnerability exists);

[0096] S713, whether all the vulnerabilities that meet the version are detected (loop the above content until all the vulnerabilities are detected and the detection results are output);

[0097] S714: Output the detection result.

[0098] Based on the kernel vulnerability detection method provided in the above embodiment, the present application also provides a kernel vulnerability detection device. Figure 8 As shown, Figure 8 A schematic diagram of the structure of a kernel vulnerability detection device 800 provided in an embodiment of the present application, the device may include:

[0099] The first acquisition module 801 is used to acquire the kernel source code and kernel version information of the system kernel, wherein the kernel source code includes the source codes of multiple functional modules and multiple preset patch files, and the preset patch files are stored in the source codes of the functional modules;

[0100] A determination module 802 is used to determine N preset patch files corresponding to the kernel version information from a plurality of preset patch files, where N is a positive integer;

[0101] The second acquisition module 803 is used to acquire module compilation information of N to-be-detected function modules, where the N to-be-detected function modules are function modules corresponding to the N preset patch files among the multiple function modules, and the module compilation information is used to indicate whether the to-be-detected function modules are compiled into the system kernel;

[0102] The detection module 804 is used to perform vulnerability detection on the source code of the target functional module through the preset patch files corresponding to each target functional module to obtain the vulnerability detection result of the target functional module, wherein the target functional module is one of N functional modules to be detected, and the module compilation information indicates that the target functional module is compiled into the functional module to be detected in the system kernel; the detection result is used to indicate whether the kernel vulnerability of the target functional module exists.

[0103] In one embodiment, the kernel vulnerability detection device 800 may further include:

[0104] A parsing module, used to parse N preset patch files to obtain vulnerability description information corresponding to each preset patch file, where the vulnerability description information is information used to describe the characteristics of the kernel vulnerability;

[0105] The determination module 802 may be specifically configured to:

[0106] Through the vulnerability description information in the preset patch file corresponding to each target functional module, the source code of the target functional module is tested for vulnerabilities to obtain the vulnerability detection results of the target functional module.

[0107] In one embodiment, the kernel vulnerability detection device 800 may further include:

[0108] A search module is used to search for compiled files of N to-be-detected functional modules in the kernel source code according to vulnerability description information in N preset patch files corresponding to the N to-be-detected functional modules, and the compiled files are used to compile the to-be-detected functional modules into the system kernel;

[0109] The compiling module is used to determine the module compiling information of the N function modules to be detected according to the configuration item information of the compiling files of the N function modules to be detected.

[0110] In one embodiment, the search module may be specifically used to:

[0111] According to the number, location and content of vulnerability patches in N preset patch files corresponding to the N function modules to be detected, the compiled files of the N function modules to be detected are found in the kernel source code.

[0112] In one embodiment, the kernel vulnerability detection device 800 may further include:

[0113] A vulnerability acquisition module is used to obtain vulnerability information of public kernel vulnerabilities and preset patch files corresponding to the public kernel vulnerabilities. The vulnerability information is used to indicate the system kernel version affected by the public kernel vulnerabilities.

[0114] The vulnerability update module is used to add patch files corresponding to public kernel vulnerabilities to multiple preset patch files according to vulnerability information classification.

[0115] In one embodiment, the detection module 804 may be specifically configured to:

[0116] According to the vulnerability description information of each target functional module, a line number threshold is set, and the line number threshold is used to indicate the line number interval where the vulnerability patch is located;

[0117] According to the number of vulnerability patches, the location of vulnerability patches, the content of vulnerability patches and the line number threshold, the source code of the target functional module is tested for vulnerabilities through regular matching to obtain the vulnerability detection results.

[0118] It should be noted that the information interaction, execution process, etc. between the above-mentioned devices / units are based on the same concept as the method embodiment of the present application, and are devices corresponding to the above-mentioned battery thermal runaway warning method. All implementation methods in the above-mentioned method embodiment are applicable to the embodiments of the device. Its specific functions and technical effects can be found in the method embodiment part, which will not be repeated here.

[0119] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.

[0120] Fig. 9 A schematic diagram of the hardware structure of a kernel vulnerability detection device provided in an embodiment of the present application is shown.

[0121] The device may include a processor 901 and a memory 902 storing program instructions.

[0122] When the processor 901 executes the program, the steps in any of the above method embodiments are implemented.

[0123] Exemplarily, the program may be divided into one or more modules / units, one or more modules / units are stored in the memory 902 and executed by the processor 901 to complete the present application. One or more modules / units may be a series of program instruction segments capable of completing a specific function, and the instruction segments are used to describe the execution process of the program in the device.

[0124] Specifically, the processor 901 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.

[0125] The memory 902 may include a large capacity memory for data or instructions. By way of example and not limitation, the memory 902 may include a hard disk drive (HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive or a combination of two or more of these. In appropriate cases, the memory 902 may include a removable or non-removable (or fixed) medium. In appropriate cases, the memory 902 may be inside or outside the integrated gateway disaster recovery device. In a specific embodiment, the memory 902 is a non-volatile solid-state memory.

[0126] The memory may include read-only memory (ROM), random access memory (RAM), magnetic disk storage media devices, optical storage media devices, flash memory devices, electrical, optical or other physical / tangible memory storage devices. Thus, typically, the memory includes one or more tangible (non-transitory) readable storage media (e.g., memory devices) encoded with software including computer executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the method according to an aspect of the present disclosure.

[0127] The processor 901 implements any one of the methods in the above embodiments by reading and executing program instructions stored in the memory 902 .

[0128] In one example, the electronic device may further include a communication interface 903 and a bus 911. The processor 901, the memory 902, and the communication interface 903 are connected via the bus 911 and communicate with each other.

[0129] The communication interface 903 is mainly used to implement communication between various modules, devices, units and / or equipment in the embodiments of the present application.

[0130] Bus 911 includes hardware, software or both, and the parts of online data flow billing equipment are coupled to each other. For example, but not limitation, bus may include accelerated graphics port (AGP) or other graphics bus, enhanced industrial standard architecture (EISA) bus, front-end bus (FSB), hypertransport (HT) interconnection, industrial standard architecture (ISA) bus, infinite bandwidth interconnection, low pin count (LPC) bus, memory bus, micro channel architecture (MCA) bus, peripheral component interconnection (PCI) bus, PCI-Express (PCI-X) bus, serial advanced technology attachment (SATA) bus, video electronics standard association local (VLB) bus or other suitable bus or two or more of these combinations. In appropriate cases, bus 911 may include one or more buses. Although the present application embodiment describes and shows a specific bus, the present application considers any suitable bus or interconnection.

[0131] In addition, in combination with the method in the above embodiment, the embodiment of the present application can provide a storage medium for implementation. The storage medium stores program instructions; when the program instructions are executed by a processor, any one of the methods in the above embodiment is implemented.

[0132] An embodiment of the present application provides a computer program product, which is stored in a storage medium. The program product is executed by at least one processor to implement the various processes of the above-mentioned method embodiment and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0133] An embodiment of the present application provides a vehicle, which includes a kernel vulnerability detection device in the above embodiment.

[0134] It should be clear that the present application is not limited to the specific configuration and processing described above and shown in the figures. For the sake of simplicity, a detailed description of the known method is omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present application is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between the steps after understanding the spirit of the present application.

[0135] The functional modules shown in the above block diagram can be implemented as hardware, software, firmware or their combination. When implemented in hardware, it can be, for example, an electronic circuit, an application specific integrated circuit (ASIC), suitable firmware, a plug-in, a function card, etc. When implemented in software, the elements of the present application are programs or code segments that are used to perform the required tasks. Programs or code segments can be stored in machine-readable media, or transmitted on a transmission medium or a communication link by a data signal carried in a carrier wave. "Machine-readable media" can include any medium that can store or transmit information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, optical fiber media, radio frequency (RF) links, etc. Code segments can be downloaded via computer grids such as the Internet, intranets, etc.

[0136] It should also be noted that the exemplary embodiments mentioned in this application describe some methods or systems based on a series of steps or devices. However, this application is not limited to the order of the above steps, that is, the steps can be performed in the order mentioned in the embodiment, or in a different order from the embodiment, or several steps can be performed simultaneously.

[0137] Aspects of the present disclosure are described above with reference to the flowchart and / or block diagram of the method, device (system) and program product according to the embodiment of the present disclosure. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer program instructions. These program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer or other programmable data processing device to produce a machine so that these instructions executed by the processor of the computer or other programmable data processing device enable the implementation of the function / action specified in one or more boxes of the flowchart and / or block diagram. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor or a field programmable logic circuit. It can also be understood that each box in the block diagram and / or flowchart and the combination of boxes in the block diagram and / or flowchart can also be implemented by dedicated hardware that performs a specified function or action, or can be implemented by a combination of dedicated hardware and computer instructions.

[0138] The above are only specific implementation methods of the present application. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working processes of the systems, modules and units described above can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here. It should be understood that the protection scope of the present application is not limited to this. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in this application, and these modifications or replacements should be included in the protection scope of this application.

Claims

1. A kernel vulnerability detection method, It is characterized in that The method comprises: Acquire kernel source code and kernel version information of the system kernel, wherein the kernel source code includes source codes of multiple functional modules and multiple preset patch files, and the preset patch files are stored in the source codes of the functional modules; Determine N preset patch files corresponding to the kernel version information among the multiple preset patch files, where N is a positive integer; Obtaining module compilation information of N to-be-detected functional modules, wherein the N to-be-detected functional modules are functional modules corresponding to the N preset patch files among the plurality of functional modules, and the module compilation information is used to indicate whether the to-be-detected functional modules are compiled into the system kernel; Through the preset patch files corresponding to the target functional modules, the source code of the target functional modules is detected for vulnerabilities to obtain the vulnerability detection results of the target functional modules, wherein the target functional modules are among the N functional modules to be detected, and the module compilation information indicates that the target functional modules are compiled into the functional modules to be detected in the system kernel; the detection result is used to indicate whether the kernel vulnerability of the target functional module exists.

2. The method according to claim 1, It is characterized in that Before obtaining the module compilation information of the N function modules to be detected, the method further includes: Parsing the N preset patch files to obtain vulnerability description information corresponding to each of the preset patch files, wherein the vulnerability description information is information used to describe the characteristics of the kernel vulnerability; The method of performing vulnerability detection on the source code of the target function module by using the preset patch files corresponding to the target function modules to obtain the vulnerability detection results of the target function modules includes: By using the vulnerability description information in the preset patch file corresponding to each target function module, vulnerability detection is performed on the source code of the target function module to obtain the vulnerability detection result of the target function module.

3. The method according to claim 2, It is characterized in that Before obtaining the module compilation information of the N function modules to be detected, the method further includes: According to the vulnerability description information in the N preset patch files corresponding to the N function modules to be detected, searching in the kernel source code to obtain compilation files of the N function modules to be detected, wherein the compilation files are used to compile the function modules to be detected into the system kernel; The module compilation information of the N to-be-detected functional modules is determined according to the configuration item information of the compilation files of the N to-be-detected functional modules.

4. The method according to claim 3, It is characterized in that The vulnerability description information includes the number of vulnerability patches, the location of the vulnerability patches, and the content of the vulnerability patches; The step of searching the kernel source code for compiled files of the N to-be-detected functional modules according to the vulnerability description information in the N preset patch files corresponding to the N to-be-detected functional modules includes: According to the number, location and content of the vulnerability patches in the N preset patch files corresponding to the N function modules to be detected, the compiled files of the N function modules to be detected are searched in the kernel source code.

5. The method according to claim 1, It is characterized in that Before obtaining the kernel source code and kernel version information of the system kernel, the method further includes: Acquire vulnerability information of a public kernel vulnerability and a preset patch file corresponding to the public kernel vulnerability, wherein the vulnerability information is used to indicate the system kernel version affected by the public kernel vulnerability; The patch files corresponding to the public kernel vulnerabilities are added to the plurality of preset patch files according to the vulnerability information classification.

6. The method according to claim 4, It is characterized in that The method of performing vulnerability detection on the source code of the target function module by using the preset patch files corresponding to the target function modules to obtain the vulnerability detection results of the target function modules includes: According to the vulnerability description information of each target functional module, a line number threshold is set, where the line number threshold is used to indicate the line number interval where the vulnerability patch is located; According to the number of vulnerability patches, the location of vulnerability patches, the content of vulnerability patches and the line number threshold, vulnerability detection is performed on the source code of the target functional module through regular matching to obtain the vulnerability detection result.

7. A kernel vulnerability detection device, It is characterized in that The device comprises: A first acquisition module, used for acquiring kernel source code and kernel version information of a system kernel, wherein the kernel source code includes source codes of multiple functional modules and multiple preset patch files, and the preset patch files are stored in the source codes of the functional modules; A determination module, configured to determine, from among the plurality of preset patch files, N preset patch files corresponding to the kernel version information, where N is a positive integer; A second acquisition module is used to acquire module compilation information of N to-be-detected function modules, where the N to-be-detected function modules are function modules corresponding to the N preset patch files among the plurality of function modules, and the module compilation information is used to indicate whether the to-be-detected function modules are compiled into the system kernel; The detection module is used to perform vulnerability detection on the source code of the target function module through the preset patch file corresponding to each target function module to obtain the vulnerability detection result of the target function module, wherein the target function module is one of N function modules to be detected, and the module compilation information indicates that the target function module is compiled into the function module to be detected in the system kernel; the detection result is used to indicate whether the kernel vulnerability of the target function module exists.

8. A kernel vulnerability detection device, It is characterized in that The device comprises: a processor and a memory storing computer program instructions; when the processor executes the computer program instructions, the kernel vulnerability detection method according to any one of claims 1 to 6 is implemented.

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

10. A vehicle, It is characterized in that The vehicle comprises the kernel vulnerability detection device as claimed in claim 8.

Citation Information

Cited By

  • Kernel suspected vulnerability sample analysis method and device, electronic equipment and storage medium

    CN119961935A