Malicious code identification method and device

By encoded byte embedding and encoding the detected objects on the client, generating byte embedding vectors and sending them to the cloud to identify, the problems of malicious code detection are solved, and rapid defense and data security are achieved.

CN118410486BActive Publication Date: 2024-11-05BEIJING ANTIY NETWORK SAFETY TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410873996.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-02
Publication Date
2024-11-05
Estimated Expiration
2044-07-02

AI Technical Summary

Technical Problem

In the prior art, the hash value during malicious code detection is sensitive and vulnerable to the attacker, resulting in low detection efficiency, and the sample sharing mechanism involves user data transmission, which poses privacy and security risks.

Method used

Byte embedding encoding of the detection object to be detected on the client, generate byte embedding vectors and send them to the cloud for malicious identification. Use pre-trained byte embedding models to convert data features, reduce the risk of data transmission and privacy leakage, and improve detection efficiency.

Benefits of technology

Transmission through byte embedding vectors reduces the amount of data transmission and privacy leakage risks, improves the rapid defense capabilities of malware, and enhances data security.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118410486B_ABST
    Figure CN118410486B_ABST
Patent Text Reader

Abstract

The present invention discloses a malicious code identification method and device, belonging to the field of network security technology. The method includes: obtaining binary raw data of an object to be detected in a client; the object to be detected includes at least static files and / or dynamic behaviors; inputting the binary raw data into a pre-trained byte embedding model, and obtaining the byte embedding vector output by the byte embedding model after byte encoding embedding of the binary raw data; sending the byte embedding vector to the cloud, so that the cloud can identify the maliciousness of the byte embedding vector, and receive the maliciousness identification result fed back by the cloud. The present invention not only reduces the amount of data transmission, but also makes it difficult to infer the original data content from the transmitted byte embedding vector, thereby reducing the risk of user privacy being leaked and improving data security.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of network security technology, and in particular to a malicious code identification method and device. Background Art

[0002] As users have higher and higher requirements for the timeliness of malicious code detection, detection is currently performed collaboratively by the client and the cloud. In traditional solutions, when the client identifies malicious code, it calculates the file hash value through a hash algorithm and sends the hash value to the cloud, which queries the hash value to determine whether it is malicious code. However, hash values ​​are very sensitive, and slight changes in files can result in huge differences in hash values. Attackers generate variants by making slight modifications to malicious code, thereby avoiding detection based on hash values.

[0003] In related technologies, the above problems are solved through a sample sharing mechanism. The cloud receives suspicious sample entities collected locally by multiple clients, analyzes the suspicious sample entities, and updates the detection rules. However, the sharing mechanism involves sending user data to the cloud, which can easily cause problems with user privacy and data security. Summary of the invention

[0004] The present invention provides a malicious code identification method and device, which can solve the problems existing in the related technology. The technical solution is as follows:

[0005] On the one hand, a method for identifying malicious code is provided, the method comprising:

[0006] Obtaining binary raw data of an object to be detected in a client; the object to be detected includes at least static files and / or dynamic behaviors;

[0007] Inputting the binary original data into a pre-trained byte embedding model, and obtaining a byte embedding vector output by the byte embedding model after byte encoding embedding of the binary original data;

[0008] The byte embedding vector is sent to the cloud so that the cloud performs malicious identification on the byte embedding vector, and the malicious identification result fed back by the cloud is received.

[0009] On the other hand, a malicious code identification device is provided, the device comprising:

[0010] A data acquisition unit, used to acquire binary raw data of an object to be detected in a client; the object to be detected includes at least static files and / or dynamic behaviors;

[0011] A vector acquisition unit, used for inputting the binary original data into a pre-trained byte embedding model, and acquiring a byte embedding vector output by the byte embedding model after byte encoding embedding of the binary original data;

[0012] The communication unit is used to send the byte embedding vector to the cloud so that the cloud can identify the maliciousness of the byte embedding vector and receive the maliciousness identification result fed back by the cloud.

[0013] On the other hand, a computer device is provided, which includes a memory and a processor, wherein the memory is used to store a computer program, and the processor is used to execute the computer program stored in the memory to implement the steps of the malicious code identification method described above.

[0014] On the other hand, a computer-readable storage medium is provided, wherein a computer program is stored in the storage medium, and when the computer program is executed by a processor, the steps of the malicious code identification method described above are implemented.

[0015] On the other hand, a computer program product is provided, including a computer program, wherein when the computer program is executed by a processor, the steps of the malicious code identification method described above are implemented.

[0016] The technical solution provided by the present invention can at least bring the following beneficial effects: by embedding the binary original into byte encoding, and sending the obtained byte embedding vector to the cloud for malicious identification, this solution adopts vector transmission compared to directly transmitting entity data, which not only reduces the data transmission volume, but also makes it difficult to infer the original data content from the transmitted byte embedding vector, thereby reducing the risk of user privacy leakage and improving data security. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0018] Figure 1 This is a flow chart of a malicious code identification method provided by an embodiment of the present invention;

[0019] Figure 2 is a schematic diagram of a joint training method provided by an embodiment of the present invention;

[0020] Figure 3 It is a structural diagram of a malicious code identification device provided by an embodiment of the present invention;

[0021] Figure 4 It is a hardware architecture diagram of a computer device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0022] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.

[0023] As mentioned above, the sample sharing mechanism is that the cloud receives suspicious sample entities collected locally by multiple clients, analyzes the suspicious sample entities, and updates the detection rules. However, the whole process takes a long time, which means that there may be a time difference between the emergence of new malware and its effective detection and defense; and the sharing mechanism involves sending user data to the cloud, which is prone to user privacy and data security issues.

[0024] Based on this, the inventive concept of the present invention is to convert the data of the object to be detected into vector features on the client, and directly perform malicious identification and feedback on the cloud, which can not only improve data security but also quickly defend against new malware.

[0025] The specific implementation of the above concept is described below.

[0026] Please refer to Figure 1 , an embodiment of the present invention provides a malicious code identification method, the method comprising:

[0027] Step 100, obtaining binary raw data of an object to be detected in a client; the object to be detected includes at least static files and / or dynamic behaviors;

[0028] Step 102, inputting the binary original data into a pre-trained byte embedding model, and obtaining a byte embedding vector output by the byte embedding model after byte encoding embedding of the binary original data;

[0029] Step 104: Send the byte embedding vector to the cloud, so that the cloud can identify the maliciousness of the byte embedding vector, and receive the maliciousness identification result fed back by the cloud.

[0030] In the embodiment of the present invention, the binary original is byte-encoded and embedded, and the obtained byte embedding vector is sent to the cloud for malicious identification. Compared with directly transmitting entity data in the form of vectors, this solution not only reduces the data transmission volume, but also makes it difficult to infer the original data content from the transmitted byte embedding vector, thereby reducing the risk of user privacy leakage and improving data security. Furthermore, the malicious identification results are directly fed back by the cloud, so that new malware can be quickly defended.

[0031] Described below Figure 1 How the various steps are performed.

[0032] First, with respect to step 100, the binary original data of the object to be detected in the client is obtained.

[0033] In the embodiment of the present invention, in order to identify the malicious code in the client, it is necessary to determine the object to be detected. If the client is attacked by malware, there are static files of the malware and dynamic behaviors of the malware in the client. Therefore, the object to be detected in the embodiment of the present invention at least includes static files and / or dynamic behaviors.

[0034] In one implementation, the object to be detected can be determined by responding to the detection task initiated by the client. For example, if the detection task is client scanning, the object to be detected is all static files in the client and dynamic behaviors in the client; for another example, if the detection task is local scanning, the object to be detected is the static files on the specified disk in the client; for another example, if malicious identification is performed on a certain software, the object to be detected is the static files and dynamic behaviors related to the software.

[0035] In the embodiment of the present invention, after determining the object to be detected, it is necessary to obtain binary raw data of the object to be detected, specifically:

[0036] When the object to be detected is a static file, traverse the static files to be detected, pre-process each traversed static file, and obtain binary original data of each static file; the pre-processing at least includes unpacking and / or decompression; and / or,

[0037] When the object to be detected is a dynamic behavior, the monitored dynamic behavior is described in a standardized manner to obtain binary original data related to the standardized description; the binary original data related to the standardized description includes at least one of the following: a parameter sequence of the dynamic behavior, data sent by the dynamic behavior indication, and data received by the dynamic behavior indication.

[0038] Static files can be files of different formats. If the static file has a shell, it needs to be unpacked to obtain the binary original data after unpacking; if the static file is a compressed file, it needs to be decompressed to obtain the binary original data of the decompressed static file.

[0039] Dynamic behaviors include process behaviors, API call sequences, network activities, etc. In order to identify the maliciousness of dynamic behaviors, it is first necessary to standardize the description of dynamic behaviors and then obtain the binary raw data related to the standardized description. The standardized description method may include at least one of the following: determining the parameter sequence of dynamic behaviors; determining whether the dynamic behavior indicates sending data, and if so, obtaining the data that the dynamic behavior indicates sending; determining whether the dynamic behavior indicates receiving data, and if so, obtaining the data that the dynamic behavior indicates receiving. In this way, the binary raw data related to the standardized description can be obtained, namely: at least one of the following: the parameter sequence of dynamic behaviors, the data that the dynamic behavior indicates sending, and the data that the dynamic behavior indicates receiving.

[0040] In the embodiment of the present invention, the binary original data of the object to be detected is directly obtained instead of performing feature extraction on the object to be detected according to feature extraction rules. This is because the amount of extracted feature data is small, and there is a possibility that attackers modify malicious codes to avoid feature extraction, making the extracted features unable to detect maliciousness.

[0041] Then, for step 102, the binary original data is input into a pre-trained byte embedding model, and a byte embedding vector output by the byte embedding model after byte encoding embedding of the binary original data is obtained.

[0042] In order to reduce the risk of user privacy data being leaked and reduce the amount of data sent to the cloud, the binary raw data can be byte-embedded to vectorize the binary raw data. In an embodiment of the present invention, the binary raw data is byte-embedded by pre-training a byte embedding model.

[0043] In the embodiment of the present invention, the byte embedding model can be implemented in at least the following three ways:

[0044] Method 1: The byte embedding model of the client is the first LLM model, and the cloud uses the second LLM model to implement malicious identification. The first LLM model and the second LLM model have the same model structure and are trained using a joint training method.

[0045] Method 2: The client's byte embedding model is trained through unsupervised learning training.

[0046] Method 3: The client's byte embedding model is trained using the contextual word vector representation training method.

[0047] The above three methods are explained below.

[0048] In method 1, please refer to Figure 2 , is a schematic diagram of the training method of the first LLM model and the second LLM model, where LLM is a large-scale language model. Model parameters exist in both the first LLM model and the second LLM model. In order to output a suitable byte embedding vector for binary raw data, so that the cloud can accurately identify the maliciousness of the byte embedding vector, the first LLM model and the second LLM model can have the same model structure and be trained by a joint training method.

[0049] Specifically, the joint training method may include:

[0050] Acquire multiple samples; the samples include: sample binary raw data and malicious identification results thereof;

[0051] For each sample, the following steps are performed: using the sample binary original data and the first prompt word in the sample as the input of the first LLM model, the first prompt word is used to instruct the first LLM model to perform byte encoding embedding on the sample binary original data, and obtaining the sample byte embedding vector output by the first LLM model; using the sample byte embedding vector and the second prompt word as the input of the second LLM model, the second prompt word is used to instruct the second LLM model to perform maliciousness identification on the sample byte embedding vector, and using the maliciousness identification result of the sample as the output of the second LLM model; and using the output result of the second LLM model to back-propagate the second model parameters in the second LLM model and the first model parameters in the first LLM model.

[0052] Since the model structures of the two LLM models are the same, it means that the first LLM model on the client and the second LLM model on the cloud have the same potential to complete the full functionality. Moreover, the two LLM models are jointly trained, so when the client performs byte embedding on the binary raw data, it can reduce the dependence on cloud computing resources and enhance the effectiveness of the byte embedding vector. In this way, when there are no detection rules for new malware, the combination of the two models can accurately identify the maliciousness of the new malware. Furthermore, using the same model structure can simplify the workload of development and maintenance. Developers only need to maintain one model architecture on the client and the cloud, which has lower development and maintenance costs than using different model structures on different platforms.

[0053] In one embodiment of the present invention, when the maliciousness identification result is malicious, in order to enable the client to defend against the maliciousness, the maliciousness identification result may also include malicious code families and core behaviors. In this way, during the training of the LLM model, the sample used also needs to determine the malicious code family and core behavior of the sample, and the maliciousness identification result, malicious code family and core behavior of the sample are used together as the output of the second LLM model to train the LLM model.

[0054] In the second method, Word2Vec and GloVe can be used to perform unsupervised learning training on the byte embedding model. During the training process, the model continuously adjusts the output byte embedding vector to optimize the current byte prediction of the continuous bag of byte (CBOW) or the context prediction of the byte sequence skip-gram model. In this way, the byte embedding vector can eventually capture the relationship between bytes, thereby improving the feature representation of the byte embedding vector for binary raw data.

[0055] In the third method, the training method of contextual word vector representation can be used. The vector representation of each byte in the binary raw data depends not only on the byte itself, but also on the context of the byte in the binary raw data. Therefore, the self-attention mechanism can be used to train the byte embedding model.

[0056] In the above-mentioned method 2 and method 3, the cloud can also use the inference model to perform malicious inference on the byte embedding vectors output in the two methods, or use other methods to identify maliciousness. However, since the byte embedding vectors output in methods 2 and 3 have a certain relationship with the input sample space, the training process of the byte embedding vectors on the client side is independent of the training process of the inference model on the cloud side, and cannot be jointly trained. The byte embedding vectors output by the client side are only used as samples to train the inference model on the cloud side separately.

[0057] Regardless of which of the above methods is used, since the byte embedding models have their own training sizes during the training process, that is, there are training size requirements for the input binary original data, therefore, before the binary original data is input into the pre-trained byte embedding model, it can also include: when the binary original data exceeds the training size of the byte embedding model, determining the format of the binary original data, for the binary original data in the format of an executable file, determining the characteristic area of ​​the executable file, and treating the binary original data of each characteristic area as separately fragmented binary original data, and splitting the binary original data of the non-feature area according to the training size to obtain multiple fragments of binary original data; for binary original data in other formats, splitting according to the training size to obtain multiple fragments of binary original data.

[0058] Since the executable file includes feature areas such as section tables, entry points, import tables, and export tables, each of which has its own characteristics, if these feature areas are split, the accuracy of malicious identification results will be affected. Therefore, the binary raw data of each feature area can be separately fragmented, and the binary raw data of other non-feature areas and binary raw data in other formats can be split according to the training size.

[0059] Furthermore, the model structure of the byte embedding model in the embodiment of the present invention does not include a word segmentation structure, and the binary original data is not subjected to word segmentation processing during the byte encoding embedding process of the binary original data. This is because:

[0060] i. If a tokenizer structure is added to the byte embedding model, the tokenizer structure is generally used to tokenize text. When tokenizing binary raw data that is not text data, the non-text data must first be converted into a format that the model can understand. This conversion process will cause the loss of key information in the binary raw data, because not all binary content can find a corresponding, meaningful text representation in the vocabulary. Due to the limitations of UTF-8 encoding and vocabulary, encoding binary raw data will lead to the loss of key information, which in turn affects the detection accuracy; and encoding binary raw data using UTF-8 encoding will also affect detection efficiency.

[0061] ii. During text conversion, if a byte (or byte sequence) that does not exist in the vocabulary is encountered, these bytes may be marked as unknown (UNK, i.e. unknown token), resulting in the loss of binary information. This information loss has limited impact on language understanding, but in malicious identification analysis, each byte may carry key information about program behavior, making information loss a serious problem.

[0062] In summary, in the embodiment of the present invention, the model structure of the byte embedding model does not include a word segmentor structure, and the binary original data for byte encoding embedding is original data that has not been processed by word segmentation. The original data is byte embedded to obtain a byte embedding vector, so that the byte embedding vector carries rich binary information, which is more conducive to malicious identification in the cloud.

[0063] Furthermore, when the cloud also uses a model for malicious identification, the client-side model and the cloud-side model can be paired and optimized in terms of model size. The model size is the number of parameters in the model. In one implementation, when training the client and cloud models, a small client model, a large cloud model, or a large cloud model, a small client model training mode can be selected. By choosing different model size pairings, it is possible to adapt to a wide client resource environment (the cloud can accommodate more clients to access simultaneously) or a compact client resource environment (low client resource usage) without affecting accuracy.

[0064] When a small-size model is selected on the client, since the model contains fewer parameters, it is suitable for running on resource-constrained devices, and can process data quickly and quickly obtain malicious identification results fed back from the cloud.

[0065] When a large-size model is used on the client side, a larger-size and more precise byte embedding vector can be produced. When a small-size model is used on the cloud side, the inference of malicious identification results can be accurately realized.

[0066] Finally, with respect to step 104, the byte embedding vector is sent to the cloud, so that the cloud performs malicious identification on the byte embedding vector, and the malicious identification result fed back by the cloud is received.

[0067] In the embodiment of the present invention, after receiving the byte embedding vector, the cloud needs to identify the maliciousness of the byte embedding vector.

[0068] If the client side adopts the first LLM model in method one as the byte embedding model, the cloud side adopts the second LLM model to identify the maliciousness of the byte embedding vector. Specifically, the byte embedding vector submitted by the client is input into the second LLM model, and the maliciousness identification result output by the second LLM model is obtained. The maliciousness identification result includes whether it is malicious. When it is determined to be malicious, the maliciousness identification result can also include malicious code families and core behaviors. In this way, not only can the client be fed back whether it is malicious, but also the malicious code family and core behaviors when it is malicious, thereby providing strategic support for the client's defense against malicious code.

[0069] If the client side adopts the model of method 1 or method 2 as the byte embedding model, then in addition to using the model for malicious identification, the cloud side may also be provided with a vector database, wherein the vector database includes a plurality of known vectors and malicious code families and core behaviors corresponding to the plurality of known vectors one by one;

[0070] Then, the method of malicious identification in the cloud can be: calculate the similarity between the byte embedding vector and the known vectors stored in the vector database respectively. When the similarity with the target known vector exceeds the set threshold, the byte embedding vector is determined to be malicious, and the malicious code family and core behavior of the target known vector are fed back as the malicious identification result.

[0071] Since the cloud can obtain byte embedding vectors uploaded by multiple clients, it can obtain the byte embedding vectors corresponding to new malware in a timely manner, and then update the vector database in a timely manner. By calculating the similarity between the byte embedding vectors submitted by the client and the known vectors in the vector database, machine learning and natural language processing are used to identify and associate patterns of malicious behavior. The advantage of this method is that it can find known vectors that are not only directly similar, but also similar in behavior, intention or characteristics based on the learned data representation (i.e., byte embedding vectors). Based on this method, attacks from the same attacker or using the same technology can be identified and associated, so as to understand the attacker's behavior pattern and provide strategic support for subsequent defense. The vector database uses special data structures and algorithms to handle similarity calculations and queries between vectors. The vector database uses a variety of retrieval algorithms to accelerate vector similarity searches, such as KD-Tree, VP-Tree, LSH, and inverted indexes.

[0072] After the client receives the malicious identification result fed back by the cloud, if the malicious identification result is confirmed to be malicious, the user can be prompted to execute the disposal logic.

[0073] Please refer to Figure 3 The embodiment of the present invention provides a malicious code identification device, the device comprising:

[0074] The data acquisition unit 301 is used to acquire binary raw data of an object to be detected in the client; the object to be detected includes at least static files and / or dynamic behaviors;

[0075] A vector acquisition unit 302 is used to input the binary original data into a pre-trained byte embedding model, and obtain a byte embedding vector output by the byte embedding model after byte encoding embedding of the binary original data;

[0076] The communication unit 303 is used to send the byte embedding vector to the cloud, so that the cloud can perform maliciousness identification on the byte embedding vector, and receive the maliciousness identification result fed back by the cloud.

[0077] In one embodiment of the present invention, the data acquisition unit is specifically used to:

[0078] When the object to be detected is a static file, traverse the static files to be detected, pre-process each traversed static file, and obtain binary original data of each static file; the pre-processing at least includes unpacking and / or decompression; and / or,

[0079] When the object to be detected is a dynamic behavior, the monitored dynamic behavior is described in a standardized manner to obtain binary original data related to the standardized description; the binary original data related to the standardized description includes at least one of the following: a parameter sequence of the dynamic behavior, data sent by the dynamic behavior indication, and data received by the dynamic behavior indication.

[0080] In one embodiment of the present invention, the device may further include:

[0081] The sharding processing unit is used to determine the format of the binary original data when the binary original data exceeds the training size of the byte embedding model, and for the binary original data in the format of an executable file, determine the characteristic area of ​​the executable file, and use the binary original data of each characteristic area as separately sharded binary original data, and split the binary original data of the non-characteristic area according to the training size to obtain a plurality of shards of binary original data; for binary original data in other formats, split them according to the training size to obtain a plurality of shards of binary original data.

[0082] In one embodiment of the present invention, the byte embedding model is a first LLM model; the cloud uses a second LLM model to implement malicious identification; the first LLM model and the second LLM model have the same model structure and are trained by a joint training method;

[0083] The joint training method includes:

[0084] Acquire multiple samples; the samples include: sample binary raw data and malicious identification results thereof;

[0085] For each sample, the following steps are performed: using the sample binary original data and the first prompt word in the sample as the input of the first LLM model, the first prompt word is used to instruct the first LLM model to perform byte encoding embedding on the sample binary original data, and obtaining the sample byte embedding vector output by the first LLM model; using the sample byte embedding vector and the second prompt word as the input of the second LLM model, the second prompt word is used to instruct the second LLM model to perform maliciousness identification on the sample byte embedding vector, and using the maliciousness identification result of the sample as the output of the second LLM model; and using the output result of the second LLM model to back-propagate the second model parameters in the second LLM model and the first model parameters in the first LLM model.

[0086] In one embodiment of the present invention, the model structure of the byte embedding model does not include a word segmentation structure, and the binary original data is not subjected to word segmentation processing during the byte encoding embedding process of the binary original data.

[0087] In one embodiment of the present invention, when the malicious identification result fed back by the cloud is determined to be malicious, the malicious identification result also includes: malicious code families and core behaviors; wherein the cloud is also provided with a vector database, and the vector database includes a plurality of known vectors and malicious code families and core behaviors corresponding to the plurality of known vectors one by one;

[0088] The method of malicious identification in the cloud is: the byte embedding vector is respectively calculated with the known vectors stored in the vector database for similarity calculation. When the similarity with the target known vector exceeds the set threshold, the byte embedding vector is determined to be malicious, and the malicious code family and core behavior of the target known vector are fed back as the malicious identification result.

[0089] It should be noted that the malicious code identification device provided in the above embodiment is only illustrated by the division of the above functional modules. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the malicious code identification device provided in the above embodiment and the malicious code identification method embodiment belong to the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.

[0090] The embodiment of the present application also provides a computer device, please refer to Figure 4The computer device includes a processor and a memory, in which at least one instruction, at least one program, a code set or an instruction set is stored, and the at least one instruction, at least one program, a code set or an instruction set is loaded and executed by the processor to implement the malicious code identification method provided by the above-mentioned method embodiments.

[0091] An embodiment of the present application also provides a computer-readable storage medium, on which is stored at least one instruction, at least one program, code set or instruction set, and the at least one instruction, at least one program, code set or instruction set is loaded and executed by a processor to implement the malicious code identification method provided by the above-mentioned method embodiments.

[0092] An embodiment of the present application further provides a computer program product, which includes a computer program. A processor of a computer device reads the computer program from a computer-readable storage medium, and the processor executes the computer program, so that the computer device executes any malicious code identification method described in the above embodiments.

[0093] For the convenience of description, the above system or device is described by dividing it into various modules or units according to its functions. Of course, when implementing the present application, the functions of each unit can be implemented in the same or multiple software and / or hardware.

[0094] It can be known from the description of the above implementation methods that those skilled in the art can clearly understand that the present application can be implemented by means of software plus a necessary general hardware platform. Based on such an understanding, the technical solution of the present application can be essentially or partly contributed to the prior art in the form of a software product, which can be stored in a storage medium such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in the various embodiments of the present application or certain parts of the embodiments.

[0095] Finally, it should be noted that, in this article, relational terms such as first, second, third and fourth 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 statement "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0096] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A method for identifying malicious code, characterized in that: The method comprises: Obtaining binary raw data of an object to be detected in a client; the object to be detected includes at least static files and / or dynamic behaviors; Inputting the binary original data into a pre-trained byte embedding model, and obtaining a byte embedding vector output by the byte embedding model after byte encoding embedding of the binary original data; Sending the byte embedding vector to the cloud, so that the cloud can identify the maliciousness of the byte embedding vector, and receiving the maliciousness identification result fed back by the cloud; Before inputting the binary original data into the pre-trained byte embedding model, the method further includes: when the binary original data exceeds the training size of the byte embedding model, determining the format of the binary original data, and for the binary original data in the format of an executable file, determining the characteristic area of ​​the executable file, using the binary original data of each characteristic area as separately fragmented binary original data, splitting the binary original data of the non-characteristic area according to the training size to obtain a plurality of fragmented binary original data; for the binary original data in other formats, splitting according to the training size to obtain a plurality of fragmented binary original data; The byte embedding model is a first LLM model; the cloud uses a second LLM model to implement malicious identification; the first LLM model and the second LLM model have the same model structure and are trained by a joint training method; The joint training method includes: obtaining multiple samples; the samples include: sample binary original data and its malicious identification result; for each sample, the following are performed: using the sample binary original data and a first prompt word in the sample as inputs of the first LLM model, the first prompt word is used to instruct the first LLM model to perform byte encoding embedding on the sample binary original data, and obtaining the sample byte embedding vector output by the first LLM model; using the sample byte embedding vector and the second prompt word as inputs of the second LLM model, the second prompt word is used to instruct the second LLM model to perform malicious identification on the sample byte embedding vector, and using the malicious identification result of the sample as the output of the second LLM model; using the output result of the second LLM model to back-propagate the second model parameters in the second LLM model and the first model parameters in the first LLM model.

2. The method according to claim 1, characterized in that Obtain the binary raw data of the object to be detected, including: When the object to be detected is a static file, traverse the static files to be detected, pre-process each traversed static file, and obtain binary original data of each static file; the pre-processing at least includes unpacking and / or decompression; and / or, When the object to be detected is a dynamic behavior, the monitored dynamic behavior is described in a standardized manner to obtain binary original data related to the standardized description; the binary original data related to the standardized description includes at least one of the following: a parameter sequence of the dynamic behavior, data sent by the dynamic behavior indication, and data received by the dynamic behavior indication.

3. The method according to claim 1, characterized in that The model structure of the byte embedding model does not include a word segmentation structure, and the binary original data is not subjected to word segmentation processing during the byte encoding embedding process of the binary original data.

4. The method according to any one of claims 1-2, characterized in that: When the malicious identification result fed back by the cloud is determined to be malicious, the malicious identification result also includes: malicious code families and core behaviors; wherein the cloud is also provided with a vector database, and the vector database includes a plurality of known vectors and malicious code families and core behaviors corresponding to the plurality of known vectors one by one; The method of malicious identification in the cloud is: the byte embedding vector is respectively calculated with the known vectors stored in the vector database for similarity calculation. When the similarity with the target known vector exceeds the set threshold, the byte embedding vector is determined to be malicious, and the malicious code family and core behavior of the target known vector are fed back as the malicious identification result.

5. A malicious code identification device, characterized in that: The device comprises: A data acquisition unit, used to acquire binary raw data of an object to be detected in a client; the object to be detected includes at least static files and / or dynamic behaviors; A vector acquisition unit, used for inputting the binary original data into a pre-trained byte embedding model, and acquiring a byte embedding vector output by the byte embedding model after byte encoding embedding of the binary original data; A communication unit, configured to send the byte embedding vector to a cloud, so that the cloud can identify the maliciousness of the byte embedding vector, and receive a maliciousness identification result fed back by the cloud; The device further includes: a sharding processing unit, configured to determine the format of the binary original data when the binary original data exceeds the training size of the byte embedding model, determine the characteristic region of the executable file for the binary original data in the format of the executable file, and use the binary original data of each characteristic region as the binary original data of a separate shard, split the binary original data of the non-characteristic region according to the training size to obtain a plurality of shards of binary original data; for the binary original data of other formats, split according to the training size to obtain a plurality of shards of binary original data; The byte embedding model is a first LLM model; the cloud uses a second LLM model to implement malicious identification; the first LLM model and the second LLM model have the same model structure and are trained by a joint training method; The joint training method includes: obtaining multiple samples; the samples include: sample binary original data and its malicious identification result; for each sample, the following are performed: using the sample binary original data and a first prompt word in the sample as inputs of the first LLM model, the first prompt word is used to instruct the first LLM model to perform byte encoding embedding on the sample binary original data, and obtaining the sample byte embedding vector output by the first LLM model; using the sample byte embedding vector and the second prompt word as inputs of the second LLM model, the second prompt word is used to instruct the second LLM model to perform malicious identification on the sample byte embedding vector, and using the malicious identification result of the sample as the output of the second LLM model; using the output result of the second LLM model to back-propagate the second model parameters in the second LLM model and the first model parameters in the first LLM model.

6. The device according to claim 5, characterized in that The data acquisition unit is specifically used for: When the object to be detected is a static file, traverse the static files to be detected, pre-process each traversed static file, and obtain binary original data of each static file; the pre-processing at least includes unpacking and / or decompression; and / or, When the object to be detected is a dynamic behavior, the monitored dynamic behavior is described in a standardized manner to obtain binary original data related to the standardized description; the binary original data related to the standardized description includes at least one of the following: a parameter sequence of the dynamic behavior, data sent by the dynamic behavior indication, and data received by the dynamic behavior indication.

7. The device according to claim 5, characterized in that The model structure of the byte embedding model does not include a word segmentation structure, and the binary original data is not subjected to word segmentation processing during the byte encoding embedding process of the binary original data.

8. The device according to any one of claims 5-6, characterized in that: When the malicious identification result fed back by the cloud is determined to be malicious, the malicious identification result also includes: malicious code families and core behaviors; wherein the cloud is also provided with a vector database, and the vector database includes a plurality of known vectors and malicious code families and core behaviors corresponding to the plurality of known vectors one by one; The method of malicious identification in the cloud is: the byte embedding vector is respectively calculated with the known vectors stored in the vector database for similarity calculation. When the similarity with the target known vector exceeds the set threshold, the byte embedding vector is determined to be malicious, and the malicious code family and core behavior of the target known vector are fed back as the malicious identification result.

9. A computer device, characterized in that: The computer device includes a memory and a processor, the memory is used to store a computer program, and the processor is used to execute the computer program stored in the memory to implement the steps of any one of the methods described in claims 1-4.

10. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method described in any one of claims 1 to 4 are implemented.

11. A computer program product, characterized in that The method comprises a computer program, wherein when the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 4 are implemented.

Citation Information

Cited By

  • An industrial control engineering file maliciousness detection method and device

    CN122933215A