Threat defense method, device, electronic device and storage medium for embedded device
By loading dynamic libraries in Linux system and using pre-configured defense modules to intercept files to be started, making action decisions based on threat detection results, the resource and configuration limitations of threat defense technology applications in embedded devices are solved, and the embedded devices are realized Effective threat defense of equipment and the authenticity of defense modules.
Patent Information
- Application Number
- CN202111541972.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-16
- Publication Date
- 2024-12-06
- Estimated Expiration
- 2041-12-16
AI Technical Summary
The existing Linux system threat defense technology requires system resources and kernel configuration support, and is difficult to effectively apply in embedded devices, and is limited by the strict resource and configuration requirements of embedded devices.
When loading dynamic libraries on Linux system, the pre-configured defense module is used to intercept the files to be started and determine the execution actions based on the threat detection results, so as to release or block the files to be started, and use the verification module to verify the integrity and reality of the defense module. to ensure the security of intercepted files.
It realizes threat defense against embedded devices without being restricted by system resources and kernel configuration, ensures the integrity and authenticity of defense modules, and enhances the effectiveness of threat defense against embedded devices.
Smart Images

Figure CN114238960B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the field of computer security, and in particular to a threat defense method, device, electronic device and storage medium for an embedded device. Background Art
[0002] With the continuous development of information technologies such as communication, perception, and identification, embedded devices are rapidly penetrating into various industries, and network security has become a key factor restricting the development of embedded devices.
[0003] Taking the Linux system as an example, the threat defense technologies for the Linux system mainly include Netlink Connector, Audit, Syscall hook, etc. The above threat defense technologies require the support of system resources (such as disk, memory, network, etc.) and kernel configuration to detect threats to terminal devices in real time (such as abnormal services or programs).
[0004] However, since embedded devices have more stringent application scenario requirements than terminal devices, they are limited by system resources and kernel configuration, which makes it difficult to transfer the above threat defense technology from terminal devices to embedded devices. Summary of the invention
[0005] In order to implement threat defense for embedded devices, embodiments of the present invention provide a threat defense method, apparatus, electronic device, and storage medium for embedded devices.
[0006] In a first aspect, an embodiment of the present invention provides a threat defense method for an embedded device, wherein the embedded device uses a Linux system, and the method includes:
[0007] In response to the Linux system loading the dynamic library, intercepting the to-be-started file of the Linux system using a pre-configured defense module;
[0008] Performing threat detection on the file to be started;
[0009] Based on the threat detection result of the file to be started, the execution action of the defense module on the file to be started is determined; wherein the execution action includes releasing and blocking.
[0010] In a possible design, before the response to the Linux system loading the dynamic library, the method includes:
[0011] In response to the Linux system starting, verifying the pre-configured defense module using the pre-configured verification module;
[0012] After the verification is passed, the defense module is started to intercept the to-be-started file of the Linux system using the defense module that has passed the verification.
[0013] In a possible design, the performing threat detection on the to-be-started file includes:
[0014] Extracting the file to be started and obtaining key feature information of the file to be started;
[0015] Based on the key feature information and a pre-built feature library, threat detection is performed on the file to be started; wherein the storage space occupied by the feature library does not exceed a preset capacity threshold.
[0016] In a possible design, the feature library includes a whitelist library, a blacklist library and a custom library;
[0017] The performing threat detection on the to-be-started file based on the key feature information and the pre-built feature library includes:
[0018] Comparing the key feature information with the features of the whitelist library to determine a first threat detection result of the file to be started; wherein the first threat detection result includes a hit and a miss;
[0019] When the first threat detection result is a miss, comparing the key feature information with the features of the blacklist library to determine a second threat detection result of the file to be started; wherein the second threat detection result includes a hit and a miss;
[0020] When the second threat detection result is a miss, comparing the key feature information with the features of the custom library to determine a third threat detection result of the file to be started; wherein the third threat detection result includes a hit and a miss;
[0021] The first threat detection result, the second threat detection result, and the third threat detection result are used as the threat detection result of the file to be started.
[0022] In a possible design, the performing threat detection on the to-be-started file includes:
[0023] Extracting the file to be started and obtaining first key feature information of the file to be started;
[0024] Calculating the information entropy of the file to be started;
[0025] Determine the decryption file of the file to be started by virtual execution, and extract the decryption file to obtain the second key feature information;
[0026] Determining a feature threat level of the to-be-activated file based on the first key feature information, the information entropy, and the second key feature information;
[0027] Based on a preset threshold and the characteristic threat level of the file to be started, threat detection is performed on the file to be started.
[0028] In a possible design, determining the feature threat level of the to-be-started file based on the first key feature information, the information entropy, and the second key feature information includes:
[0029] Constructing a feature information database; wherein the feature information database includes key feature information, a threat level corresponding to the key feature information, a first preset weight, a second preset weight, and a preset information entropy weight, and the sum of the first preset weight, the preset information entropy weight, and the second preset weight is 1;
[0030] If the first key feature information matches the key feature information included in the feature information library, determining the first feature threat level based on the first key feature information, the threat level included in the feature information library, and a first preset weight;
[0031] Determining target information entropy based on the information entropy and the preset information entropy weight;
[0032] If the second key feature information matches the key feature information included in the feature information library, determining the second feature threat level based on the second key feature information, the threat level included in the feature information library, and the second preset weight;
[0033] Normalizing the first feature threat level, the target information entropy, and the second feature threat level;
[0034] The feature threat level of the to-be-activated file is determined based on the normalized first feature threat level, the target information entropy, and the second feature threat level.
[0035] In a possible design, determining the execution action of the defense module on the file to be started based on the threat detection result of the file to be started includes:
[0036] Acquire a pre-configured defense strategy; wherein the defense strategy is used to indicate the relationship between the execution action of the defense module on the file to be started and the threat detection result of the file to be started;
[0037] Based on the defense strategy and the threat detection result of the file to be started, the execution action of the defense module on the file to be started is determined.
[0038] In a second aspect, an embodiment of the present invention further provides a threat defense device for an embedded device, wherein the embedded device adopts a Linux system, and the device comprises:
[0039] An interception unit, configured to intercept the to-be-started file of the Linux system using a pre-configured defense module in response to the Linux system loading a dynamic library;
[0040] A detection unit, used for performing threat detection on the file to be started;
[0041] An execution unit is used to determine the execution action of the defense module on the file to be started based on the threat detection result of the file to be started; wherein the execution action includes release and blocking.
[0042] In a third aspect, an embodiment of the present invention further provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the method described in any embodiment of this specification is implemented.
[0043] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, enables the computer to execute the method described in any embodiment of this specification.
[0044] The embodiments of the present invention provide a threat defense method, device, electronic device and storage medium for embedded devices. Through a mechanism of loading dynamic libraries based on the Linux system, it is not limited by system resources and kernel configuration, so that threat defense technology can be applied to embedded devices; and a pre-configured defense module is used to intercept the startup files of the Linux system. Based on the threat detection results of the startup files, the defense module can release or block the startup files, thereby realizing threat defense against embedded devices. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0046] Figure 1 It is a flow chart of a threat defense method for an embedded device provided by an embodiment of the present invention;
[0047] Figure 2 is a flow chart of another method for defending against threats in an embedded device provided by an embodiment of the present invention;
[0048] Figure 3 It is a flow chart of another method for threat defense of an embedded device provided by an embodiment of the present invention;
[0049] Figure 4 is a hardware architecture diagram of an electronic device provided by an embodiment of the present invention;
[0050] Figure 5 It is a structural diagram of a threat defense device for an embedded device provided by an embodiment of the present invention;
[0051] Figure 6 It is a structural diagram of another threat defense device for an embedded device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0052] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments in 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.
[0053] As mentioned above, since embedded devices have more stringent application scenario requirements than terminal devices, they are limited by system resources and kernel configurations. Existing threat defense technologies for Linux systems require support from system resources and kernel configurations, which makes threat defense for embedded devices difficult to implement.
[0054] During the research and development process, the inventor discovered that the Linux system has a mechanism for loading dynamic libraries, which can complete the real-time security defense of the startup files of embedded devices in application scenarios with limited kernel configuration and system resources. However, although the Windows system also has a mechanism for loading dynamic libraries, since Windows uses UEFI and secure boot, after enabling secure boot, the Windows system will disable the mechanism for loading dynamic libraries, thereby preventing users from being attacked by threats. Therefore, when the mechanism for loading dynamic libraries of the Windows system is disabled during secure boot, the Linux system becomes the preferred operating system for embedded devices.
[0055] In order to solve this technical problem, the inventor considered using the Linux system as the operating system of the embedded device. When the Linux system loads the dynamic library, the pre-configured defense module can be used to intercept the startup files of the Linux system, and then threat detection can be performed on the startup files. Finally, based on the threat detection results of the startup files, the defense module can determine the execution action of the startup files, thereby realizing threat defense for the embedded device.
[0056] The specific implementation of the above concept is described below.
[0057] Please refer to Figure 1 , an embodiment of the present invention provides a threat defense method for an embedded device, the method comprising:
[0058] Step 100: In response to the Linux system loading the dynamic library, the pre-configured defense module is used to intercept the to-be-started file of the Linux system;
[0059] Step 102: Perform threat detection on the startup file;
[0060] Step 104: Based on the threat detection result of the file to be started, determine the execution action of the defense module on the file to be started; wherein the execution action includes release and block.
[0061] In the embodiment of the present invention, by using a mechanism for loading dynamic libraries based on the Linux system, it is not limited by system resources and kernel configuration, so that threat defense technology can be applied to embedded devices; and a pre-configured defense module is used to intercept the startup files of the Linux system, and based on the threat detection results of the startup files, the defense module can release or block the startup files, thereby realizing threat defense against embedded devices.
[0062] Described below Figure 1 How the various steps are performed.
[0063] It should be noted that the defense module is a configuration file pre-configured in the Linux system in the form of .so. The defense module may be tampered with by threat attacks. After the defense module is tampered with, its interception of the startup files of the Linux system and subsequent detection of the startup files become meaningless.
[0064] Therefore, in order to solve this technical problem, it may be considered to verify the integrity and authenticity of the defense module before step 100 .
[0065] In one embodiment of the present invention, before step 100, the method further includes:
[0066] Step A1, in response to the Linux system starting, verifying the pre-configured defense module using the pre-configured verification module;
[0067] Step A2: after the verification is passed, the defense module is started to intercept the to-be-started file of the Linux system by using the defense module that has passed the verification.
[0068] In this embodiment, by using a pre-configured verification module to verify a pre-configured defense module, the integrity and authenticity of the defense module can be guaranteed, thereby ensuring the authenticity of interception of the to-be-started file of the Linux system and subsequent detection of the to-be-started file.
[0069] The verification module can perform integrity verification through pre-set protocol rules, and the verification module is usually encrypted, so the verification module is not easily tampered with.
[0070] That is, the embodiment of the present invention ensures the security of the intercepted file to be started by setting a defense module, and ensures the integrity and authenticity of the defense module by setting a verification module, thereby ensuring the effectiveness of real-time defense against embedded device threats.
[0071] In some embodiments, step A1 may include:
[0072] Obtaining an initial hash value and a hash algorithm of the defense module to be verified; wherein the initial hash value is obtained by performing a hash calculation on the defense module using the hash algorithm;
[0073] Use the obtained hash algorithm to perform hash calculation on the defense module to be verified to obtain the hash value to be compared;
[0074] Based on the initial hash value and the hash value to be compared, the defense module to be verified is verified.
[0075] In this implementation, the verification module verifies the defense module by using hash verification, thereby ensuring the integrity and authenticity of the defense module.
[0076] In some other embodiments, step A1 may include:
[0077] Obtaining a digital signature of the defense module to be verified; wherein the digital signature is obtained by encrypting the hash value of the defense module to be verified;
[0078] Decrypt the digital signature using the preset key to obtain the hash value of the defense module to be verified;
[0079] Based on the preset hash value and the obtained hash value, the defense module to be verified is verified.
[0080] In this implementation, the verification module verifies the defense module by using digital signature verification, thereby ensuring the integrity and authenticity of the defense module.
[0081] Regarding step 102:
[0082] There are two situations for threat detection on the startup file. One is threat detection through a feature library, and the feature library is integrated in the embedded device; the other is to transmit the startup file to the server for detection by communicating with an external server.
[0083] Scenario 1:
[0084] In some implementations, step 102 may include:
[0085] Step B1, extract the file to be started and obtain key feature information of the file to be started;
[0086] Step B2: Based on the key feature information and the pre-built feature library, threat detection is performed on the startup file; wherein the storage space occupied by the feature library does not exceed a preset capacity threshold.
[0087] In this implementation, since the feature library needs to be integrated in the embedded device, the storage space occupied by the feature library cannot be too much, for example, it may not exceed 100M. This threat detection method can quickly detect the startup file, but is limited by the number of features in the feature library, so the comprehensiveness of threat detection cannot be guaranteed.
[0088] Furthermore, in some embodiments, step B1 may include:
[0089] Analyze the startup file using static vector extraction technology to obtain all behavioral instructions in the startup file;
[0090] Analyze all behavior instructions using disassembly technology to obtain instruction parameters of all behavior instructions;
[0091] Key feature information is obtained by filtering the instruction parameters of all behavioral instructions.
[0092] In this embodiment, the static analysis method specifically uses static vector extraction technology to obtain all behavioral instructions in the file to be started, and uses disassembly technology to obtain instruction parameters of all behavioral instructions, and then screens out key feature information based on the obtained instruction parameters. Among them, static vector extraction technology and disassembly technology are technologies well known to those skilled in the art, and will not be described in detail here. Of course, in addition to the specific technologies mentioned above, the static analysis method can also be implemented by other technologies, which will not be described in detail here.
[0093] In addition, behavior instructions include but are not limited to service instructions, file instructions, window instructions, registry instructions, process instructions, algorithm instructions, communication instructions and hook instructions. Among them, service instructions refer to the relevant instructions provided by the system that can be used to modify system services, such as: create service, delete service, start service, stop service, etc.; window instructions refer to the window operation related instructions provided by the system or software that can be used by other software, such as: create window, destroy window, pop-up window and move window, etc.; process instructions refer to the relevant instructions provided by the system that can be used to modify system processes, such as: create process, monitor process, traverse process, terminate process, etc.; algorithm related instructions refer to the standard or non-standard encryption algorithm used by the software program, such as: symmetric encryption algorithm, asymmetric encryption algorithm, digest algorithm, etc.; communication instructions refer to the communication related instructions provided by the system or program, such as: initialize communication, create socket, send data, receive data, etc.; hook instructions are the relevant instructions provided by the system for other programs to obtain or modify system functions, such as create hook, release hook, etc.
[0094] Further, in some implementations, the feature library includes a whitelist library, a blacklist library, and a custom library, and step B2 may include:
[0095] Compare the key feature information with the features of the whitelist library to determine the first threat detection result of the file to be started; wherein the first threat detection result includes a hit and a miss;
[0096] When the first threat detection result is a miss, the key feature information is compared with the features of the blacklist library to determine a second threat detection result of the file to be started; wherein the second threat detection result includes a hit and a miss;
[0097] When the second threat detection result is a miss, the key feature information is compared with the features of the custom library to determine a third threat detection result of the file to be started; wherein the third threat detection result includes a hit and a miss;
[0098] The first threat detection result, the second threat detection result, and the third threat detection result are used as threat detection results of the file to be started.
[0099] In this embodiment, by setting a whitelist library, a blacklist library and a custom library in the feature library, it is beneficial to obtain richer threat detection results, which is beneficial for the defense module to output different execution actions according to different defense strategies in the future, thereby increasing the diversity of defense.
[0100] It is understandable that the whitelist library can store the trusted features of embedded devices set at the factory, the blacklist library can store the threat features of currently popular Trojans, worms, etc., and the custom library can store the trusted or threat features added by users according to their own needs.
[0101] Scenario 2:
[0102] In the first scenario, the method of using a signature library to perform threat detection on startup files is not capable of detecting variant viruses of the same family, and detection can only be achieved after the threat signatures are re-extracted.
[0103] To solve this technical problem, in some implementations, step 102 may include:
[0104] Step C1, extracting the file to be started and obtaining the first key feature information of the file to be started;
[0105] Step C2, calculating the information entropy of the file to be started;
[0106] Step C3, determining the decryption file of the file to be started by virtual execution, and extracting the decryption file to obtain the second key feature information;
[0107] Step C4, determining the feature threat level of the file to be started based on the first key feature information, the information entropy and the second key feature information;
[0108] Step C5: Based on the preset threshold and the characteristic threat level of the file to be started, threat detection is performed on the file to be started.
[0109] In this implementation, by extracting the first key characteristic information from the startup file, calculating the information entropy, and first virtually executing and then extracting the second key characteristic information, the startup file can be analyzed and characterized more comprehensively, thereby facilitating threat detection of the startup file. Moreover, this detection method of comprehensively analyzing and characterizing the startup file can also obtain more accurate detection results for variant viruses of the same family compared to the detection method that only relies on the feature library.
[0110] It should be noted that the method for extracting the first key feature information and the second key feature information in this embodiment can refer to the extraction method above, which will not be repeated here. At the same time, the method for calculating information entropy and virtual execution is also well known to those skilled in the art, which will not be repeated here.
[0111] Further, in some embodiments, step C4 may include:
[0112] Step C41, constructing a feature information database; wherein the feature information database includes key feature information, a threat level corresponding to the key feature information, a first preset weight, a second preset weight, and a preset information entropy weight, and the sum of the first preset weight, the preset information entropy weight, and the second preset weight is 1;
[0113] Step C42: if the first key feature information matches the key feature information included in the feature information library, determining the first feature threat level based on the first key feature information, the threat level included in the feature information library, and the first preset weight;
[0114] Step C43: determining target information entropy based on the information entropy and the preset information entropy weight;
[0115] Step C44: if the second key feature information matches the key feature information included in the feature information library, determining the second feature threat level based on the second key feature information, the threat level included in the feature information library, and the second preset weight;
[0116] Step C45, normalizing the first feature threat level, the target information entropy, and the second feature threat level;
[0117] Step C46: Determine the feature threat level of the file to be started based on the normalized first feature threat level, the target information entropy, and the second feature threat level.
[0118] In this implementation, by matching or calling the first key feature information, information entropy, and second key feature information with the constructed feature information library respectively, the first feature threat level, target information entropy, and second feature threat level can be obtained, and the obtained first feature threat level, target information entropy, and second feature threat level are normalized, which is conducive to better calculating the feature threat level of the file to be started.
[0119] In some embodiments, step C46 may include:
[0120] Use the following formula to determine the characteristic threat level of the file to be started:
[0121]
[0122] Where TW is the characteristic threat level of the file to be started, n is any integer from 1 to N, the maximum value of N is 3, 0<TW n <1, a is a constant greater than 1, TW 1 is the first characteristic threat level after normalization, TW 2 is the target information entropy after normalization, TW 3 is the threat level of the second feature after normalization.
[0123] In this implementation, the above formula is used to calculate to determine the characteristic threat level of the file to be started. This method can allocate appropriate weights (i.e., the first preset weight, the second preset weight, and the preset information entropy weight) according to the different threat levels of the first key characteristic information, the information entropy, and the second key characteristic information, so that the characteristic threat level of the file to be started can be more obviously and differentially reflected by first reducing and then expanding.
[0124] In addition, in step C41, for example, the first preset weight is 0.5, the preset information entropy weight is 0.2, and the second preset weight is 0.3; in step C42, the first characteristic threat level can be obtained by multiplying the threat level corresponding to the first key characteristic information and the first preset weight; in step C43, the target information entropy can be obtained by multiplying the information entropy and the preset information entropy weight; in step C44, the second characteristic threat level can be obtained by multiplying the threat level corresponding to the second key characteristic information and the second preset weight. In this way, after calculating the characteristic threat level of the file to be started, the Office document to be detected can be judged as malicious according to the preset threshold. This detection method has higher recognition accuracy and faster detection rate than the detection method based on the virus feature library.
[0125] Regarding step 104:
[0126] In some implementations, step 104 may include:
[0127] Obtain a pre-configured defense strategy; wherein the defense strategy is used to indicate the relationship between the execution action of the defense module on the startup file and the threat detection result of the file to be started;
[0128] Based on the defense strategy and the threat detection result of the file to be started, the defense module determines the execution action of the file to be started.
[0129] In this implementation, the user can adaptively adjust the defense strategy according to their own needs or the actual operation scenario of the embedded device, so as to obtain a richer defense module to execute actions on the startup file. For example, when the threat detection result only includes the first threat detection result (hit), the defense module allows the file to be started to pass (i.e., release); when the threat detection result includes the second threat detection result (hit), the defense module does not allow the file to be started to pass (i.e., block); when the threat detection result includes the third threat detection result (hit), the defense module allows the file to be started to pass; when the threat detection result includes the third threat detection result (miss), the defense module does not allow the file to be started to pass. In the above examples, the custom library stores the trusted features added by the user according to his own needs.
[0130] In summary, by using the mechanism of loading dynamic libraries based on the Linux system, we are not limited by system resources and kernel configuration, so that threat defense technology can be applied to embedded devices; and by using the pre-configured defense module to intercept the startup files of the Linux system, based on the threat detection results of the startup files, the defense module can release or block the startup files, thereby realizing threat defense against embedded devices.
[0131] Figure 2 A flowchart of a method for defending against threats in an embedded device according to another embodiment is shown. Figure 2 , the method comprising:
[0132] Step 200: In response to the Linux system starting, verifying the pre-configured defense module using the pre-configured verification module;
[0133] Step 202: After verification, the defense module is activated;
[0134] Step 204: In response to the Linux system loading the dynamic library, the to-be-started file of the Linux system is intercepted by using the defense module that has passed the verification;
[0135] Step 206: extract the file to be started and obtain key feature information of the file to be started;
[0136] Step 208: Compare the key feature information with the features of the whitelist library to determine the first threat detection result of the file to be started;
[0137] Step 210: When the first threat detection result is a miss, the key feature information is compared with the features of the blacklist library to determine a second threat detection result of the file to be started;
[0138] Step 212: When the second threat detection result is a miss, the key feature information is compared with the features of the custom library to determine a third threat detection result of the file to be started;
[0139] Step 214: using the first threat detection result, the second threat detection result, and the third threat detection result as threat detection results of the file to be started;
[0140] Step 216: Obtain a pre-configured defense strategy;
[0141] Step 218: Based on the defense strategy and the threat detection result of the file to be started, determine the execution action of the defense module on the file to be started.
[0142] Figure 3 A flowchart of a method for defending against threats in an embedded device according to another embodiment is shown. Figure 3 , the method comprising:
[0143] Step 300: In response to the Linux system starting, verifying the pre-configured defense module using the pre-configured verification module;
[0144] Step 302: After verification, the defense module is activated;
[0145] Step 304: In response to the Linux system loading the dynamic library, the to-be-started file of the Linux system is intercepted by using the defense module that has passed the verification;
[0146] Step 306: extract the file to be started and obtain the first key feature information of the file to be started;
[0147] Step 308: Calculate the information entropy of the file to be started;
[0148] Step 310: Determine the decrypted file of the file to be started by virtual execution, and extract the decrypted file to obtain the second key feature information;
[0149] Step 312: construct a feature information database;
[0150] Step 314: If the first key feature information matches the key feature information included in the feature information library, determining the first feature threat level based on the first key feature information, the threat level included in the feature information library, and the first preset weight;
[0151] Step 316: Determine target information entropy based on the information entropy and a preset information entropy weight;
[0152] Step 318: If the second key feature information matches the key feature information included in the feature information library, determining the second feature threat level based on the second key feature information, the threat level included in the feature information library, and the second preset weight;
[0153] Step 320: normalizing the first feature threat level, the target information entropy, and the second feature threat level;
[0154] Step 322: Determine the feature threat level of the file to be started based on the normalized first feature threat level, the target information entropy, and the second feature threat level;
[0155] Step 324: Based on a preset threshold and a characteristic threat level of the file to be started, threat detection is performed on the file to be started;
[0156] Step 326: Obtain a pre-configured defense strategy;
[0157] Step 328: Based on the defense strategy and the threat detection result of the file to be started, determine the execution action of the defense module on the file to be started.
[0158] like Figure 4 , Figure 5 As shown, an embodiment of the present invention provides a threat defense device for an embedded device. The device embodiment can be implemented by software, or by hardware or a combination of software and hardware. From the hardware level, Figure 4 As shown, a hardware architecture diagram of an electronic device where a threat defense device for an embedded device provided by an embodiment of the present invention is located, except Figure 4 In addition to the processor, memory, network interface, and non-volatile memory shown, the electronic device in the embodiment may also include other hardware, such as a forwarding chip responsible for processing messages, etc. Taking software implementation as an example, Figure 5 As shown, as a device in a logical sense, the CPU of the electronic device in which it is located reads the corresponding computer program in the non-volatile memory into the internal memory and runs it.
[0159] like Figure 5 As shown, this embodiment provides a threat defense device for an embedded device, including:
[0160] The interception unit 500 is used for intercepting the to-be-started file of the Linux system using the pre-configured defense module in response to the Linux system loading the dynamic library;
[0161] A detection unit 502, configured to perform threat detection on the startup file;
[0162] The execution unit 504 is used to determine the execution action of the defense module on the startup file based on the threat detection result of the file to be started; wherein the execution action includes release and block.
[0163] In the embodiment of the present invention, the interception unit 500 may be used to execute step 100 in the above method embodiment, the detection unit 502 may be used to execute step 102 in the above method embodiment, and the execution unit 504 may be used to execute step 104 in the above method embodiment.
[0164] like Figure 6 As shown, in one embodiment of the present invention, it also includes:
[0165] A verification unit 506, configured to verify the pre-configured defense module using a pre-configured verification module in response to the Linux system starting;
[0166] The startup unit 508 is used to start the defense module after the verification is passed, so as to use the defense module that has passed the verification to intercept the to-be-started file of the Linux system.
[0167] In one embodiment of the present invention, the detection unit 502 is configured to perform the following operations:
[0168] Extract the file to be started and obtain key feature information of the file to be started;
[0169] Based on key feature information and a pre-built feature library, threat detection is performed on the startup file; wherein the storage space occupied by the feature library does not exceed a preset capacity threshold.
[0170] In one embodiment of the present invention, the feature library includes a whitelist library, a blacklist library and a custom library;
[0171] When performing threat detection on the startup file based on the key feature information and the pre-built feature library, the detection unit 502 is used to perform the following operations:
[0172] Compare the key feature information with the features of the whitelist library to determine the first threat detection result of the file to be started; wherein the first threat detection result includes a hit and a miss;
[0173] When the first threat detection result is a miss, the key feature information is compared with the features of the blacklist library to determine a second threat detection result of the file to be started; wherein the second threat detection result includes a hit and a miss;
[0174] When the second threat detection result is a miss, the key feature information is compared with the features of the custom library to determine a third threat detection result of the file to be started; wherein the third threat detection result includes a hit and a miss;
[0175] The first threat detection result, the second threat detection result, and the third threat detection result are used as threat detection results of the file to be started.
[0176] In one embodiment of the present invention, the detection unit 502 is configured to perform the following operations:
[0177] Extracting the file to be started and obtaining the first key feature information of the file to be started;
[0178] Calculate the information entropy of the file to be started;
[0179] Determine the decryption file of the file to be started by virtual execution, and extract the decryption file to obtain the second key feature information;
[0180] Determining the feature threat level of the file to be started based on the first key feature information, the information entropy, and the second key feature information;
[0181] Based on the preset threshold and the characteristic threat level of the file to be started, threat detection is performed on the file to be started.
[0182] In one embodiment of the present invention, when the detection unit 502 determines the feature threat level of the to-be-started file based on the first key feature information, the information entropy, and the second key feature information, it is configured to perform the following operations:
[0183] Constructing a feature information database; wherein the feature information database includes key feature information, a threat level corresponding to the key feature information, a first preset weight, a second preset weight, and a preset information entropy weight, and the sum of the first preset weight, the preset information entropy weight, and the second preset weight is 1;
[0184] If the first key feature information matches the key feature information included in the feature information library, determining the first feature threat level based on the first key feature information, the threat level included in the feature information library, and the first preset weight;
[0185] Determine target information entropy based on information entropy and preset information entropy weight;
[0186] If the second key feature information matches the key feature information included in the feature information library, determining the second feature threat level based on the second key feature information, the threat level included in the feature information library, and the second preset weight;
[0187] Normalizing the first feature threat level, target information entropy, and the second feature threat level;
[0188] The feature threat level of the file to be started is determined based on the normalized first feature threat level, the target information entropy, and the second feature threat level.
[0189] In one embodiment of the present invention, the execution unit 504 is used to perform the following operations:
[0190] Obtain a pre-configured defense strategy; wherein the defense strategy is used to indicate the relationship between the execution action of the defense module on the startup file and the threat detection result of the file to be started;
[0191] Based on the defense strategy and the threat detection result of the file to be started, the defense module determines the execution action of the file to be started.
[0192] It is understood that the structure illustrated in the embodiment of the present invention does not constitute a specific limitation on a threat defense device for an embedded device. In other embodiments of the present invention, a threat defense device for an embedded device may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0193] The information interaction, execution process and other contents between the modules in the above-mentioned device are based on the same concept as the embodiment of the method of the present invention. For the specific contents, please refer to the description in the embodiment of the method of the present invention, and no further description is given here.
[0194] An embodiment of the present invention further provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, a threat defense method for an embedded device in any embodiment of the present invention is implemented.
[0195] An embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the processor executes a threat defense method for an embedded device in any embodiment of the present invention.
[0196] Specifically, a system or device equipped with a storage medium can be provided, on which software program code that implements the functions of any of the above-mentioned embodiments is stored, and a computer (or CPU or MPU) of the system or device can be enabled to read and execute the program code stored in the storage medium.
[0197] In this case, the program code itself read from the storage medium can realize the function of any one of the above-mentioned embodiments, and thus the program code and the storage medium storing the program code constitute a part of the present invention.
[0198] The storage medium embodiments for providing the program code include a floppy disk, a hard disk, a magneto-optical disk, an optical disk (such as CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-RAM, DVD-RW, DVD+RW), a magnetic tape, a non-volatile memory card, and a ROM. Alternatively, the program code can be downloaded from a server computer by a communication network.
[0199] In addition, it should be clear that the functions of any of the above embodiments can be implemented not only by executing the program code read by the computer, but also by enabling the system operating on the computer to complete part or all of the actual operations based on the instructions of the program code.
[0200] In addition, it can be understood that the program code read from the storage medium is written to a memory provided in an expansion board inserted into the computer or to a memory provided in an expansion module connected to the computer, and then based on the instructions of the program code, a CPU installed on the expansion board or expansion module is enabled to perform part or all of the actual operations, thereby realizing the functions of any of the above-mentioned embodiments.
[0201] In summary, the present invention provides a threat defense method, device, electronic device and storage medium for an embedded device, and the present invention has at least the following beneficial effects:
[0202] 1. In one embodiment of the present invention, by using a mechanism for loading dynamic libraries based on the Linux system, it is not limited by system resources and kernel configuration, so that threat defense technology can be applied to embedded devices; and a pre-configured defense module is used to intercept the startup files of the Linux system, and based on the threat detection results of the startup files, the defense module can release or block the startup files, thereby achieving threat defense against embedded devices.
[0203] 2. In one embodiment of the present invention, by using a pre-configured verification module to verify a pre-configured defense module, the integrity and authenticity of the defense module can be guaranteed, so that the interception of the to-be-started file of the Linux system and the authenticity of the subsequent detection of the to-be-started file are ensured. The embodiment of the present invention ensures the security of the intercepted to-be-started file by setting a defense module, and ensures the integrity and authenticity of the defense module by setting a verification module, thereby ensuring the effectiveness of the embedded device's real-time defense against threats.
[0204] 3. In one embodiment of the present invention, by setting a whitelist library, a blacklist library and a custom library in the feature library, it is beneficial to obtain richer threat detection results, which is beneficial for the defense module to output different execution actions according to different defense strategies in the future, thereby increasing the diversity of defense.
[0205] 4. In one embodiment of the present invention, by extracting the first key characteristic information of the startup file, calculating the information entropy, and first virtually executing and then extracting the second key characteristic information, the startup file can be analyzed and characterized more comprehensively, thereby facilitating threat detection of the startup file. Moreover, this detection method of comprehensive analysis and characterization of the startup file can also obtain more accurate detection results for variant viruses of the same family compared to the detection method that only relies on the feature library.
[0206] 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 terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that the process, method, article or equipment including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or equipment. In the absence of further restrictions, the elements defined by the statement "comprise a ..." do not exclude the existence of other identical factors in the process, method, article or equipment including the elements.
[0207] A person of ordinary skill in the art can understand that all or part of the steps of implementing the above method embodiments can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps of the above method embodiments; and the aforementioned storage medium includes: ROM, RAM, magnetic disk or optical disk, etc., various media that can store program codes.
[0208] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A threat defense method for an embedded device, characterized in that: The embedded device adopts the Linux system, and the method comprises: In response to the Linux system loading the dynamic library, intercepting the to-be-started file of the Linux system using a pre-configured defense module; Performing threat detection on the file to be started; Based on the threat detection result of the file to be started, determining the execution action of the defense module on the file to be started; wherein the execution action includes release and blocking; The performing threat detection on the file to be started includes: Extracting the file to be started and obtaining first key feature information of the file to be started; Calculating the information entropy of the file to be started; Determine the decryption file of the file to be started by virtual execution, and extract the decryption file to obtain the second key feature information; Determining a feature threat level of the to-be-activated file based on the first key feature information, the information entropy, and the second key feature information; Based on a preset threshold and a characteristic threat level of the file to be started, performing threat detection on the file to be started; The determining, based on the first key feature information, the information entropy, and the second key feature information, the feature threat level of the to-be-started file includes: Constructing a feature information database; wherein the feature information database includes key feature information, a threat level corresponding to the key feature information, a first preset weight, a second preset weight, and a preset information entropy weight, and the sum of the first preset weight, the preset information entropy weight, and the second preset weight is 1; If the first key feature information matches the key feature information included in the feature information library, determining a first feature threat level based on the first key feature information, the threat level included in the feature information library, and a first preset weight; Determining target information entropy based on the information entropy and the preset information entropy weight; If the second key feature information matches the key feature information included in the feature information library, determining the second feature threat level based on the second key feature information, the threat level included in the feature information library, and the second preset weight; Normalizing the first feature threat level, the target information entropy, and the second feature threat level; The feature threat level of the to-be-activated file is determined based on the normalized first feature threat level, the target information entropy, and the second feature threat level.
2. The method according to claim 1, characterized in that Before the step of responding to the Linux system loading the dynamic library, the step of: In response to the Linux system starting, verifying the pre-configured defense module using the pre-configured verification module; After the verification is passed, the defense module is started to intercept the to-be-started file of the Linux system using the defense module that has passed the verification.
3. The method according to any one of claims 1 to 2, characterized in that: The determining, based on the threat detection result of the file to be started, the execution action of the defense module on the file to be started includes: Acquire a pre-configured defense strategy; wherein the defense strategy is used to indicate the relationship between the execution action of the defense module on the file to be started and the threat detection result of the file to be started; Based on the defense strategy and the threat detection result of the file to be started, the execution action of the defense module on the file to be started is determined.
4. A threat defense device for an embedded device, characterized in that: The embedded device adopts the Linux system, and the device comprises: An interception unit, configured to intercept the to-be-started file of the Linux system using a pre-configured defense module in response to the Linux system loading a dynamic library; A detection unit, used for performing threat detection on the file to be started; An execution unit, configured to determine an execution action of the defense module on the file to be started based on a threat detection result of the file to be started; wherein the execution action includes release and blocking; The detection unit is used to perform the following operations: Extracting the file to be started and obtaining first key feature information of the file to be started; Calculating the information entropy of the file to be started; Determine the decryption file of the file to be started by virtual execution, and extract the decryption file to obtain the second key feature information; Determining a feature threat level of the to-be-activated file based on the first key feature information, the information entropy, and the second key feature information; Based on a preset threshold and a characteristic threat level of the file to be started, performing threat detection on the file to be started; When the detection unit determines the feature threat level of the to-be-started file based on the first key feature information, the information entropy, and the second key feature information, the detection unit is configured to perform the following operations: Constructing a feature information database; wherein the feature information database includes key feature information, a threat level corresponding to the key feature information, a first preset weight, a second preset weight, and a preset information entropy weight, and the sum of the first preset weight, the preset information entropy weight, and the second preset weight is 1; If the first key feature information matches the key feature information included in the feature information library, determining the first feature threat level based on the first key feature information, the threat level included in the feature information library, and a first preset weight; Determining target information entropy based on the information entropy and the preset information entropy weight; If the second key feature information matches the key feature information included in the feature information library, determining the second feature threat level based on the second key feature information, the threat level included in the feature information library, and the second preset weight; Normalizing the first feature threat level, the target information entropy, and the second feature threat level; The feature threat level of the to-be-activated file is determined based on the normalized first feature threat level, the target information entropy, and the second feature threat level.
5. An electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the method according to any one of claims 1 to 3 is implemented.
6. A computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, causes the computer to execute the method according to any one of claims 1 to 3.
