Malicious code analysis method and system based on large model mechanism, electronic equipment and storage medium
Through the malicious code analysis method based on the big model mechanism, the full code gene analysis model and network security corpus are used to extract and analyze code characteristics, which solves the problems of poor generalization ability of traditional methods and scarce professional analysts, and achieves the massive code Efficient identification and rapid detection.
Patent Information
- Application Number
- CN202411003358.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-25
- Publication Date
- 2024-11-01
AI Technical Summary
Traditional malicious code analysis methods rely on prior knowledge, have poor generalization capabilities, and are difficult to adapt to new and dynamically changing malicious code. There are scarce professional analysts, making it difficult for security teams to quickly deal with new threats.
Using malicious code analysis method based on the big model mechanism, by receiving binary files or code segments, extracting functions, attributes, behaviors and entity features, converting them into feature vectors, and inputting them into full code gene analysis model for analysis, using structured and semi-directed Knowledge training and learning of network security corpus and full code library built with structured and unstructured network security data to identify potential malicious code.
It realizes efficient analysis of massive code, improves the efficiency and accuracy of malicious code detection, can quickly identify potential malicious code, and improves network security protection capabilities.
Smart Images

Figure CN118886012A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of malicious code analysis, and in particular to a malicious code analysis method, system, electronic device and storage medium based on a large model mechanism. Background Art
[0002] With the rapid development of information technology, network security issues have become increasingly prominent. As a key carrier of network threats, the detection and analysis of malicious code has become a core task in the field of network security. However, traditional malicious code analysis methods have obvious shortcomings. On the one hand, detection methods based on low-level static features or simple rules rely heavily on prior knowledge, have poor generalization capabilities, and are difficult to adapt to new and dynamically changing malicious codes; on the other hand, with the evolution of malicious code technology, professional analysts are scarce and face the pressure of knowledge update, making it difficult for security teams to respond to new threats quickly and effectively.
[0003] In recent years, with the development and application of large language models, the application of large language models is causing a revolution in the field of network security. For example, OpenAI's CodeX and Google's MalGAN use the natural language understanding capabilities of large models to generate codes for corresponding functions to assist security experts in analysis and operation. In addition, the core foundation of tools such as Sangfor's Security GPT and Qi'anxin's Q-GPT is a large security model that is pre-trained based on massive security knowledge data, security logs, documents, knowledge bases, intelligence data, etc., mainly by processing massive logs and alarm information to improve the work efficiency of security operators. Although these applications have made some progress in code understanding, there is still a gap in the field of professional malicious code analysis, and there is no analysis and identification of security at the more basic code level. Summary of the invention
[0004] In view of this, an embodiment of the present invention provides a malicious code analysis method, system, electronic device and storage medium based on a large model mechanism, which can efficiently analyze massive amounts of code, thereby facilitating the rapid identification of malicious code.
[0005] In order to achieve the above-mentioned invention object, the following technical scheme is adopted: In the first aspect, an embodiment of the present invention provides a malicious code analysis method based on a large model mechanism, including: receiving a binary file, intelligence text or code segment uploaded by a user, and performing feature extraction on the binary file, text or code segment to obtain the function, attribute, behavior and entity characteristics of the binary file, intelligence text or code segment; converting the obtained function, attribute, behavior and entity characteristics into feature vectors respectively; inputting the feature vector into a full code genetic analysis model, analyzing the feature vector according to the learned knowledge, and identifying potential malicious code; the full code genetic analysis model is a large model obtained by knowledge training and learning of a network security corpus and a full code library constructed based on structured, semi-structured and unstructured network security data.
[0006] Optionally, before performing malicious code analysis, the method also includes: constructing a network security corpus based on structured, semi-structured, and unstructured network security data, specifically: collecting multi-source heterogeneous malicious code knowledge data; wherein the malicious code knowledge data includes: malicious code structure, JSON file, network threat analysis report; for the structured data in the malicious code knowledge data, storing the structured data from different data sources according to a unified format and rules; and, for the semi-structured data and unstructured data in the malicious code knowledge data, using named entity recognition technology to extract key feature information from the semi-structured data and unstructured data, the key feature information includes: hash value, malicious type, virus family; analyzing the association relationship between knowledge in the semi-structured data and unstructured data based on the key feature information, and extracting the association relationship between knowledge to form a standard malicious code knowledge expression data set; adding sample labels to the data in the data set to obtain the network security corpus; the sample labels include: malicious and trusted.
[0007] Optionally, before performing malicious code analysis, the method also includes: building a full code library for use in full code genetic analysis model training; collecting code samples from multiple sources, the code samples including binary files, scripts and code resources; using disassembly technology to statically analyze the code samples, extract instruction sequences and program logic, and using a dynamic sandbox tool to execute the code samples for dynamic analysis, observing the behavior of the code samples and the impact on the system; analyzing the entry point instruction sequence of the code sample, performing standardized preprocessing on it, and obtaining a code sample file; reading the segment information, import and export functions, and string information of the code sample file, and extracting key data; dividing the code into blocks according to the function, attribute, behavior or entity characteristics of the code segment; associating and mapping the code blocks with the corresponding functions, attributes, behaviors or entity characteristics, assigning feature labels to each code block, identifying the functions, attributes, behaviors or entity characteristics of each code block, and forming a full code library for use in full code genetic analysis model training.
[0008] Optionally, after constructing a full code library and a full code library serving the full code genetic analysis model training, the method further includes: preprocessing the obtained network security corpus and full code data, including data cleaning, standardization and denoising operations to ensure data consistency; using natural language processing technology and network security domain knowledge to label the network security corpus and full code data, assigning semantic labels to different types of structural data, and identifying their types, functions, attributes, behaviors and entity characteristics; classifying, associating, integrating and organizing the labeled data according to type, function, attribute, behavior and entity characteristics to construct a network security analysis knowledge graph.
[0009] Optionally, before performing malicious code analysis, the method further includes: obtaining a full code gene analysis model based on knowledge learning training of the constructed network security corpus and full code library; specifically: selecting a multilingual pre-trained model as the architecture of the full code gene analysis model; the multilingual pre-trained model is trained to perform multiple natural language multi-processing tasks; obtaining the network security corpus and inputting it into the multilingual pre-trained model for code structure understanding and expression training, so that the multilingual pre-trained model can understand the structure of the code and express it; inputting the full code library into the multilingual pre-trained model, and performing multi-task training based on the code blocks in the full code library; the multi-tasks include: code malice detection classification, behavior analysis, function analysis and dialogue generation; wherein the code blocks are labeled data carrying feature labels; using the labeled data corresponding to the target task to perform hyperparameter fine-tuning on the multilingual pre-trained model, and monitoring the performance of the model on the validation set until the performance on each task meets the expected training goals.
[0010] Optionally, during the training process, the method further includes: distributing the training data in parallel on multiple computing nodes, or dividing the multilingual pre-trained model into multiple models that perform different task training, and performing corresponding task type training on each split model.
[0011] Optionally, after the full-code genetic analysis model is trained, the method further includes: extracting the knowledge contained in the trained large model into the small model through knowledge distillation, and transferring the learned knowledge to the small model; and using the transferred knowledge to fit the output distribution of the large model to obtain performance and scenario / device adaptability similar to that of the large model.
[0012] In the second aspect, an embodiment of the present invention also provides a malicious code analysis system based on a large model mechanism, including: a receiving program module, used to receive binary files, intelligence texts or code segments uploaded by users, and perform feature extraction on the binary files, texts or code segments to obtain the functions, attributes, behaviors and entity features of the binary files, intelligence texts or code segments; a conversion program module, used to convert the obtained functions, attributes, behaviors and entity features into feature vectors respectively; an analysis program module, used to input the feature vectors into a full code gene analysis model, analyze the feature vectors according to the learned knowledge, and identify potential malicious codes; the full code gene analysis model is a large model obtained by training and learning the network security corpus and the full code library knowledge based on structured, semi-structured and unstructured network security data.
[0013] In a third aspect, an embodiment of the present invention provides an electronic device, comprising: one or more processors; a memory; one or more executable programs are stored in the memory, and the one or more processors read the executable program code stored in the memory to execute any of the malicious code analysis methods based on the large model mechanism described in the first aspect.
[0014] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to execute any of the malicious code analysis methods based on the large model mechanism described in the first aspect.
[0015] The malicious code analysis method, system, electronic device and storage medium based on the big model mechanism provided by the embodiment of the present invention are applied to the malicious code analysis scenario by training and learning the network security corpus and the full code library knowledge based on structured, semi-structured, semi-structured and unstructured network security data. Because it learns the characteristics and behavior patterns of malicious code from a large amount of network security data, and through the learning and analysis capabilities of the big model, it can efficiently identify potential malicious code. Therefore, efficient analysis of massive codes can be achieved, so as to facilitate the rapid identification of malicious code. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0017] Figure 1 This is a flow chart of a malicious code analysis method based on a large model mechanism according to an embodiment of the present invention; Figure 2 This is a flow chart of a malicious code analysis method based on a large model mechanism according to another embodiment of the present invention; Figure 3 This is a schematic block diagram of a program architecture of a malicious code analysis device based on a large model mechanism according to an embodiment of the present invention; Figure 4 The present invention is a schematic block diagram of a program architecture of an embodiment of an electronic device. DETAILED DESCRIPTION
[0018] The embodiments of the present invention are described in detail below with reference to the accompanying drawings.
[0019] It should be clear that the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0020] The malicious code analysis method based on the large model mechanism provided by the embodiment of the present invention is applicable to network threat analysis and network security protection scenarios in the process of industrial digitalization. It receives binary files, intelligence texts or code segments uploaded by users, extracts features, converts the extracted functions, attributes, behaviors and entity features into feature vectors, and then inputs them into the full code gene analysis model for analysis. The full code gene analysis model relies on a large model built based on network security data to identify potential malicious codes, which can efficiently analyze malicious code features and improve the efficiency and accuracy of malicious code detection.
[0021] It should be noted that the method can be solidified in a certain manufactured physical product in the form of software, and when the user uses the product, the method flow of the present application can be reproduced.
[0022] Figure 1 FIG. 1 is a flow chart of a malicious code analysis method based on a large model mechanism according to an embodiment of the present invention; Figure 1 As shown, the malicious code analysis method based on the large model mechanism includes the following steps: S110, receiving a binary file, intelligence text or code segment uploaded by a user, and performing feature extraction on the binary file, text or code segment to obtain the function, attribute, behavior and entity features of the binary file, intelligence text or code segment; In this step, the system's built-in feature extraction algorithm can be used to analyze these samples and extract key feature information including functions, attributes, behaviors and entity features. Among them, functional features can include: API call sequence, which is used to characterize the API functions called during the execution of the recorded program, such as network communication, file operations, registry access, etc.; functional code blocks, which are used to characterize and identify code fragments with specific functions, such as encryption and decryption, remote execution, privilege escalation and other functional operations; and algorithm identification, which is used to characterize and identify the encryption algorithm, hash algorithm and compression algorithm used, as well as the specific parameters and usage of the above algorithms.
[0023] The attribute features may include: file attributes, which are used to represent metadata information including file type, size, creation date, modification date, etc.; code structure, which is used to represent the structure and organization of the identified code segment, such as function call relationship, hierarchical structure of code blocks, etc.; and metadata, which is used to represent any information related to the binary file or code extracted from it, such as version number, author information, etc.
[0024] The behavioral characteristics may include: network behavior, which is used to analyze the network activities of the program, including communication with remote servers, data transmission patterns and communication protocols used; system call behavior, which is used to record system calls issued during program execution, such as file operations, process management and registry access; and abnormal behavior, which is used to characterize and identify behavioral patterns that are inconsistent with normal program behavior, such as potential vulnerability exploits, abnormal resource requests, etc.
[0025] The entity features may include: keywords and identifiers, which are used to characterize keywords, variable names, and function names used in the identification code; data structures, which are used to characterize data structure information extracted from the code, such as data tables, tree structures, and stacks, etc.; and comments and documents, which are any documents, comments, or tags extracted from the code or binary files, which may contain information about the purpose or implementation details of the code.
[0026] S120, converting the obtained functions, attributes, behaviors and entity features into feature vectors respectively; In this step, the system converts the various feature information extracted in S120 into feature vectors that are easy for the large model to understand and analyze. By converting into mathematical feature vectors, the subsequent large model can better understand and process these feature information, providing a basis for subsequent analysis and identification.
[0027] S130: Input the feature vector into a full code gene analysis model, analyze the feature vector based on the learned knowledge, and identify potential malicious code.
[0028] At present, the professional support capabilities of some large language models in network threat analysis and network security protection scenarios need to be improved, and the ability to analyze the entire code gene is still a shortcoming. Figure 2 Based on this, in this embodiment, it is necessary to design a large model suitable for full-code genetic analysis. For the existing large language models at home and abroad, the model algorithm iteration path is sorted out, the operation mechanism of the large language model is studied, and the working principles at the data level and method level are analyzed; the large language model architecture is analyzed, the composition of each layer and its connection method are mastered, and the performance influencing factors such as activation function and loss function are paid attention to. The model training process is studied, which runs through the main stages such as basic model pre-training, tuning and reasoning, analyzes the model performance and input and output, and explores the model optimization method. The full-code genetic analysis model provided is a large model obtained by knowledge training and learning of the network security corpus and the full code library constructed based on structured, semi-structured and unstructured network security data.
[0029] After the full-code genetic analysis model is pre-trained and learned, the converted feature vector is input into the pre-trained full-code genetic analysis model. The model uses the learned knowledge and algorithms to automatically and deeply analyze the input feature vector and accurately identify potential malicious code samples.
[0030] In order to help understand the technical solution and technical effects provided by this embodiment, an example is given as follows: Assume that a user uploads an unknown binary file, which may be an unknown malware sample.
[0031] After receiving the binary file, the network security system based on the above-mentioned full code genetic analysis model extracts its attributes, behaviors and entity features from it, such as file size, API calls used, and execution path of the code segment. Of course, other specific features may also be extracted, which are just to help understand. Then, the extracted features are converted into a mathematical feature vector to facilitate the analysis and understanding of the subsequent large model.
[0032] Next, the feature vector is input into a pre-trained full-code genetic analysis model. This model has been trained with a large amount of cybersecurity data such as cybersecurity corpora and code libraries, and has learned the differences and patterns between malicious code and normal code.
[0033] Through comparison and analysis, the full code genetic analysis model can identify whether the binary file contains potential malicious code. If the model finds that the input feature vector matches the known malicious code feature pattern, the file is marked as malicious and corresponding security measures can be taken, such as isolation, deletion, or sending it to network security analysts for further in-depth analysis.
[0034] The malicious code analysis method based on the big model mechanism provided by the embodiment of the present invention is applied to the malicious code analysis scenario by training and learning the network security corpus and the full code base knowledge based on structured, semi-structured, semi-structured and unstructured network security data. Because it learns the characteristics and behavior patterns of malicious code from a large amount of network security data, and through the learning and analysis capabilities of the big model, it can efficiently identify potential malicious code. Therefore, it can achieve efficient analysis of massive codes, thereby facilitating the rapid identification of malicious code.
[0035] As mentioned above, the formal execution of the malicious code analysis process in this embodiment needs to be carried out on the basis of the pre-trained full-code genetic analysis model. In view of the characteristics of network security data formats being heterogeneous, semantically diverse, and having strong data correlation, the embodiment of the present invention also proposes a technical solution for constructing a network security training corpus that is convenient for training and analyzing large models applied to malicious code analysis. Specifically, before performing malicious code analysis, the method also includes: building a network security corpus based on structured, semi-structured, and unstructured network security data, specifically: collecting multi-source heterogeneous malicious code knowledge data; wherein the malicious code knowledge data includes: malicious code structure, JSON file, network threat analysis report; for the structured data in the malicious code knowledge data, the structured data of different data sources are stored according to a unified format and rules; and, for the semi-structured data and unstructured data in the malicious code knowledge data, using named entity recognition technology to extract key feature information from the semi-structured data and unstructured data, the key feature information includes: hash value, malicious type, virus family; analyzing the association relationship between knowledge in the semi-structured data and unstructured data according to the key feature information, and extracting the association relationship between knowledge to form a standard malicious code knowledge expression data set; adding sample labels to the data in the data set to obtain the network security corpus; the sample labels include: malicious and trustworthy, and if it is malicious, the malicious type can also be marked, such as ransomware.
[0036] In this embodiment, malicious code structures, JSON files, and network threat analysis reports can be collected from public malicious code sample libraries, threat intelligence reports from security vendors, network security forums, and other channels. Structured data from different sources, such as malicious code structures, have clear formats and field definitions, and are easy to parse and process through specific rules. Store according to a unified format and rules, for example, organize information such as file attributes and function call relationships into a database table.
[0037] Use named entity recognition technology to extract key feature information such as hash values, malicious types, and virus families from semi-structured data such as JSON files and unstructured data such as network threat analysis reports.
[0038] By analyzing the correlation between the extracted key feature information, a standard malicious code knowledge expression dataset is established for subsequent model training and analysis. Finally, labels are added to each sample in the dataset, such as "malicious", "trusted", "ransomware" and other classification labels, thus forming a complete and labeled network security corpus, which can provide rich data resources for malware analysis research and provide technical support for the construction of a full code gene analysis support system.
[0039] In the field of network security, existing malicious code analysis faces challenges in terms of intelligence and consistency of training data, resulting in insufficient automatic and accurate identification and prevention of network threats. In order to improve the intelligence level of malicious code analysis, it is particularly important to build a comprehensive and consistent network security training full code library. Therefore, continue to refer to Figure 2 As shown, in some embodiments, before performing malicious code analysis, the method also includes: building a full code library for serving the full code genetic analysis model training; collecting code samples from multiple sources, the code samples including binary files, scripts and code resources; using disassembly technology to statically analyze the code samples, extract instruction sequences and program logic, and use dynamic sandbox tools to execute the code samples for dynamic analysis, and observe the behavior of the code samples and the impact on the system; analyzing the entry point instruction sequence of the code sample, performing standardized preprocessing on it, and obtaining a code sample file; reading the segment information, import and export functions, and string information of the code sample file, and extracting key data; dividing the code into blocks according to the function, attribute, behavior or entity characteristics of the code segment; associating and mapping the code blocks with the corresponding functions, attributes, behaviors or entity characteristics, assigning feature labels to each code block, identifying the functions, attributes, behaviors or entity characteristics of each code block, and forming a full code library for serving the full code genetic analysis model training.
[0040] In this embodiment, through the above steps, a full-code training data set (full-code library) for network threat analysis is created. The full-code training data set can provide rich malicious code data and necessary technical support for the training of the full-code genetic analysis model and malware analysis research.
[0041] Continue to view Figure 2 As shown, after constructing the network security training corpus and the full code library, a network security analysis knowledge graph is formed, that is, a database for malicious code analysis. Specifically, after constructing the full code library and the full code library used for the full code gene analysis model training, the method also includes: preprocessing the obtained network security corpus and full code data, including data cleaning, standardization and denoising operations to ensure data consistency; using natural language processing technology and network security domain knowledge to label the network security corpus and full code data, giving semantic labels to different types of structural data, and identifying their types, functions, attributes, behaviors and entity characteristics; classifying, associating, integrating and organizing the labeled data according to type, function, attribute, behavior and entity characteristics to construct a network security analysis knowledge graph.
[0042] In this embodiment, the use of natural language processing technology and network security domain knowledge to label the network security corpus and full code data and assign semantic labels to different types of structured data includes: word segmentation, part-of-speech tagging and / or entity recognition of the text; using a predefined network security domain knowledge base (which can be the aforementioned network security training corpus) to identify and extract network security-related key terms, phrases and entities in the text, including: malware types, attack vectors, abnormal behavior patterns, etc., to assign structured labels to the data, such as file A, transmission, file size, access, IP address or domain name.
[0043] After labeling, the labeled data is classified, associated, integrated and organized according to type, function, attribute, behavior and entity characteristics, including: classifying the labeled data according to its attributes, functions and behavior characteristics. For example, all malware-related data are classified into corresponding malware categories; establishing relationships and connections between data, for example, connecting different data points through common entities such as IP addresses and attack types to form a relationship graph. Finally, the classified and associated data are integrated into a unified knowledge graph. In this way, it is convenient to query, call and analyze according to different dimensions and relationships during the model training process.
[0044] At present, large models are widely used in multiple network security fields such as alarm, log analysis, vulnerability detection, etc., but have not yet been effectively implemented in the field of malicious code analysis. In response to this problem, in an embodiment of the present invention, a large model training scheme based on pre-training and supervised fine-tuning is proposed. Based on the network security analysis knowledge graph obtained above that integrates multimodal data corpora such as source code text, code structure, threat intelligence, etc., a large model in the field of network security full code analysis is trained; a supervised fine-tuning strategy is formulated, and target task annotated data is used to fine-tune the model in field tasks such as code malice determination, behavior analysis, function analysis, and dialogue generation, and the parameters are further optimized to adapt it to the requirements of specific analysis tasks.
[0045] Specifically, before performing malicious code analysis, the method also includes: obtaining a full code gene analysis model based on the knowledge learning training of the constructed network security corpus and the full code library; specifically: selecting a multilingual pre-trained model as the architecture of the full code gene analysis model; wherein the multilingual pre-trained model can be bloomz-7b1-mt; the multilingual pre-trained model is trained to perform multiple natural language multi-processing tasks; obtaining the network security corpus and inputting it into the multilingual pre-trained model for code structure understanding and expression training, so that the multilingual pre-trained model can understand the structure of the code and express it; inputting the full code library into the multilingual pre-trained model, and performing multi-task training based on the code blocks in the full code library; the multi-tasks include: code malice detection classification, behavior analysis, function analysis and dialogue generation; wherein the code blocks are labeled data carrying feature labels; using the labeled data corresponding to the target task to perform hyperparameter fine-tuning on the multilingual pre-trained model, and monitoring the performance of the model on the validation set until the performance on each task meets the expected training goals.
[0046] Among them, the hyperparameters include: learning rate, batch size of training samples, regularization parameters, and number of training iterations.
[0047] To ensure convergence and stability during fine-tuning, in some embodiments, the training data is distributed and trained in parallel on multiple computing nodes, or the multilingual pre-trained model is divided into multiple models that perform different task training, and corresponding task type training is performed on each split model.
[0048] In this embodiment, the distributed training strategy is fully utilized to introduce the big model technology into the field of malicious code analysis, and the big model training for full code genetic analysis is realized, laying a technical foundation for realizing the big model for full code genetic analysis in the field of network security.
[0049] Please see Figure 2 In some embodiments, after the full-code gene analysis model is obtained through training, in order to reduce storage resources, it also includes: using the model compression technology to reduce the model size of the full-code gene analysis model to obtain a small model. The small model here refers to the original size of the full-code gene analysis model obtained through training. Of course, the large model and small model in this article also have clear meanings in the field of deep learning. Compared with the large model, the small model has fewer parameters, a shallower number of layers, is lightweight, efficient, and easy to deploy to form a network security analysis system.
[0050] Specifically, the method also includes: extracting the knowledge contained in the trained large model into the small model through knowledge distillation, and transferring the learned knowledge to the small model; using the transferred knowledge to fit the output distribution of the large model to obtain performance and scenario / device adaptability similar to the large model.
[0051] It is understandable that in offline deployment application scenarios, compression technology for full-code genetic analysis models becomes crucial. In the embodiments of the present invention, quantization and knowledge distillation technologies are used to reduce the number of model parameters by converting floating-point matrices into integer matrices, so that they can be efficiently processed on hardware with limited resources, thereby reducing the difficulty of model deployment, reducing model size and computational complexity, while maintaining high accuracy and improving reasoning performance.
[0052] Specifically, in this embodiment, it can be implemented by full quantization and partial quantization. Full quantization converts model parameters into integer form, thereby greatly reducing the number of parameters; while partial quantization compresses while keeping some parameters as floating point numbers. This compression method makes the model more suitable for running in a resource-constrained environment, improving the efficiency and performance of the model.
[0053] On the other hand, knowledge distillation is used to transfer the knowledge contained in the trained large model to the small model, so that the small model can fit the output distribution of the large model. In this way, while maintaining a small number of parameters and computational complexity, similar performance to the large model can be obtained, and it is more adaptable to different scenarios and devices.
[0054] By applying offline full-code genetic analysis model compression technology, an efficient and accurate malicious code analysis system can be deployed in a resource-constrained environment, improving the level of security protection and strengthening the ability to respond to network threats, which helps to improve the overall network security level.
[0055] Finally, based on the malicious code analysis method based on the large model mechanism provided by the embodiment of the present invention, a security analysis expert wingman prototype system can be developed to make full use of the above technical solution to provide network security experts with a comprehensive security analysis auxiliary tool through in-depth analysis of multimodal input data. Based on the feature extraction module, input data such as code segments, binary files, and intelligence texts are preprocessed to capture and extract corresponding functions, attributes, behaviors, or entity features; then, the built-in, offline deployed full-code gene analysis large model is used to comprehensively analyze the extracted features to achieve malicious judgment of the input samples and analyze the functions and behaviors of the samples; finally, the network security knowledge graph can be used to associate and integrate data and domain knowledge, comprehensively retrieve the associated knowledge of the input data, and give a comprehensive judgment conclusion on the input data. The system based on the application of this solution can achieve effective analysis of the full code gene. Embodiment 2
[0056] Figure 3 This is a schematic block diagram of the malicious code analysis system architecture based on the large model mechanism according to an embodiment of the present invention. Figure 3 As shown, based on the same technical concept as the embodiments in the aforementioned embodiment 1, a malicious code analysis system based on a large model mechanism is also provided, including: The receiving program module 210 is used to receive a binary file, intelligence text or code segment uploaded by a user, and perform feature extraction on the binary file, text or code segment to obtain the function, attribute, behavior and entity features of the binary file, intelligence text or code segment; A conversion program module 220, used to convert the obtained functions, attributes, behaviors and entity features into feature vectors respectively; The analysis program module 230 is used to input the feature vector into the full code genetic analysis model, analyze the feature vector according to the learned knowledge, and identify potential malicious code; the full code genetic analysis model is a large model obtained through knowledge training and learning of a network security corpus and a full code library constructed based on structured, semi-structured, and unstructured network security data.
[0057] The system of this embodiment can be used to perform Figure 1 The technical solution of the method embodiment shown has similar implementation principles and technical effects to those of the first embodiment, which will not be described in detail here and can be referenced by each other.
[0058] In addition, it is understandable that Figure 3 The system shown is also applicable to the execution step processes of other embodiments in Example 1. For details, please refer to the method-related description in Example 1, which will not be repeated here.
[0059] The malicious code analysis system based on the big model mechanism provided by the embodiment of the present invention obtains a big model through knowledge training and learning of a network security corpus and a full code library constructed based on structured, semi-structured and unstructured network security data, and is applied to the analysis of malicious code in the field of network security. Since the network security corpus and the full code library including a large number of network security terms and data are learned, the model can understand the code comprehensively and from multiple angles, thereby efficiently analyzing massive amounts of code, thereby facilitating the rapid identification of malicious code.
[0060] The present invention also provides an electronic device according to an embodiment, comprising: one or more processors; a memory; one or more executable programs are stored in the memory, and the one or more processors read the executable program code stored in the memory to execute the malicious code analysis method based on the large model mechanism described in any one of the first embodiments.
[0061] Figure 4 FIG. 1 is a schematic diagram of the architecture of an electronic device according to an embodiment of the present invention, which can implement any method described in Embodiment 1 of the present invention, such as Figure 4 As shown, as an optional embodiment, the above-mentioned electronic device may include: a shell 41, a processor 42, a memory 43, a circuit board 44 and a power supply circuit 45, wherein the circuit board 44 is arranged inside the space enclosed by the shell 41, and the processor 42 and the memory 43 are arranged on the circuit board 44; the power supply circuit 45 is used to supply power to various circuits or devices of the above-mentioned electronic device; the memory 43 is used to store executable program code; the processor 42 reads the executable program code stored in the memory 43 to execute the aforementioned malicious code analysis method based on the large model mechanism described in any of the first embodiments.
[0062] The specific execution process of the processor 42 for the above steps and the steps further executed by the processor 42 by running the executable program code can be found in the description of the first embodiment of the malicious code analysis method based on the large model mechanism of the present invention, which will not be repeated here.
[0063] The electronic device exists in various forms, including but not limited to: (1) Mobile communication devices: These devices are characterized by having mobile communication functions and are mainly aimed at providing voice and data communications. Such terminals include: smart phones, multimedia phones, functional phones, and low-end phones. (2) Ultra-mobile personal computer devices: These devices belong to the category of personal computers, have computing and processing functions, and generally also have mobile Internet access features. Such terminals include: PDA, MID and UMPC devices, such as iPad. (3) Portable entertainment devices: These devices can display and play multimedia content. Such devices include: audio and video playback modules (such as iPod), handheld game consoles, e-books, as well as smart toys and portable car navigation devices. (4) Servers: Devices that provide computing services. The server's composition includes processors, hard disks, memory, system buses, etc. The server is similar to the general computer architecture, but because it needs to provide highly reliable services, it has higher requirements in terms of processing power, stability, reliability, security, scalability, manageability, etc. (5) Other electronic devices with data interaction functions.
[0064] The present invention also provides a computer-readable storage medium in an embodiment, wherein the computer-readable storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the malicious code analysis method based on the large model mechanism as described in any of the above-mentioned embodiments.
[0065] In summary, according to the above-mentioned embodiments, the malicious code analysis method and system based on the large model mechanism disclosed in the embodiments of the present invention, the large model obtained by knowledge training and learning of the network security corpus and the full code library constructed based on structured, semi-structured and unstructured network security data, is applied to the analysis of malicious code in the field of network security. Since the network security corpus and the full code library including a large number of network security terms and data are learned, the model can understand the code comprehensively and from multiple angles, and can perform efficient analysis on massive codes, thereby facilitating the rapid identification of malicious code.
[0066] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0067] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referenced to each other, and each embodiment focuses on the differences from other embodiments.
[0068] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. The storage medium can also be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.
[0069] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed by the present invention should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
Claims
1. A malicious code analysis method based on a large model mechanism, characterized in that: include: Receive binary files, intelligence texts or code segments uploaded by users, and perform feature extraction on the binary files, texts or code segments to obtain functions, attributes, behaviors and entity features of the binary files, intelligence texts or code segments; Convert the obtained functions, attributes, behaviors and entity features into feature vectors respectively; Inputting the feature vector into a full code gene analysis model, analyzing the feature vector based on the learned knowledge, and identifying potential malicious code; The full-code gene analysis model is a large model obtained through knowledge training and learning of a network security corpus and a full-code library constructed based on structured, semi-structured, and unstructured network security data.
2. The malicious code analysis method based on the large model mechanism according to claim 1 is characterized in that: Before performing malicious code analysis, the method further includes: constructing a network security corpus based on structured, semi-structured, and unstructured network security data, specifically: Collecting multi-source heterogeneous malicious code knowledge data; wherein the malicious code knowledge data includes: malicious code structure, JSON file, network threat analysis report; For the structured data in the malicious code knowledge data, the structured data from different data sources are stored according to a unified format and rules; And, for the semi-structured data and unstructured data in the malicious code knowledge data, using named entity recognition technology to extract key feature information from the semi-structured data and unstructured data, the key feature information includes: hash value, malicious type, virus family; Analyzing the association relationship between knowledge in the semi-structured data and the unstructured data according to the key feature information, and extracting the association relationship between the knowledge to form a standard malicious code knowledge expression data set; Sample labels are added to the data in the data set to obtain the network security corpus; the sample labels include: malicious and credible.
3. The malicious code analysis method based on the large model mechanism according to claim 2 is characterized in that: Before performing malicious code analysis, the method further includes: constructing a full code library for use in full code genetic analysis model training; Collecting code samples from multiple sources, the code samples including binaries, scripts, and code resources; Using disassembly technology to perform static analysis on the code sample to extract instruction sequences and program logic, and using a dynamic sandbox tool to execute the code sample for dynamic analysis to observe the behavior of the code sample and its impact on the system; Analyzing the entry point instruction sequence of the code sample, performing standardization preprocessing on the sequence, and obtaining a code sample file; Read the section information, import and export functions, and string information of the code sample file to extract key data; Divide the code into blocks according to its function, attribute, behavior or entity characteristics; The code blocks are associated and mapped with the corresponding functions, attributes, behaviors or entity features, and feature labels are assigned to each code block to identify the functions, attributes, behaviors or entity features of each code block, thus forming a full code library for training full-code genetic analysis models.
4. The malicious code analysis method based on the large model mechanism according to claim 3 is characterized in that: After constructing the full code library and full code library used in the training of the full code genetic analysis model, the method further includes: preprocessing the obtained network security corpus and full code data, including data cleaning, standardization and denoising operations to ensure data consistency; Using natural language processing technology and cybersecurity domain knowledge, we label cybersecurity corpus and full code data, assign semantic labels to different types of structured data, and identify their types, functions, attributes, behaviors, and entity features; The labeled data is classified, associated, integrated and organized according to type, function, attribute, behavior and entity characteristics to construct a network security analysis knowledge graph.
5. The malicious code analysis method based on the large model mechanism according to claim 4 is characterized in that: Before performing malicious code analysis, the method further includes: obtaining a full code gene analysis model based on knowledge learning and training of the constructed network security corpus and the full code library; specifically: A multilingual pre-trained model is selected as the architecture of the full-code gene analysis model; the multilingual pre-trained model is trained to perform multiple natural language multi-processing tasks; Obtaining the network security corpus and inputting it into the multilingual pre-trained model for code structure understanding and expression training, so that the multilingual pre-trained model can understand the structure of the code and express it; The full code base is input into the multi-language pre-training model, and multi-task training is performed based on the code blocks in the full code base; the multi-tasks include: code maliciousness detection classification, behavior analysis, function analysis and dialogue generation; wherein the code blocks are annotated data carrying feature labels; Use the labeled data corresponding to the target task to fine-tune the hyperparameters of the multilingual pre-trained model, and monitor the performance of the model on the validation set until the performance on each task meets the expected training goals.
6. The malicious code analysis method based on the large model mechanism according to claim 4 is characterized in that: During the training process, the method further comprises: The training data is distributed and trained in parallel on multiple computing nodes, or the multi-language pre-trained model is divided into multiple models for performing different task trainings, and corresponding task type training is performed on each split model.
7. The malicious code analysis method based on the large model mechanism according to claim 5 or 6 is characterized in that: After the full-code gene analysis model is obtained through training, the method further includes: extracting the knowledge contained in the trained large model into a small model through knowledge distillation, and transferring the learned knowledge to the small model; The transferred knowledge is used to fit the output distribution of the large model to obtain similar performance and scene / device adaptability as the large model.
8. A malicious code analysis system based on a large model mechanism, characterized in that: include: A receiving program module is used to receive a binary file, intelligence text or code segment uploaded by a user, and perform feature extraction on the binary file, text or code segment to obtain the function, attribute, behavior and entity features of the binary file, intelligence text or code segment; A conversion program module, used for converting the obtained functions, attributes, behaviors and entity features into feature vectors respectively; An analysis program module, used to input the feature vector into a full code gene analysis model, analyze the feature vector based on the learned knowledge, and identify potential malicious code; The full-code gene analysis model is a large model obtained through knowledge training and learning of a network security corpus and a full-code library constructed based on structured, semi-structured, and unstructured network security data.
9. An electronic device, characterized in that: include: One or more processors; Memory; One or more executable programs are stored in the memory, and the one or more processors read the executable program code stored in the memory to execute the malicious code analysis method based on the large model mechanism described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to execute the malicious code analysis method based on the large model mechanism described in any one of claims 1 to 7.
Citation Information
Cited By
Binary program analysis method and device, electronic equipment and storage medium
CN121722436A
