Automatic malicious code capturing method

By building an initial malicious code repository and feature model, detecting traffic data in real time, identifying and evaluating malicious code, the problem of low accuracy in malicious code capture in network security systems is solved, and more efficient malicious code detection and network security protection are achieved.

CN119094205AInactive Publication Date: 2024-12-06STATE GRID ZHEJIANG ELECTRIC POWER CO LTD NINGBO POWER SUPPLY CO
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202411226745.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-03
Publication Date
2024-12-06
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Existing network security systems have shortcomings in the accuracy of malicious code capture, which is mainly due to the dependence on a single and limited data source, resulting in limited capture breadth and low accuracy.

Method used

By establishing an initial malicious code repository, extracting and building static and dynamic feature models, setting up traffic capture devices, detecting traffic data in real time, identifying and evaluating malicious code, dynamically adjusting capture time intervals or blocking traffic, and continuously updating malicious code bases.

Benefits of technology

It improves the accuracy and response speed of malicious code capture, enhances identification capabilities and network security, can flexibly respond to different levels of threats, block attack paths in a timely manner, and continuously improves the accuracy and speed of detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119094205A_ABST
    Figure CN119094205A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of network information security, in particular to an automatic malicious code capturing method which comprises the following steps: establishing an initial malicious code storage library, and constructing an initial static feature model and an initial dynamic feature model; selecting an initial key node, setting a traffic capturing device, and capturing a real-time traffic data transmission packet; detecting a plurality of real-time flow data transmission packets, and identifying an initial malicious code based on a detection result; extracting a real-time data segment containing the initial malicious code, detecting the real-time network flow, the real-time data content and the real-time behavior pattern of the real-time data segment, and determining the attack degree of the malicious code based on the real-time network flow, the real-time data content and the real-time behavior pattern; adjusting a preset time interval based on the malicious code attack degree, or blocking malicious traffic; and determining that the actual malicious code is uploaded to the initial malicious code storage library so as to update the initial malicious code storage library. The malicious code capturing accuracy is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of network information security, and in particular to a method for automatically capturing malicious codes. Background Art

[0002] The current network security system's protection strategy for APT attacks generally has the following implementation methods. First, through big data technology, the data information in the network structure is mined for value, abnormal conditions in the data information operation are detected, and then the threat problems in the data information structure are analyzed. Secondly, the APT attack chain is actively analyzed, and the characteristic behaviors of APT attacks are detected and analyzed through the infiltration mode of the APT data model, and then the APT attack means are reversely detected with the running path of the target information, and the APT attack behavior is discovered, and then the APT attack is blocked.

[0003] A patent document with Chinese patent publication number CN102833240A discloses a malicious code capture method and system, which includes: obtaining email data from multiple email data sources; parsing the email data, recording files in the email data that cannot be excluded according to a set false negative rate as suspicious files, and saving the suspicious files into a suspicious file database; detecting the suspicious files using a malicious code feature database and manual detection, and saving suspicious files with abnormal detection results into the malicious code sample database.

[0004] The existing technology relies on a single limited data source, which limits the breadth of malicious code capture and causes the problem of low accuracy in malicious code capture. Summary of the invention

[0005] To this end, the present invention provides a method for automatically capturing malicious code, which can solve the problem of low accuracy in capturing malicious code.

[0006] To achieve the above object, the present invention provides a method for automatically capturing malicious code, the method comprising: Establishing an initial malicious code repository, extracting initial static features and initial dynamic features from the initial malicious code repository, and constructing an initial static feature model based on the initial static features, and constructing an initial dynamic feature model based on the initial dynamic features; selecting initial key nodes, setting a flow capture device at the initial key nodes, and capturing real-time flow data transmission packets at preset time intervals; Detecting a number of the real-time traffic data transmission packets based on the initial static feature model and the initial dynamic feature model to obtain a detection result, and identifying the initial malicious code based on the detection result; Extracting the real-time data segment containing the initial malicious code in the real-time traffic data transmission packet, detecting the real-time network traffic, real-time data content and real-time behavior pattern of the real-time data segment, and determining the degree of malicious code attack based on the real-time network traffic, real-time data content and real-time behavior pattern; Adjusting the preset time interval based on the attack degree of the malicious code, or blocking malicious traffic; The actual malicious code is determined, the actual malicious code is uploaded to the initial malicious code repository, and a new initial malicious code repository is formed to update the initial malicious code repository.

[0007] Furthermore, the step of extracting initial static features and initial dynamic features from the initial malicious code repository includes: Extracting initial static features corresponding to a plurality of initial malicious codes in the initial malicious code repository, wherein the initial static features include IP address features and file structure features; The initial malicious code is executed, and initial dynamic features are extracted based on the execution result, where the initial dynamic features include resource call sequence features and network connection behavior features.

[0008] Furthermore, the step of selecting key nodes includes: Analyze the network topology and identify the initial node based on the analysis results; A risk assessment is performed on several of the nodes based on the node traffic size, the number of devices connected to the node and the historical node security records, and the key nodes are determined based on the risk assessment results.

[0009] Furthermore, the step of detecting a plurality of the real-time traffic data transmission packets based on the initial static feature model and the initial dynamic feature model comprises: Respectively extracting real-time static features and real-time dynamic features of a plurality of real-time traffic data transmission packets; Recognize a plurality of the real-time static features based on the initial static feature model to obtain a static recognition result; Based on the initial dynamic feature model, a number of the real-time dynamic features are identified to obtain a dynamic identification result.

[0010] Furthermore, the step of identifying the initial malicious code based on the detection result includes: When the static identification result or the dynamic identification result contains a malicious code feature, it is determined to be an initial malicious code; When both the static identification result and the dynamic identification result do not include malicious code features, no malicious code is included.

[0011] Furthermore, the step of extracting the real-time data segment containing the initial malicious code in the real-time traffic data transmission packet includes: Determine the protocol type based on the port number in the IP header and the transport layer header of the real-time traffic data transmission packet, and determine the real-time structure of the real-time traffic data transmission packet according to the protocol type; determining a real-time data load according to the real-time structure; Feature matching is performed on the real-time data payload based on the initial static feature model, and the real-time data segment is determined according to the feature matching result.

[0012] Furthermore, the step of detecting the real-time network traffic, real-time data content and real-time behavior pattern of the real-time data segment includes: Identifying the real-time network traffic size of the real-time data segment based on a network traffic analysis toolkit; Compare the real-time data content with the initial data content to obtain a similarity value; The real-time transmission rate and the real-time data packet size of the real-time data segment are detected.

[0013] Furthermore, the step of determining the malicious code attack degree based on real-time network traffic, real-time data content and real-time behavior pattern includes: Calculate the traffic evaluation value based on the real-time network traffic size and the preset network traffic size; Calculate the content evaluation value based on the similarity value and the preset similarity; Calculate a mode evaluation value of the real-time behavior mode based on the real-time transmission rate and the real-time data packet size; The attack degree is determined based on the flow rate evaluation value, the content evaluation value, and the mode evaluation value.

[0014] Furthermore, the step of adjusting the preset time interval based on the malicious code attack level, or blocking malicious traffic includes: When the malicious code attack level is less than a preset attack level, adjusting the preset time interval; When the attack level of the malicious code is greater than or equal to a preset attack level, the malicious traffic is blocked.

[0015] Furthermore, the step of adjusting the preset time interval includes: Calculate the difference between the current malicious code attack level and the last detected malicious code attack level; Determine the adjustment range of the preset time interval according to the difference value; An adjustment time interval is determined based on the adjustment amplitude and the preset time interval.

[0016] Compared with the prior art, the beneficial effects of the present invention are that, by setting the initial malicious code repository as a knowledge base, a comparison benchmark is provided for subsequent identification, and by constructing the initial static feature model and the initial dynamic feature model, the system can quickly identify the traffic data transmission packets based on these features, and by carefully selecting key nodes, the capture range can be reduced and the capture efficiency can be improved. The setting of the traffic capture device ensures the effective collection of real-time traffic, providing data support for subsequent analysis, and the initial static feature model and the initial dynamic feature model are used to quickly screen the real-time traffic, so that the data packets of the initial malicious code can be quickly identified, the processing time of harmless traffic is reduced, and the response speed and accuracy are improved. By conducting detailed network traffic, data content and behavior pattern analysis on the real-time data segment of the initial malicious code, its maliciousness can be judged more accurately and its attack level can be evaluated, which helps to understand the working mechanism and impact range of the malicious code and provide a basis for subsequent response measures. The preset time interval for traffic capture can be dynamically adjusted according to the attack level of the malicious code, which can respond to threats of different levels more flexibly. At the same time, timely blocking of malicious traffic can quickly cut off the attack path and protect the security of the network system. By confirming the actual malicious code and adding it to the initial malicious code repository, new malicious code samples and features are continuously accumulated, so that its recognition ability and accuracy can be continuously improved, thereby improving the accuracy and rate of malicious code detection.

[0017] In particular, by extracting static information of IP address features and file structure features to preliminarily screen out code samples with potential maliciousness, it is helpful to identify some malicious code in the early stages. By executing the malicious code and observing its behavior, the dynamic features of the malicious code during execution are captured, reflecting the real behavior patterns of the malicious code, thereby improving the accuracy of recognition. By using a deep learning algorithm to model the extracted initial static features and initial dynamic features, learning the features of known malicious code, and training the malicious code, the generalization ability of the model is enhanced. Through the intelligent processing of the deep learning algorithm, the intelligent capture of malicious code is achieved. The constructed initial static feature model and the initial dynamic feature model provide an important basis for subsequent steps such as real-time traffic data transmission packet detection, initial malicious code identification, and malicious code attack level assessment.

[0018] In particular, by respectively extracting the real-time static features and real-time dynamic features of the real-time traffic data transmission packet, the key information in the data packet is fully captured, which helps to improve the accuracy of detection. The extracted features are identified using the already constructed initial static feature model and initial dynamic feature model to quickly determine whether the real-time traffic data transmission packet contains malicious code. By combining the identification results of static and dynamic features, the maliciousness of the real-time traffic data transmission packet is more comprehensively evaluated, which helps to reduce the false alarm rate and missed alarm rate caused by inaccurate single feature identification, and further improve the accuracy and reliability of detection. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] Figure 1 A schematic diagram of a process flow of a method for automatically capturing malicious code provided by an embodiment of the present invention; Figure 2 A schematic diagram of the process of constructing an initial static feature model and an initial dynamic feature model of the method for automatically capturing malicious code provided by an embodiment of the present invention; Figure 3 A schematic diagram of a flow chart of detecting real-time data segments of a method for automatically capturing malicious code provided by an embodiment of the present invention; Figure 4 A second flow chart of the method for automatically capturing malicious code provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0020] In order to make the objects and advantages of the present invention more clearly understood, the present invention is further described below in conjunction with embodiments; it should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.

[0021] The preferred embodiments of the present invention are described below with reference to the accompanying drawings. It should be understood by those skilled in the art that these embodiments are only used to explain the technical principles of the present invention and are not intended to limit the protection scope of the present invention.

[0022] It should be noted that, in the description of the present invention, terms such as "up", "down", "left", "right", "inside" and "outside" indicating directions or positional relationships are based on the directions or positional relationships shown in the drawings. This is merely for the convenience of description and does not indicate or imply that the device or element must have a specific orientation, be constructed and operated in a specific orientation. Therefore, it should not be understood as a limitation on the present invention.

[0023] In addition, it should be noted that in the description of the present invention, unless otherwise clearly specified and limited, the terms "installed", "connected" and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, or it can be the internal communication of two components. For those skilled in the art, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0024] See also Figure 1 As shown, an embodiment of the present invention provides a method for automatically capturing malicious code, the method comprising: step S100, establishing an initial malicious code repository, extracting initial static features and initial dynamic features in the initial malicious code repository, and constructing an initial static feature model based on the initial static features, and constructing an initial dynamic feature model based on the initial dynamic features; Step S200, selecting an initial key node, setting a flow capture device at the initial key node, and capturing real-time flow data transmission packets at preset time intervals; Step S300, detecting a number of the real-time traffic data transmission packets based on the initial static feature model and the initial dynamic feature model, obtaining a detection result, and identifying an initial malicious code based on the detection result; Step S400, extracting the real-time data segment containing the initial malicious code in the real-time traffic data transmission package, detecting the real-time network traffic, real-time data content and real-time behavior pattern of the real-time data segment, and determining the malicious code attack degree based on the real-time network traffic, real-time data content and real-time behavior pattern; Step S500, adjusting the preset time interval based on the attack level of the malicious code, or blocking malicious traffic; Step S600: determining the actual malicious code, uploading the actual malicious code to the initial malicious code repository, and forming a new initial malicious code repository to update the initial malicious code repository.

[0025] Specifically, the initial malicious code repository established in the embodiment of the present invention includes known malicious code samples and generates diversified malicious code variants by simulating attack scenarios.

[0026] Specifically, the preset time interval in the embodiment of the present invention is set based on the data transmission time interval.

[0027] Specifically, the embodiment of the present invention provides a comparison benchmark for subsequent identification by setting an initial malicious code repository as a knowledge base, and by constructing the initial static feature model and the initial dynamic feature model, the system can quickly identify traffic data transmission packets based on these features. By carefully selecting key nodes, the capture range can be reduced and the capture efficiency can be improved. The setting of the traffic capture device ensures the effective collection of real-time traffic and provides data support for subsequent analysis. The initial static feature model and the initial dynamic feature model are used to quickly screen real-time traffic, which can quickly identify the initial malicious code data packets, reduce the processing time of harmless traffic, and improve the response speed and accuracy. It conducts detailed network traffic, data content and behavior pattern analysis based on the real-time data segment of the initial malicious code, more accurately determines its maliciousness and evaluates its attack level, which helps to understand the working mechanism and impact range of the malicious code and provide a basis for subsequent response measures. It dynamically adjusts the preset time interval of traffic capture according to the attack level of the malicious code, and can respond to threats of different levels more flexibly. At the same time, timely blocking of malicious traffic can quickly cut off the attack path and protect the security of the network system. By confirming the actual malicious code and adding it to the initial malicious code repository, it continuously accumulates new malicious code samples and features, so that its recognition ability and accuracy can be continuously improved, thereby improving the accuracy and rate of malicious code detection.

[0028] See also Figure 2 As shown, the step of extracting the initial static features and the initial dynamic features in the initial malicious code repository includes: Step S110, extracting initial static features corresponding to a number of initial malicious codes in the initial malicious code repository, wherein the initial static features include IP address features and file structure features; Step S120, executing the initial malicious code, and extracting initial dynamic features based on the execution result, wherein the initial dynamic features include resource call sequence features and network connection behavior features.

[0029] Specifically, the embodiment of the present invention constructs an initial static feature model based on several of the initial static features and a deep learning algorithm; An initial dynamic feature model is constructed based on the initial dynamic features and the deep learning algorithm.

[0030] Specifically, the embodiments of the present invention preliminarily screen out code samples with potential maliciousness by extracting static information of IP address features and file structure features, which helps to identify some malicious codes in the early stages. By executing the malicious code and observing its behavior, the dynamic features of the malicious code during execution are captured, reflecting the real behavior patterns of the malicious code, thereby improving the accuracy of recognition. The extracted initial static features and initial dynamic features are modeled by using a deep learning algorithm, the features of known malicious codes are learned, and the generalization ability of the model is enhanced by training the malicious code. Through the intelligent processing of the deep learning algorithm, the intelligent capture of malicious codes is achieved. The constructed initial static feature model and the initial dynamic feature model provide an important basis for subsequent steps such as real-time traffic data transmission packet detection, initial malicious code identification, and malicious code attack level assessment.

[0031] Specifically, the deep learning algorithm described in the embodiment of the present invention is a convolutional neural network (CNN) or a recurrent neural network (RNN).

[0032] Specifically, the steps of constructing an initial static feature model based on the initial static features and the deep learning algorithm in the embodiment of the present invention include: Inputting the initial static features into a convolutional neural network, and extracting a hierarchical representation of the features through multi-layer convolution operations; Use the pooling layer to reduce feature dimensions and enhance the generalization ability of the model; The extracted features are mapped to the final classification results through the fully connected layer, and the prediction results of the initial static feature model are output.

[0033] Specifically, the step of constructing an initial dynamic feature model based on the initial dynamic features and the deep learning algorithm in the embodiment of the present invention includes: Input the initial dynamic features into a recurrent neural network, and use its internal recurrent structure to capture the dependencies on the time series; process long sequence data through a long short-term memory network (LSTM) or a gated recurrent unit (GRU); A fully connected layer and a softmax function are applied to the output layer of the RNN to map the dynamic features to the classification results and output the prediction results of the initial dynamic feature model.

[0034] Specifically, the number of convolutional layers can be selected by selecting the initial number of convolutional layers, which can be 1-4 layers, depending on the complexity of the task and the size of the dataset; Use the training set to train the model, and use the validation set to evaluate the performance of the model, and record the model performance under different numbers of convolutional layers, such as accuracy, loss function value, etc.

[0035] Use grid search, random search, or Bayesian optimization to search for the best number of convolutional layers. Use cross-validation techniques, such as K-fold cross-validation, to evaluate model performance with different numbers of convolutional layers; The number of layers with the best performance in cross-validation is selected as the initial number of convolutional layers.

[0036] Specifically, the step of selecting key nodes includes: Analyze the network topology and identify the initial node based on the analysis results; A risk assessment is performed on several of the nodes based on the node traffic size, the number of devices connected to the node and the historical node security records, and the key nodes are determined based on the risk assessment results.

[0037] Specifically, in the embodiment of the present invention, when the risk assessment is greater than the preset risk, the initial node here is used as the key node.

[0038] Specifically, the preset risk in the embodiment of the present invention is 85%.

[0039] Specifically, the steps of performing risk assessment on a number of nodes based on the node traffic size, the number of devices connected to the node, and the historical node security records in the embodiment of the present invention include: Obtain the frequency of node attacks based on historical node security records; Quantify the node traffic size, the number of devices connected to the node, and the frequency of the node being attacked, and determine the risk assessment based on the quantification results.

[0040] Specifically, the node traffic size in the embodiment of the present invention is determined by measuring the number of data packets or bytes passing through the node per unit time.

[0041] Specifically, an embodiment of the quantitative risk assessment of an embodiment of the present invention is risk assessment value = w1×traffic size quantification value + w2×connected device number quantification value + w3×attack frequency quantification value, wherein w1, w2, w3 are the weights of traffic size, number of connected devices and attack frequency, respectively, and w1+w2+w3=1, wherein the traffic size quantification value is the actual node traffic size divided by the preset traffic size, the connected device number quantification value is the actual device number divided by the preset device number, and the attack frequency quantification value is the actual attack frequency divided by the preset attack frequency.

[0042] Specifically, the preset flow size in the embodiment of the present invention is the average value of several actual node flows; The preset number of devices is 3; The preset attack frequency is an average of several historical attack frequencies.

[0043] Specifically, the step of detecting a plurality of the real-time traffic data transmission packets based on the initial static feature model and the initial dynamic feature model comprises: Respectively extracting real-time static features and real-time dynamic features of a plurality of real-time traffic data transmission packets; Recognize a plurality of the real-time static features based on the initial static feature model to obtain a static recognition result; Based on the initial dynamic feature model, a number of the real-time dynamic features are identified to obtain a dynamic identification result.

[0044] Specifically, the embodiments of the present invention respectively extract the real-time static features and real-time dynamic features of the real-time traffic data transmission packet, comprehensively capture the key information in the data packet, which helps to improve the accuracy of detection, and use the constructed initial static feature model and initial dynamic feature model to identify the extracted features, and quickly determine whether the real-time traffic data transmission packet contains malicious code. By combining the identification results of static and dynamic features, the maliciousness of the real-time traffic data transmission packet is more comprehensively evaluated, which helps to reduce the false alarm rate and missed alarm rate caused by inaccurate single feature identification, and further improve the accuracy and reliability of detection.

[0045] Specifically, the step of identifying the initial malicious code based on the detection result includes: When the static identification result or the dynamic identification result contains a malicious code feature, it is determined to be an initial malicious code; When both the static identification result and the dynamic identification result do not include malicious code features, no malicious code is included.

[0046] Specifically, the step of extracting the real-time data segment containing the initial malicious code in the real-time traffic data transmission packet includes: Determine the protocol type based on the port number in the IP header and the transport layer header of the real-time traffic data transmission packet, and determine the real-time structure of the real-time traffic data transmission packet according to the protocol type; determining a real-time data load according to the real-time structure; Feature matching is performed on the real-time data payload based on the initial static feature model, and the real-time data segment is determined according to the feature matching result.

[0047] Specifically, the protocol types described in the embodiment of the present invention include FTP, HTTP, SMTP, etc., and the initial structure of the real-time traffic data transmission packet is determined according to the protocol type, such as Content-Length, Content-Type, etc. in the HTTP protocol.

[0048] Specifically, the data payload (Payload) in the embodiment of the present invention is the part of the data packet that actually carries the data content, is usually located after the transport layer header, and is the most important part of the data packet.

[0049] Specifically, the feature matching in the embodiment of the present invention may involve performing operations such as hash calculation, string search, pattern matching, etc. on the data segment to find a portion that matches the known malicious code features.

[0050] Specifically, the embodiment of the present invention also includes recording relevant metadata (such as timestamp, source address, destination address, protocol type, data packet number, etc.) while extracting the data segment, so as to facilitate tracking and association in subsequent analysis.

[0051] See also Figure 3 As shown, the steps of detecting the real-time network traffic, real-time data content and real-time behavior pattern of the real-time data segment include: Step S410, identifying the real-time network traffic size of the real-time data segment based on a network traffic analysis toolkit; Step S420, performing a similarity comparison between the real-time data content and the initial data content to obtain a similarity value; Step S430, detecting the real-time transmission rate and real-time data packet size of the real-time data segment.

[0052] Specifically, the network traffic analysis toolkit described in the embodiment of the present invention includes but is not limited to NetFlow, sFlow, IPFIX, etc. These tools can provide detailed information of real-time traffic, such as source IP address, destination IP address, port number, protocol type, data packet size, transmission rate, etc.

[0053] Specifically, the steps of determining the malicious code attack degree based on real-time network traffic, real-time data content and real-time behavior pattern include: Calculate the traffic evaluation value based on the real-time network traffic size and the preset network traffic size; Calculate the content evaluation value based on the similarity value and the preset similarity; Calculate a mode evaluation value of the real-time behavior mode based on the real-time transmission rate and the real-time data packet size; The attack degree is determined based on the flow rate evaluation value, the content evaluation value, and the mode evaluation value.

[0054] Specifically, the preset network traffic size in the embodiment of the present invention is an average value of several actual node traffics.

[0055] An example of the traffic evaluation value may be: the preset traffic size is 100 Mbps.

[0056] The real-time network traffic size is 150Mbps.

[0057] Traffic evaluation value = (real-time traffic size - preset traffic size) / preset traffic size = (150-100) / 100 = 0.5.

[0058] Specifically, the preset similarity in the embodiment of the present invention is 90%.

[0059] Content evaluation value = similarity value / preset similarity = 95% / 90% = 1.1.

[0060] See also Figure 4 As shown, the step of adjusting the preset time interval based on the malicious code attack degree, or blocking malicious traffic includes: Step S510, when the malicious code attack level is less than a preset attack level, adjusting the preset time interval; Step S520: When the malicious code attack level is greater than or equal to a preset attack level, the malicious traffic is blocked.

[0061] Specifically, the step of adjusting the preset time interval includes: Calculate the difference between the current malicious code attack level and the last detected malicious code attack level; Determine the adjustment range of the preset time interval according to the difference value; An adjustment time interval is determined based on the adjustment amplitude and the preset time interval.

[0062] Specifically, the preset time interval described in the embodiment of the present invention is several seconds, for example, 5 seconds. If the current malicious code attack level is higher than the last detected attack level, it indicates that the malicious code attack is intensifying, so more frequent detection is required. For example, if the last detected attack level evaluation value is 0.3, and the current attack level evaluation value is 0.6, the difference value is 0.3. According to the preset adjustment strategy, the preset time interval can be adjusted to a shorter time, such as 3 seconds, to ensure timely detection and response to malicious code attacks.

[0063] Specifically, the steps of blocking malicious traffic in the embodiment of the present invention include: Identify the source and destination addresses of malicious traffic; Generate blocking rules to add the source and destination addresses of malicious traffic to the blacklist of the firewall or intrusion prevention system; apply blocking rules to prevent malicious traffic from passing through the network.

[0064] Specifically, the blocking rules in the embodiment of the present invention may include information such as IP address, port number, protocol type, etc., so as to accurately identify and block malicious traffic. In addition, the blocking rules may be temporary, effective only during the detection of malicious code attacks, or may be long-term to prevent malicious traffic from reappearing.

[0065] Specifically, the embodiment of the present invention also includes: After detecting a malicious code attack, an attack report is generated, which contains detailed information such as attack time, attack source, attack type, and attack degree; Send attack reports to network administrators or security teams for further analysis and response actions.

[0066] Specifically, the attack report described in the embodiment of the present invention can be sent to relevant personnel in various ways such as email, SMS, instant messaging, etc. The detailed information of the report helps the network administrator to quickly understand the attack situation and take corresponding defense measures, such as updating firewall rules, deploying patches, adjusting security policies, etc.

[0067] So far, the technical solutions of the present invention have been described in conjunction with the preferred embodiments shown in the accompanying drawings. However, it is easy for those skilled in the art to understand that the protection scope of the present invention is obviously not limited to these specific embodiments. Without departing from the principle of the present invention, those skilled in the art can make equivalent changes or substitutions to the relevant technical features, and the technical solutions after these changes or substitutions will fall within the protection scope of the present invention.

[0068] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A method for automatically capturing malicious code, characterized in that: include: Establishing an initial malicious code repository, extracting initial static features and initial dynamic features in the initial malicious code repository, and constructing an initial static feature model based on the initial static features, and constructing an initial dynamic feature model based on the initial dynamic features; Selecting an initial key node, setting a flow capture device at the initial key node, and capturing real-time flow data transmission packets at a preset time interval; Detecting a number of the real-time traffic data transmission packets based on the initial static feature model and the initial dynamic feature model to obtain a detection result, and identifying the initial malicious code based on the detection result; Extracting the real-time data segment containing the initial malicious code in the real-time traffic data transmission packet, detecting the real-time network traffic, real-time data content and real-time behavior pattern of the real-time data segment, and determining the degree of malicious code attack based on the real-time network traffic, real-time data content and real-time behavior pattern; Adjusting the preset time interval based on the attack degree of the malicious code, or blocking malicious traffic; The actual malicious code is determined, the actual malicious code is uploaded to the initial malicious code repository, and a new initial malicious code repository is formed to update the initial malicious code repository.

2. The method for automatically capturing malicious code according to claim 1, characterized in that: The step of extracting initial static features and initial dynamic features from the initial malicious code repository comprises: Extracting initial static features corresponding to a plurality of initial malicious codes in the initial malicious code repository, wherein the initial static features include IP address features and file structure features; The initial malicious code is executed, and initial dynamic features are extracted based on the execution result, where the initial dynamic features include resource call sequence features and network connection behavior features.

3. The method for automatically capturing malicious code according to claim 2, characterized in that: The step of selecting key nodes comprises: Analyze the network topology and identify the initial node based on the analysis results; A risk assessment is performed on several of the nodes based on the node traffic size, the number of devices connected to the node and the historical node security records, and the key nodes are determined based on the risk assessment results.

4. The method for automatically capturing malicious code according to claim 3, characterized in that: The step of detecting a plurality of real-time traffic data transmission packets based on the initial static feature model and the initial dynamic feature model comprises: Respectively extracting real-time static features and real-time dynamic features of a plurality of real-time traffic data transmission packets; Recognize a plurality of the real-time static features based on the initial static feature model to obtain a static recognition result; Based on the initial dynamic feature model, a number of the real-time dynamic features are identified to obtain a dynamic identification result.

5. The method for automatically capturing malicious code according to claim 4, characterized in that: The step of identifying the initial malicious code based on the detection result includes: When the static identification result or the dynamic identification result contains a malicious code feature, it is determined to be an initial malicious code; When both the static identification result and the dynamic identification result do not include malicious code features, no malicious code is included.

6. The method for automatically capturing malicious code according to claim 5, characterized in that: The step of extracting the real-time data segment containing the initial malicious code from the real-time traffic data transmission packet comprises: Determine the protocol type based on the port number in the IP header and the transport layer header of the real-time traffic data transmission packet, and determine the real-time structure of the real-time traffic data transmission packet according to the protocol type; determining a real-time data load according to the real-time structure; Feature matching is performed on the real-time data payload based on the initial static feature model, and the real-time data segment is determined according to the feature matching result.

7. The method for automatically capturing malicious code according to claim 6, characterized in that: The step of detecting the real-time network traffic, real-time data content and real-time behavior pattern of the real-time data segment comprises: Identifying the real-time network traffic size of the real-time data segment based on a network traffic analysis toolkit; Compare the real-time data content with the initial data content to obtain a similarity value; The real-time transmission rate and the real-time data packet size of the real-time data segment are detected.

8. The method for automatically capturing malicious code according to claim 7, characterized in that: The step of determining the malicious code attack degree based on real-time network traffic, real-time data content and real-time behavior pattern includes: Calculate the traffic evaluation value based on the real-time network traffic size and the preset network traffic size; Calculate the content evaluation value based on the similarity value and the preset similarity; Calculate a mode evaluation value of the real-time behavior mode based on the real-time transmission rate and the real-time data packet size; The attack degree is determined based on the flow rate evaluation value, the content evaluation value, and the mode evaluation value.

9. The method for automatically capturing malicious code according to claim 8, characterized in that: The step of adjusting the preset time interval based on the malicious code attack level, or blocking malicious traffic comprises: When the malicious code attack level is less than a preset attack level, adjusting the preset time interval; When the attack level of the malicious code is greater than or equal to a preset attack level, the malicious traffic is blocked.

10. The method for automatically capturing malicious code according to claim 9, characterized in that: The step of adjusting the preset time interval comprises: Calculate the difference between the current malicious code attack level and the last detected malicious code attack level; Determine the adjustment range of the preset time interval according to the difference value; An adjustment time interval is determined based on the adjustment amplitude and the preset time interval.

Citation Information

Patent Citations

  • Malicious code capturing method and system

    CN102833240A

  • Vulnerability attack traffic detection method and device

    CN116112209A

  • Malicious code detection system and method based on distributed API calling relation

    CN116756738A

  • WebShell detection method based on machine learning

    CN118551384A

  • IoT device application workload capture

    US20220321532A1