Malicious file detection method and device, equipment and storage medium
By improving the initial MalConv model and adjusting the parameter, a preset malicious file detection model is generated, which solves the problem of poor detection of unknown malicious files and their variants in the prior art, and improves the accuracy and efficiency of malicious file detection.
Patent Information
- Application Number
- CN202411204669.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-30
- Publication Date
- 2024-11-15
AI Technical Summary
Existing malicious file detection methods are poor in detecting unknown malicious files and their variants, making it difficult to effectively identify and block network security threats.
By improving the initial MalConv model, adjusting its model parameters, generating a preset malicious file detection model, and using this model to detect executable files in the network system, improving detection accuracy and efficiency.
It improves the recognition ability of malware variants, reduces computing resource consumption, achieves faster training and inference speed, and improves the accuracy and efficiency of malicious file detection.
Smart Images

Figure CN118965351A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to malicious file detection methods, devices, equipment and storage media. Background Art
[0002] Malicious file tools are a very popular means of attack in current network attacks. There are more and more variants of them, the more harmful they are, and they are becoming more and more difficult to detect and defend against. Malicious file detection is an important branch of network security, which involves identifying and blocking malware, viruses, worms, Trojans, ransomware, spyware and other files that threaten computer systems and network security.
[0003] Traditionally, when performing malicious file detection, most of the focus is on detecting malicious file-related features of known malicious file tools. This detection method can indeed detect known malicious files and their variants, but for unknown malicious file types or their multiple variants, the detection effect is poor. Summary of the invention
[0004] The present application aims to at least solve the technical problems existing in the prior art. To this end, the first aspect of the present application proposes a malicious file detection method, which includes:
[0005] Get the current executable file in the network system;
[0006] The current executable file is input into a preset malicious file detection model for processing to generate a detection result corresponding to the current executable file; wherein the preset malicious file detection model is generated based on improving the initial MalConv model using a preset improvement strategy, and the preset improvement strategy is used to adjust at least one initial model parameter of the initial MalConv model.
[0007] In a possible implementation, the process of building a preset malicious file detection model includes:
[0008] Obtaining a malicious file dataset and at least one initial model parameter corresponding to an initial MalConv model;
[0009] For various initial model parameters, the preset improvement strategy is used to adjust the initial model parameters to generate multiple sets of target model parameters;
[0010] Based on each group of target model parameters, a MalConv model to be improved corresponding to the target model parameters is obtained;
[0011] For each MalConv model to be improved, the MalConv model to be improved is trained using a malicious file dataset to generate a preset malicious file detection model.
[0012] In a possible implementation, for various initial model parameters, a preset improvement strategy is used to adjust the initial model parameters to generate multiple sets of target model parameters, including:
[0013] For various initial model parameters, a preset improvement strategy is used to factorize the initial model parameters to obtain a factor set;
[0014] Combining the elements in each factor set to obtain a combination set; wherein the combination set includes a plurality of combinations, and each combination includes a plurality of elements;
[0015] For each combination in the combination set, multiple elements in the combination are used as a group of target model parameters to generate multiple groups of target model parameters.
[0016] In a possible implementation, the initial model parameter is the convolution kernel size, and the initial model parameter is factorized using a preset improvement strategy to obtain a factor set, including:
[0017] If the convolution kernel size is a composite number, the convolution kernel size is factored, and the factors other than 1 and the convolution kernel size value are arranged in order to obtain a factor set;
[0018] If the convolution kernel size is a prime number, the composite number that is larger than the convolution kernel size and closest to the convolution kernel size is factored to obtain a factor set.
[0019] In a possible implementation, for each MalConv model to be improved, the MalConv model to be improved is trained using a malicious file data set to generate a preset malicious file detection model, including:
[0020] For each MalConv model to be improved, the MalConv model to be improved is trained using a malicious file training set in the malicious file data set to obtain an intermediate MalConv model;
[0021] Get the model evaluation parameters corresponding to the intermediate MalConv model; the model evaluation parameters include model accuracy, model training duration, and model training resources;
[0022] Based on the evaluation parameters of each model, a preset malicious file detection model is determined from each intermediate MalConv model.
[0023] In a possible implementation, based on each model evaluation parameter, a preset malicious file detection model is determined from each intermediate MalConv model, including:
[0024] Based on the evaluation parameters of each model, calculate the actual comprehensive training effect value corresponding to the intermediate MalConv model;
[0025] Obtaining the maximum value of each actual comprehensive training effect as the target comprehensive training effect value;
[0026] If the target comprehensive training effect value is greater than the initial comprehensive training effect value, the intermediate MalConv model corresponding to the target comprehensive training effect value is used as the preset malicious file detection model; wherein the initial comprehensive training effect value is obtained by training the initial MalConv model using the malicious file data set.
[0027] In a possible implementation, obtaining a malicious file dataset includes:
[0028] Obtain various original malicious file samples;
[0029] Performing data preprocessing on the original malicious file sample to obtain a preprocessed malicious file sample;
[0030] The preprocessed malicious file samples are labeled to generate a malicious file dataset; wherein the malicious file dataset includes a malicious file training set and a malicious file test set.
[0031] The second aspect of the present application provides a malicious file detection device, which includes:
[0032] An acquisition module is used to acquire the current executable file in the network system;
[0033] A generation module is used to input the current executable file into a preset malicious file detection model for processing, and generate a detection result corresponding to the current executable file; wherein the preset malicious file detection model is generated based on improving the initial MalConv model using a preset improvement strategy, and the preset improvement strategy is used to adjust at least one initial model parameter of the initial MalConv model.
[0034] In a possible implementation manner, the malicious file detection device is further used to:
[0035] Obtaining a malicious file dataset and at least one initial model parameter corresponding to an initial MalConv model;
[0036] For various initial model parameters, the preset improvement strategy is used to adjust the initial model parameters to generate multiple sets of target model parameters;
[0037] Based on each group of target model parameters, a MalConv model to be improved corresponding to the target model parameters is obtained;
[0038] For each MalConv model to be improved, the MalConv model to be improved is trained using a malicious file dataset to generate a preset malicious file detection model.
[0039] In a possible implementation manner, the malicious file detection device is further used to:
[0040] For various initial model parameters, a preset improvement strategy is used to factorize the initial model parameters to obtain a factor set;
[0041] Combining the elements in each factor set to obtain a combination set; wherein the combination set includes a plurality of combinations, and each combination includes a plurality of elements;
[0042] For each combination in the combination set, multiple elements in the combination are used as a group of target model parameters to generate multiple groups of target model parameters.
[0043] In a possible implementation, the initial model parameter is a convolution kernel size, and the malicious file detection device is further used to:
[0044] If the convolution kernel size is a composite number, the convolution kernel size is factored, and the factors other than 1 and the convolution kernel size value are arranged in order to obtain a factor set;
[0045] If the convolution kernel size is a prime number, the composite number that is larger than the convolution kernel size and closest to the convolution kernel size is factored to obtain a factor set.
[0046] In a possible implementation manner, the malicious file detection device is further used to:
[0047] For each MalConv model to be improved, the MalConv model to be improved is trained using a malicious file training set in the malicious file data set to obtain an intermediate MalConv model;
[0048] Get the model evaluation parameters corresponding to the intermediate MalConv model; the model evaluation parameters include model accuracy, model training duration, and model training resources;
[0049] Based on the evaluation parameters of each model, a preset malicious file detection model is determined from each intermediate MalConv model.
[0050] In a possible implementation manner, the malicious file detection device is further used to:
[0051] Based on the evaluation parameters of each model, calculate the actual comprehensive training effect value corresponding to the intermediate MalConv model;
[0052] Obtaining the maximum value of each actual comprehensive training effect as the target comprehensive training effect value;
[0053] If the target comprehensive training effect value is greater than the initial comprehensive training effect value, the intermediate MalConv model corresponding to the target comprehensive training effect value is used as the preset malicious file detection model; wherein the initial comprehensive training effect value is obtained by training the initial MalConv model using the malicious file data set.
[0054] In a possible implementation manner, the malicious file detection device is further used to:
[0055] Obtain various original malicious file samples;
[0056] Performing data preprocessing on the original malicious file sample to obtain a preprocessed malicious file sample;
[0057] The preprocessed malicious file samples are labeled to generate a malicious file dataset; wherein the malicious file dataset includes a malicious file training set and a malicious file test set.
[0058] The third aspect of the present application proposes an electronic device, which includes a processor and a memory, wherein the memory stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by the processor to implement the malicious file detection method as described in the first aspect.
[0059] In a fourth aspect, the present application proposes a computer-readable storage medium, in which at least one instruction, at least one program, a code set or an instruction set is stored. The at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by a processor to implement the malicious file detection method as described in the first aspect.
[0060] The embodiments of the present application have the following beneficial effects:
[0061] The malicious file detection method provided by the embodiment of the present application includes: obtaining the current executable file in the network system, inputting the current executable file into a preset malicious file detection model for processing, and generating a detection result corresponding to the current executable file, wherein the preset malicious file detection model is generated based on the initial MalConv model after being improved by a preset improvement strategy, and the preset improvement strategy is used to adjust at least one initial model parameter of the initial MalConv model. This solution can obtain the corresponding detection result by directly calculating the current malicious file through the pre-trained preset malicious file detection model, thereby improving the accuracy and efficiency of malicious file detection; in addition, by improving the initial MalConv model and adjusting the initial model parameters, the preset malicious file detection model can capture more diverse features and improve the ability to identify malware variants; and by improving and optimizing the model structure, the consumption of computing resources can be reduced, allowing faster training and reasoning speeds, thereby further improving the efficiency of malicious file detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0062] Figure 1 A block diagram of a computer device provided in an embodiment of the present application;
[0063] Figure 2 A flowchart of a malicious file detection method provided in an embodiment of the present application;
[0064] Figure 3 A flowchart of the steps of constructing a preset malicious file detection model provided in an embodiment of the present application;
[0065] Figure 4 A flowchart of the steps for obtaining a malicious file data set provided in an embodiment of the present application;
[0066] Figure 5 A flowchart of the steps for generating multiple sets of target model parameters provided in an embodiment of the present application;
[0067] Figure 6 A flowchart of the steps for generating a preset malicious file detection model provided in an embodiment of the present application;
[0068] Figure 7 Another flowchart of the steps for generating a preset malicious file detection model provided in an embodiment of the present application;
[0069] Figure 8 A structural block diagram of a malicious file detection device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0070] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0071] In the following, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the embodiments of the present disclosure, unless otherwise specified, "multiple" means two or more. In addition, the use of "based on" or "according to" means openness and inclusiveness, because the process, steps, calculations or other actions "based on" or "according to" one or more of the conditions or values may be based on additional conditions or values beyond the described values in practice.
[0072] The malicious file detection method provided in the present application can be applied to a computer device (electronic device), which can be a server or a terminal, wherein the server can be a single server or a server cluster composed of multiple servers. The embodiments of the present application do not specifically limit this. The terminal can be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, and portable wearable devices.
[0073] Take the computer device as a server as an example. Figure 1 A block diagram of a server is shown, such as Figure 1 As shown, the server may include a processor and a memory connected via a system bus. The processor of the server is used to provide computing and control capabilities. The memory of the server includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. When the computer program is executed by the processor, a malicious file detection method is implemented.
[0074] Those skilled in the art will understand that Figure 1 The structure shown in the figure is only a block diagram of a partial structure related to the solution of the present application, and does not constitute a limitation on the server to which the solution of the present application is applied. Optionally, the server may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.
[0075] It should be noted that the execution subject of the embodiments of the present application may be a computer device or a malicious file detection device. The following method embodiments are described using a computer device as the execution subject.
[0076] Figure 2 A flowchart of a malicious file detection method provided in an embodiment of the present application. Figure 2 As shown, the method comprises the following steps:
[0077] Step 202: Obtain the current executable file in the network system.
[0078] Among them, malicious file detection is an important branch of network security, which involves identifying and blocking malware, viruses, worms, Trojan horses, ransomware, spyware and other files that pose a threat to computer systems and network security.
[0079] When performing malicious file detection, it is necessary to first obtain the current executable file, and the current executable file obtained can be multiple files. In addition, the format of the current executable file can be a portable executable file or a binary file, and the embodiment of the present application does not specifically limit this.
[0080] Step 204: input the current executable file into a preset malicious file detection model for processing, and generate a detection result corresponding to the current executable file.
[0081] Among them, the preset malicious file detection model is generated based on improving the initial MalConv model using a preset improvement strategy, and the preset improvement strategy is used to adjust at least one initial model parameter of the initial MalConv model.
[0082] After obtaining the current executable file, the current executable file can be input into a preset malicious file detection model for processing, thereby generating a detection result corresponding to the current executable file, which can be whether the current executable file is a malicious file and the corresponding probability value.
[0083] The above-mentioned preset malicious file detection model needs to be pre-built. In some optional embodiments, such as Figure 3 As shown, Figure 3 A flowchart of the steps of building a preset malicious file detection model provided in an embodiment of the present application includes:
[0084] Step 302: Obtain a malicious file dataset and at least one initial model parameter corresponding to the initial MalConv model.
[0085] Among them, when obtaining the malicious file dataset, such as Figure 4 As shown, Figure 4A flowchart of the steps of obtaining a malicious file data set provided in an embodiment of the present application includes:
[0086] Step 402: Obtain multiple original malicious file samples.
[0087] Step 404: perform data preprocessing on the original malicious file sample to obtain a preprocessed malicious file sample.
[0088] Step 406: label the preprocessed malicious file samples to generate a malicious file data set.
[0089] The various original malicious file samples may include but are not limited to virus files, worm files, Trojan files, ransomware files, adware files, malicious ad files, spyware files, backdoor or remote access Trojan files, botnet files, etc. In addition, the number of various original malicious file samples obtained should be roughly the same, so that the training and prediction of the later model can be more accurate.
[0090] Next, the obtained original malicious file sample can be subjected to data preprocessing to obtain a preprocessed malicious file sample. Optionally, the data preprocessing can be a data format conversion process, so the original malicious file sample can be converted into a format that can be processed by the model. Thus, in the MalConv model, each byte of the converted malicious file is regarded as a feature and embedded into a high-dimensional space.
[0091] The preprocessed malicious file samples are then labeled to generate a malicious file data set, which includes a malicious file training set and a malicious file test set. Optionally, a label can be assigned to the preprocessed malicious file samples, and a binary classification label can be used, specifically, "malicious" and "benign".
[0092] In addition, in order to more precisely identify the types of malicious files, the "malicious" label category can be further subdivided into multiple label subcategories such as "virus" and "worm". The "benign" label category can no longer be subdivided.
[0093] The MalConv model is a deep learning model implemented based on PyTorch, which is used to identify and classify whether a computer file is malware. The basic structure of the initial MalConv model can refer to the existing model structure, which will not be repeated here. After building the initial MalConv model, it is also necessary to obtain at least one initial model parameter corresponding to the initial MalConv model. The initial model parameters can include multiple parameters such as convolution kernel and step size, convolution depth, gating mechanism, etc.
[0094] Step 304: For various initial model parameters, a preset improvement strategy is used to adjust the initial model parameters to generate multiple groups of target model parameters.
[0095] The preset improvement strategy may be an improvement strategy designed according to different types of initial model parameters. The preset improvement strategy may include multiple ones, and each preset improvement strategy may be pre-designed for one initial model parameter. Figure 5 As shown, Figure 5 A flowchart of the steps of generating multiple sets of target model parameters provided in an embodiment of the present application includes:
[0096] Step 502: for various initial model parameters, a preset improvement strategy is used to factorize the initial model parameters to obtain a factor set.
[0097] Step 504: Combine the elements in each factor set to obtain a combination set.
[0098] Step 506: For each combination in the combination set, multiple elements in the combination are used as a group of target model parameters to generate multiple groups of target model parameters.
[0099] Among them, the initial model parameters can be factored by using a preset improvement strategy to obtain a factor set, and then the elements in each factor set are recombined to obtain a combination set, which can include multiple combinations, and each combination includes multiple elements. Finally, for each combination in the combination set, multiple elements in the combination can be used as a set of target model parameters to generate multiple sets of target model parameters.
[0100] Taking the initial model parameter as the convolution kernel size as an example, when factoring, if the convolution kernel size is a composite number, the convolution kernel size is factored, and the factors other than 1 and the convolution kernel size value are arranged in order to obtain a factor set. If the convolution kernel size is a prime number, the composite number that is larger than the convolution kernel size and closest to the convolution kernel size is factored to obtain a factor set.
[0101] Specifically, the convolution kernel size of the initial model parameters can be expressed as m0×m0. When factoring, if m0 is a composite number, m0 is factored, and after removing 1 and m0 from the multiple factors obtained by the decomposition, the remaining factors are arranged in order to finally form a factor set n0, where the order can be from large to small. For example, if m0 is 6, after 6 is factored, the multiple factors obtained include 1, 6, 2, and 3, and after removing 1 and 6 from the multiple factors obtained by the decomposition, the remaining factors are arranged in order from large to small, and finally form a factor set n0, which can be recorded as {3,2}.
[0102] If m0 is a prime number, then you can add one to it to get a new m0. If the new m0 is still a prime number, continue to add one until the new m0 is a composite number, that is, you get a composite number that is larger than the convolution kernel size m0 and closest to the convolution kernel size m0. Then factorize the composite number to get the factor set n0. The process of factorizing the composite number here is the same as the above factorization process, so it will not be repeated here.
[0103] When the initial model parameters include the step length s0, the step length s0 may also be factorized according to the above process to obtain a factor set, which may be recorded as k0. For example, if s0 is 30, the obtained factor set k0 may be recorded as {5, 3, 2}.
[0104] When the two factor sets n0 and k0 are obtained, the elements in each factor set can be combined to obtain a combination set. For example, if n0 is {3, 2} and k0 is {5, 3, 2}, there can be six combinations, which form a combination set.
[0105] The six combinations are {3, 5}, {3, 3}, {3, 2}, {2, 5}, {2, 3}, and {2, 2}. Thus, for each combination in the combination set, multiple elements in the combination can be used as a set of target model parameters to generate multiple sets of target model parameters. Here, {3, 5} is a combination in the combination set, and the elements in the combination are 3 and 5 respectively.
[0106] It should be noted that when determining the target model parameters, the element comes from the factor set obtained after decomposing the initial model parameters of a certain type. If the element is used as the target model parameter, the initial model parameters of the same type need to be modified and replaced. In other words, for the combination {3, 5}, since the first element 3 in the combination comes from the factor set obtained after decomposing the convolution kernel size m0, the element 3 is used to modify and replace the original model parameter of the convolution kernel size when used as the target model parameter.
[0107] In this embodiment, by improving the initial MalConv model, the convolution kernel size and step size in the initial model parameters are reduced, so that the preset malicious file detection model can capture more diverse features and improve the ability to identify malware variants.
[0108] Step 306: Based on each group of target model parameters, a MalConv model to be improved corresponding to the target model parameters is obtained.
[0109] Among them, for each group of target model parameters mentioned above, after copying the basic structure of the MalConv model, the initial model parameters are modified and replaced by the above groups of target model parameters, so that multiple MalConv models to be improved corresponding to the target model parameters can be obtained. Here, the number of MalConv models to be improved is the same as the number of groups of target model parameters, that is, the number of MalConv models to be improved is the same as the number of groups of target model parameters. In addition, these multiple MalConv models to be improved can also be stored to facilitate subsequent model training, evaluation and other processes.
[0110] Step 308: For each MalConv model to be improved, the MalConv model to be improved is trained using a malicious file data set to generate a preset malicious file detection model.
[0111] After obtaining each MalConv model to be improved, the stored MalConv models to be improved can be trained one by one in sequence. Figure 6 As shown, Figure 6 A flowchart of the steps of generating a preset malicious file detection model provided in an embodiment of the present application includes:
[0112] Step 602: For each MalConv model to be improved, the MalConv model to be improved is trained using a malicious file training set in the malicious file data set to obtain an intermediate MalConv model.
[0113] Step 604: Obtain model evaluation parameters corresponding to the intermediate MalConv model.
[0114] Step 606: Based on the evaluation parameters of each model, determine a preset malicious file detection model from each intermediate MalConv model.
[0115] Among them, for each MalConv model to be improved, the MalConv model to be improved can be trained by the malicious file training set in the malicious file data set, so as to obtain an intermediate MalConv model. During the model training process, the model will learn to identify patterns and features related to malware, and record the model training usage time and model training resources. Optionally, the model training resources can be simply measured using the graphics card memory usage.
[0116] Thus, the model evaluation parameters corresponding to the intermediate MalConv model can be obtained, wherein the model evaluation parameters include model accuracy, model training time, and model training resources. The model accuracy can be obtained after the model training is completed and evaluated through the malicious file test set. Optionally, the model accuracy here can be obtained using different indicators such as accuracy, recall rate, F1 value, or a combination of multiple indicators.
[0117] Finally, the preset malicious file detection model can be determined from each intermediate MalConv model based on each model evaluation parameter. Figure 7 As shown, Figure 7 Another flowchart of steps for generating a preset malicious file detection model provided in an embodiment of the present application includes:
[0118] Step 702: Based on the evaluation parameters of each model, the actual comprehensive training effect value corresponding to the intermediate MalConv model is calculated.
[0119] Step 704: Obtain the maximum value of each actual comprehensive training effect as the target comprehensive training effect value.
[0120] Step 706: If the target comprehensive training effect value is greater than the initial comprehensive training effect value, the intermediate MalConv model corresponding to the target comprehensive training effect value is used as the preset malicious file detection model.
[0121] Among them, when calculating the actual comprehensive training effect value corresponding to the intermediate MalConv model based on each model evaluation parameter, it can be calculated by y=a0*z0+a1*x1+a2*x2. Among them, y is the actual comprehensive training effect value, z0 is the model accuracy after the model is improved by the above preset improvement strategy, x1 is the model training usage time, x2 is the model training resources, a0, a1, a2 are their corresponding weights, which can be customized in advance. Generally, a0 is much larger than a1 and a2. By comprehensively considering model accuracy, model training usage time, and model training resources as model optimization indicators, model optimization means better overall performance.
[0122] In addition, the number of actual comprehensive training effect values can be calculated here based on the number of target model parameter groups. Thus, the maximum value of each actual comprehensive training effect can be obtained as the target comprehensive training effect value. If the target comprehensive training effect value is greater than the initial comprehensive training effect value, the intermediate MalConv model corresponding to the target comprehensive training effect value is used as the preset malicious file detection model. Among them, the initial comprehensive training effect value here is obtained after training the initial MalConv model using the malicious file data set.
[0123] In some optional embodiments, since the initial model parameters can include multiple types, there can be corresponding preset improvement strategies for each type of initial model parameter. The actual comprehensive training effect value obtained after improvement using one of the preset improvement strategies can be denoted as win(i), and the previous actual comprehensive training effect value obtained after improvement using the previous preset improvement strategy can be denoted as win(i - 1). If win(i - 1) < win(i), it is considered that the current optimization is effective; otherwise, the current optimization is ineffective.
[0124] If the current improvement is effective, the intermediate MalConv model after the current improvement is used as the preset malicious file detection model. That is, if the improvement is effective, the previous MalConv model is replaced with the current better model, and subsequent model optimization is performed based on the already optimized model. In this way, the optimization ability is inherited.
[0125] If the current improvement is ineffective, the current optimization is abandoned. Then, the next preset improvement strategy is selected to continue the optimization, and all the above steps are repeated until all the preset improvement strategies have been used. At this time, the iterated model is the optimal model, that is, the final preset malicious file detection model is obtained.
[0126] This application provides a malicious file detection method, which includes: obtaining the current executable file in the network system, inputting the current executable file into the preset malicious file detection model for processing, and generating a detection result corresponding to the current executable file. The preset malicious file detection model is generated by improving the initial MalConv model using a preset improvement strategy, and the preset improvement strategy is used to adjust at least one initial model parameter of the initial MalConv model. This solution can directly calculate the current malicious file through the pre-trained preset malicious file detection model to obtain the corresponding detection result, improving the accuracy and efficiency of malicious file detection; in addition, by improving the initial MalConv model and adjusting the initial model parameters, the preset malicious file detection model can capture more diverse features, improving the recognition ability of malicious software variants; and by improving and optimizing the model structure, the consumption of computing resources can be reduced, allowing for faster training and inference speeds, thereby further improving the efficiency of malicious file detection.
[0127] Figure 8 It is a structural block diagram of a malicious file detection device provided by an embodiment of this application.
[0128] As Figure 8 shown, the malicious file detection device 800 includes:
[0129] An acquisition module 802, configured to acquire the current executable file in the network system.
[0130] The generation module 804 is used to input the current executable file into a preset malicious file detection model for processing, and generate a detection result corresponding to the current executable file; wherein the preset malicious file detection model is generated based on improving the initial MalConv model using a preset improvement strategy, and the preset improvement strategy is used to adjust at least one initial model parameter of the initial MalConv model.
[0131] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here. Each module in the above malicious file detection device can be implemented in whole or in part by software, hardware, and a combination thereof. The above modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations of the above modules.
[0132] In one embodiment of the present application, a computer device is provided, the computer device comprising a memory and a processor, the memory storing a computer program, and the processor implementing the following steps when executing the computer program:
[0133] Get the current executable file in the network system;
[0134] The current executable file is input into a preset malicious file detection model for processing to generate a detection result corresponding to the current executable file; wherein the preset malicious file detection model is generated based on improving the initial MalConv model using a preset improvement strategy, and the preset improvement strategy is used to adjust at least one initial model parameter of the initial MalConv model.
[0135] In one embodiment of the present application, when the processor executes the computer program, the processor further implements the following steps:
[0136] Obtaining a malicious file dataset and at least one initial model parameter corresponding to an initial MalConv model;
[0137] For various initial model parameters, the preset improvement strategy is used to adjust the initial model parameters to generate multiple sets of target model parameters;
[0138] Based on each group of target model parameters, a MalConv model to be improved corresponding to the target model parameters is obtained;
[0139] For each MalConv model to be improved, the MalConv model to be improved is trained using a malicious file dataset to generate a preset malicious file detection model.
[0140] In one embodiment of the present application, when the processor executes the computer program, the processor further implements the following steps:
[0141] For various initial model parameters, a preset improvement strategy is used to factorize the initial model parameters to obtain a factor set;
[0142] Combining the elements in each factor set to obtain a combination set; wherein the combination set includes a plurality of combinations, and each combination includes a plurality of elements;
[0143] For each combination in the combination set, multiple elements in the combination are used as a group of target model parameters to generate multiple groups of target model parameters.
[0144] In one embodiment of the present application, the initial model parameter is the convolution kernel size, and the processor further implements the following steps when executing the computer program:
[0145] If the convolution kernel size is a composite number, the convolution kernel size is factored, and the factors other than 1 and the convolution kernel size value are arranged in order to obtain a factor set;
[0146] If the convolution kernel size is a prime number, the composite number that is larger than the convolution kernel size and closest to the convolution kernel size is factored to obtain a factor set.
[0147] In one embodiment of the present application, when the processor executes the computer program, the processor further implements the following steps:
[0148] For each MalConv model to be improved, the MalConv model to be improved is trained using a malicious file training set in the malicious file data set to obtain an intermediate MalConv model;
[0149] Get the model evaluation parameters corresponding to the intermediate MalConv model; the model evaluation parameters include model accuracy, model training duration, and model training resources;
[0150] Based on the evaluation parameters of each model, a preset malicious file detection model is determined from each intermediate MalConv model.
[0151] In one embodiment of the present application, when the processor executes the computer program, the processor further implements the following steps:
[0152] Based on the evaluation parameters of each model, calculate the actual comprehensive training effect value corresponding to the intermediate MalConv model;
[0153] Obtaining the maximum value of each actual comprehensive training effect as the target comprehensive training effect value;
[0154] If the target comprehensive training effect value is greater than the initial comprehensive training effect value, the intermediate MalConv model corresponding to the target comprehensive training effect value is used as the preset malicious file detection model; wherein the initial comprehensive training effect value is obtained by training the initial MalConv model using the malicious file data set.
[0155] In one embodiment of the present application, when the processor executes the computer program, the processor further implements the following steps:
[0156] Obtain various original malicious file samples;
[0157] Performing data preprocessing on the original malicious file sample to obtain a preprocessed malicious file sample;
[0158] The preprocessed malicious file samples are labeled to generate a malicious file dataset; wherein the malicious file dataset includes a malicious file training set and a malicious file test set.
[0159] The computer device provided in the embodiment of the present application has similar implementation principles and technical effects to those of the above-mentioned method embodiment, and will not be described in detail here.
[0160] In one embodiment of the present application, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented:
[0161] Get the current executable file in the network system;
[0162] The current executable file is input into a preset malicious file detection model for processing to generate a detection result corresponding to the current executable file; wherein the preset malicious file detection model is generated based on improving the initial MalConv model using a preset improvement strategy, and the preset improvement strategy is used to adjust at least one initial model parameter of the initial MalConv model.
[0163] In one embodiment of the present application, when the computer program is executed by a processor, the following steps are further implemented:
[0164] Obtaining a malicious file dataset and at least one initial model parameter corresponding to an initial MalConv model;
[0165] For various initial model parameters, the preset improvement strategy is used to adjust the initial model parameters to generate multiple sets of target model parameters;
[0166] Based on each group of target model parameters, a MalConv model to be improved corresponding to the target model parameters is obtained;
[0167] For each MalConv model to be improved, the MalConv model to be improved is trained using a malicious file dataset to generate a preset malicious file detection model.
[0168] In one embodiment of the present application, when the computer program is executed by a processor, the following steps are further implemented:
[0169] For various initial model parameters, a preset improvement strategy is used to factorize the initial model parameters to obtain a factor set;
[0170] Combining the elements in each factor set to obtain a combination set; wherein the combination set includes a plurality of combinations, and each combination includes a plurality of elements;
[0171] For each combination in the combination set, multiple elements in the combination are used as a group of target model parameters to generate multiple groups of target model parameters.
[0172] In one embodiment of the present application, the initial model parameter is the convolution kernel size, and the computer program, when executed by the processor, further implements the following steps:
[0173] If the convolution kernel size is a composite number, the convolution kernel size is factored, and the factors other than 1 and the convolution kernel size value are arranged in order to obtain a factor set;
[0174] If the convolution kernel size is a prime number, the composite number that is larger than the convolution kernel size and closest to the convolution kernel size is factored to obtain a factor set.
[0175] In one embodiment of the present application, when the computer program is executed by a processor, the following steps are further implemented:
[0176] For each MalConv model to be improved, the MalConv model to be improved is trained using a malicious file training set in the malicious file data set to obtain an intermediate MalConv model;
[0177] Get the model evaluation parameters corresponding to the intermediate MalConv model; the model evaluation parameters include model accuracy, model training duration, and model training resources;
[0178] Based on the evaluation parameters of each model, a preset malicious file detection model is determined from each intermediate MalConv model.
[0179] In one embodiment of the present application, when the computer program is executed by a processor, the following steps are further implemented:
[0180] Based on the evaluation parameters of each model, calculate the actual comprehensive training effect value corresponding to the intermediate MalConv model;
[0181] Obtaining the maximum value of each actual comprehensive training effect as the target comprehensive training effect value;
[0182] If the target comprehensive training effect value is greater than the initial comprehensive training effect value, the intermediate MalConv model corresponding to the target comprehensive training effect value is used as the preset malicious file detection model; wherein the initial comprehensive training effect value is obtained by training the initial MalConv model using the malicious file data set.
[0183] In one embodiment of the present application, when the computer program is executed by a processor, the following steps are further implemented:
[0184] Obtain various original malicious file samples;
[0185] Performing data preprocessing on the original malicious file sample to obtain a preprocessed malicious file sample;
[0186] The preprocessed malicious file samples are labeled to generate a malicious file dataset; wherein the malicious file dataset includes a malicious file training set and a malicious file test set.
[0187] The computer-readable storage medium provided in this embodiment has similar implementation principles and technical effects to those of the above method embodiments, and will not be described in detail here.
[0188] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0189] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.
[0190] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A malicious file detection method, characterized in that: The method comprises: Get the current executable file in the network system; The current executable file is input into a preset malicious file detection model for processing to generate a detection result corresponding to the current executable file; wherein the preset malicious file detection model is generated based on improving the initial MalConv model using a preset improvement strategy, and the preset improvement strategy is used to adjust at least one initial model parameter of the initial MalConv model.
2. The method according to claim 1, characterized in that The process of building the preset malicious file detection model includes: Obtaining a malicious file dataset and at least one initial model parameter corresponding to the initial MalConv model; For various initial model parameters, the preset improvement strategy is used to adjust the initial model parameters to generate multiple groups of target model parameters; Based on each group of the target model parameters, a MalConv model to be improved corresponding to the target model parameters is obtained; For each of the MalConv models to be improved, the MalConv model to be improved is trained using the malicious file data set to generate the preset malicious file detection model.
3. The method according to claim 2, characterized in that The preset improvement strategy is used to adjust the initial model parameters for various initial model parameters to generate multiple groups of target model parameters, including: For various initial model parameters, the preset improvement strategy is used to factorize the initial model parameters to obtain a factor set; Combining the elements in each of the factor sets to obtain a combination set; wherein the combination set includes a plurality of combinations, and each of the combinations includes a plurality of elements; For each combination in the combination set, multiple elements in the combination are taken as a group of the target model parameters to generate the multiple groups of target model parameters.
4. The method according to claim 3, characterized in that The initial model parameter is the convolution kernel size, and the initial model parameter is factorized by the preset improvement strategy to obtain a factor set, including: If the convolution kernel size is a composite number, factorizing the convolution kernel size, and sequentially arranging the factors except 1 and the convolution kernel size value itself among the multiple factors to obtain the factor set; If the convolution kernel size is a prime number, factorizing a composite number that is larger than the convolution kernel size and closest to the convolution kernel size to obtain the factor set.
5. The method according to any one of claims 2 to 4, characterized in that: The method of training each of the MalConv models to be improved by using the malicious file data set to generate the preset malicious file detection model includes: For each of the MalConv models to be improved, the MalConv model to be improved is trained using a malicious file training set in the malicious file data set to obtain an intermediate MalConv model; Obtaining model evaluation parameters corresponding to the intermediate MalConv model; wherein the model evaluation parameters include model accuracy, model training usage time, and model training usage resources; Based on each of the model evaluation parameters, the preset malicious file detection model is determined from each of the intermediate MalConv models.
6. The method according to claim 5, characterized in that The step of determining the preset malicious file detection model from each of the intermediate MalConv models based on each of the model evaluation parameters includes: Based on each of the model evaluation parameters, calculating the actual comprehensive training effect value corresponding to the intermediate MalConv model; Obtaining the maximum value among the actual comprehensive training effects as the target comprehensive training effect value; If the target comprehensive training effect value is greater than the initial comprehensive training effect value, the intermediate MalConv model corresponding to the target comprehensive training effect value is used as the preset malicious file detection model; wherein the initial comprehensive training effect value is obtained by training the initial MalConv model using the malicious file data set.
7. The method according to any one of claims 2 to 4, characterized in that: The obtaining of the malicious file dataset includes: Obtain various original malicious file samples; Performing data preprocessing on the original malicious file sample to obtain a preprocessed malicious file sample; The preprocessed malicious file samples are labeled to generate the malicious file data set; wherein the malicious file data set includes a malicious file training set and a malicious file test set.
8. A malicious file detection device, characterized in that: The device comprises: An acquisition module is used to acquire the current executable file in the network system; A generation module is used to input the current executable file into a preset malicious file detection model for processing, and generate a detection result corresponding to the current executable file; wherein the preset malicious file detection model is generated based on improving the initial MalConv model using a preset improvement strategy, and the preset improvement strategy is used to adjust at least one initial model parameter of the initial MalConv model.
9. An electronic device, characterized in that: The electronic device includes a processor and a memory, wherein the memory stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by the processor to implement the malicious file detection method as described in any one of claims 1-7.
10. A computer-readable storage medium, characterized in that: The storage medium stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by the processor to implement the malicious file detection method as described in any one of claims 1-7.
