A script file obfuscation detection method, device, equipment and storage medium

Through the method of multi-model detection and repeated training, the problem of overfitting of the confusion detection model is solved, and accurate confusion recognition of JavaScript script files is achieved.

CN113190847BActive Publication Date: 2024-10-18SANGFOR TECH INC
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202110401461.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-04-14
Publication Date
2024-10-18
Estimated Expiration
2041-04-14

AI Technical Summary

Technical Problem

In the existing technology, obfuscation detection models are prone to overfitting and cannot accurately identify whether non-specific JavaScript script files have been obfuscated.

Method used

Use multiple different confusion detection models for detection, and determine whether the script file is a confusion file by comparing the detection results. If the results are consistent, mark and retrain the model to solve the overfitting problem.

Benefits of technology

Through multi-model detection and repeated training, it can accurately identify whether the script file to be detected is an obfuscated file, avoid over-fitting, and improve the ability to identify non-specific script files.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113190847B_ABST
    Figure CN113190847B_ABST
Patent Text Reader

Abstract

The present application discloses a method, device, equipment and storage medium for detecting obfuscation of script files, the method comprising: obtaining M different obfuscation detection models and a script file to be detected; using each of the M different obfuscation detection models to detect the script file respectively, and obtaining M detection results; when the M detection results are consistent, determining whether the script file is an obfuscated script file based on the detection results. In this way, M detection results are obtained by detecting the script file using M obfuscation detection models, and when the M detection results are consistent, determining whether the script file is an obfuscated script file or a non-obfuscated script file based on the detection results. Subsequently, the obfuscation detection model can be repeatedly trained using script files with consistent detection results, so that the script file to be detected can be accurately detected as an obfuscated script file or a non-obfuscated script file, solving the problem that the existing system can only determine the category of a specific script file, that is, solving the problem of overfitting of the obfuscation detection model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to computer security technology, and in particular to a script file obfuscation detection method, device, equipment and storage medium. Background Art

[0002] In order to evade the detection of firewalls and anti-virus systems, hackers often use obfuscation technology to deform malicious script files. From the perspective of security attack and defense, the anti-virus system needs to be able to determine whether a given script file has been processed by obfuscation technology.

[0003] The target industry has proposed an obfuscated script file identification method for JaveScript script files, which uses an obfuscation tool (such as JaveScript Obfuscator) or manual labeling to obtain JaveScript script file samples with obfuscated and non-obfuscated labels, and trains a script file obfuscation detection model, and then uses the trained script file obfuscation detection model to detect whether the JaveScript script file to be detected has been obfuscated. However, the labeled samples generated by the obfuscation tool in the above scheme are prone to overfitting of the script file obfuscation detection model, that is, only specific JaveScript script files can be identified. Summary of the invention

[0004] In order to solve the above technical problems, the embodiments of the present application provide a script file obfuscation detection method, device, equipment and storage medium.

[0005] The technical solution of this application is implemented as follows:

[0006] In a first aspect, a method for detecting obfuscation of a script file is provided, the method comprising:

[0007] Obtain M different obfuscation detection models, and obtain a first script file to be detected; wherein M is a positive integer greater than or equal to 2;

[0008] Using each of the M different obfuscation detection models to detect the script file respectively, to obtain M detection results;

[0009] When the M detection results are consistent, it is determined whether the script file is an obfuscated script file based on the detection results.

[0010] In the above scheme, after determining whether the script file is an obfuscated script file based on the detection result, the method also includes: using the detection result as label information of the script file; wherein the label information is used to indicate whether the script file is an obfuscated script file.

[0011] In the above scheme, after using the detection result as the label information of the script file, the method also includes: storing the script file and the corresponding label information in a script file set with label information; and using the script file and the label information to retrain the M different confusion detection models to obtain M different confusion detection models after training.

[0012] In the above solution, the method further includes: when the M detection results are inconsistent, re-using the script file as the script file to be detected and waiting to be re-detected next time.

[0013] In the above solution, the M different confusion detection models are generated based on different feature engineering trainings, respectively.

[0014] In the above solution, the M different confusion detection models are generated based on training of different machine learning algorithms.

[0015] In the above solution, the M different confusion detection models are generated based on different feature engineering and different machine learning algorithm training.

[0016] In the above solution, the script file includes a JavaScript file.

[0017] In a second aspect, a script file obfuscation detection device is provided, the device comprising:

[0018] An acquisition unit, used to acquire M different obfuscation detection models and acquire a first script file to be detected; wherein M is a positive integer greater than or equal to 2;

[0019] A detection unit, configured to detect the first script file using each of the M different obfuscation detection models to obtain M detection results;

[0020] A determination unit is used to determine whether the script file is an obfuscated script file based on the detection results when the M detection results are consistent.

[0021] According to a third aspect, a device for detecting obfuscation of a script file is provided, comprising: a processor and a memory configured to store a computer program that can be run on the processor, wherein the processor is configured to execute the steps of the aforementioned method when running the computer program.

[0022] In a fourth aspect, a computer-readable storage medium is provided, on which a computer program is stored, wherein the computer program implements the steps of the aforementioned method when executed by a processor.

[0023] The present application discloses a method for detecting obfuscation of script files, the method comprising: obtaining M different obfuscation detection models, and obtaining a script file to be detected; wherein M is a positive integer greater than or equal to 2; using each of the M different obfuscation detection models to detect the script file respectively, and obtaining M detection results; by comparing the M detection results, determining the label information of the script file. In this way, the script file is detected using M obfuscation detection models to obtain M detection results, and when the M detection results are consistent, the script file is determined to be an obfuscated script file or a non-obfuscated script file according to the detection results. Subsequently, the obfuscation detection model can be repeatedly trained using script files with consistent detection results, so that the script file to be detected can be accurately detected as an obfuscated script file or a non-obfuscated script file, solving the problem that the existing method can only determine the category of a specific script file, that is, solving the problem of overfitting of the obfuscation detection model. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] Figure 1 This is a first flow chart of the obfuscation detection method for script files in an embodiment of the present application;

[0025] Figure 2 A first flow chart of training two different confusion detection models in an embodiment of the present application;

[0026] Figure 3 This is a second flow chart of the obfuscation detection method for script files in an embodiment of the present application;

[0027] Figure 4 A second flow chart of training two different confusion detection models in an embodiment of the present application;

[0028] Figure 5 This is a schematic diagram of the structure of the obfuscation detection device for script files in an embodiment of the present application;

[0029] Figure 6 This is a structural diagram of the obfuscation detection device for script files in an embodiment of the present application. DETAILED DESCRIPTION

[0030] In order to enable a more detailed understanding of the features and technical contents of the embodiments of the present application, the implementation of the embodiments of the present application is described in detail below in conjunction with the accompanying drawings. The attached drawings are for reference only and are not used to limit the embodiments of the present application.

[0031] In order to solve the problem that only specific script file categories (including obfuscated script files and non-obfuscated script files) can be determined in the prior art, the present application provides an obfuscation detection method, which performs obfuscation detection of script files in a semi-supervised learning manner. Specifically, M preset detection models are trained using script files with labeled information to obtain M obfuscation detection models, and then the M obfuscation detection models are used to detect a large number of script files without labeled information, and the obfuscation detection models are repeatedly trained according to the script files and label information. In this way, a large number of unlabeled script files can be accurately determined as obfuscated script files or non-obfuscated script files, which solves the problem that only specific script file categories can be determined in the prior art.

[0032] Figure 1 FIG. 1 is a first flow chart of the obfuscation detection method for script files in an embodiment of the present application. Figure 1 As shown, the script file obfuscation detection method may include the following specific steps:

[0033] Step 101: Obtain M different obfuscation detection models and obtain a script file to be detected; wherein M is a positive integer greater than or equal to 2;

[0034] It should be noted that the script file to be detected refers to a script file without tag information, that is, the script file does not indicate whether it is an obfuscated script file or a non-obfuscated script file. Here, the script file can be a JavaScript script file.

[0035] It should be noted that the M obfuscation detection models are all trained detection models, which are used to detect whether a script file is an obfuscated script file.

[0036] In some embodiments, the method further includes: training the obfuscation detection model. That is, before obtaining M different obfuscation detection models, the method further includes: obtaining a script file set with label information; wherein the script file set includes at least one script file to be trained and label information of each script file to be trained; using M feature extraction models to extract features from each script file to be trained in the script file set, and obtaining M feature extraction results corresponding to each script file to be trained; based on the M feature extraction results and label information, training M preset detection models to obtain the M different obfuscation detection models.

[0037] It should be noted that, the M different confusion detection models can be respectively generated based on the feature extraction models constructed by M different feature engineering and the preset detection models constructed by the same M machine learning algorithms; or, they can be respectively generated based on the feature extraction models constructed by the same M feature engineering and the preset detection models constructed by M different machine learning algorithms; or, they can also be respectively generated based on the feature extraction models constructed by M different feature engineering and the preset detection models constructed by M different machine learning algorithms.

[0038] The so-called different feature engineering may be, for example, two or more of lexical features, grammatical features, black-and-white word features, etc. The so-called different machine learning algorithms may be, for example, two or more of support vector machine algorithm, boosted tree algorithm, random forest algorithm, deep learning algorithm, neural network algorithm, etc.

[0039] Specifically, M feature extraction models are used to extract features from each script file to be trained in the script file set, and M feature extraction results corresponding to each script file to be trained are obtained. The M feature extraction results are then input into the corresponding M preset detection models to obtain the predicted label information of the corresponding script file to be trained. According to the predicted label information and the label information (i.e., the real label information), the parameters in the M preset detection models are adjusted respectively. If the accuracy of the predicted label information is higher than or equal to the preset accuracy, M different confusion detection models are obtained. If the accuracy of the predicted label information is lower than the preset accuracy, the parameters in the M preset detection models are continuously adjusted until the accuracy of the predicted label information is higher than or equal to the preset accuracy.

[0040] The label information (i.e., real label information) of each script file to be trained mentioned above can be manually labeled to label each script file to be trained in the script file set with corresponding label information, and the label information is used to indicate whether the script file is an obfuscated script file. For example, the label information includes an obfuscation mark and a non-obfuscation mark, or the label information includes an obfuscation mark to indicate whether the script file is an obfuscated script file, and does not include an obfuscation mark to indicate whether the script file is a non-obfuscated script file.

[0041] Here, if the value of M is 2, the feature extraction model includes a feature extraction model constructed by lexical features and a feature extraction model constructed by black and white words. Feature extraction is performed on each script file to be trained in the script file set according to the M feature extraction models to obtain M feature extraction results corresponding to each script file to be trained. Specifically, the feature extraction model constructed by lexical features performs lexical analysis on each script file to be trained to generate a word stream corresponding to each script file to be trained. Each word stream includes multiple types of words, such as identifiers, assignment operators, literals, keywords, etc. The number of different types of words in each word stream is counted, and the corresponding number of words is filled in according to the word type order in the pre-set first feature extraction result rule to form a row matrix of fixed dimension, which is the corresponding feature extraction result. For the feature extraction model constructed for black and white words, black and white word analysis is performed on each script file to be trained, all black words and white words in each script file to be trained are extracted, and the number of black words and white words in each script file to be trained are counted respectively, and then the corresponding quantities are filled in according to the word type order in the pre-set second feature extraction result rule to form a 1*2 row matrix, which is the corresponding feature extraction result.

[0042] Based on the training of the above two different confusion detection models, this application provides a training method: Figure 2 This is a first flow chart of two different confusion detection model trainings in the embodiment of the present application, such as Figure 2 As shown, the specific steps are as follows:

[0043] Step 201: Obtain a script file set with tag information;

[0044] Here, the script file set includes at least one script file to be trained and label information of each script file to be trained, wherein the label information is used to indicate whether the script file is an obfuscated script file.

[0045] Step 202: extracting lexical features from each script file to be trained in the script file set to obtain a first feature vector corresponding to each script file to be trained;

[0046] Here, a feature extraction model constructed by using lexical features is used to perform lexical analysis on each script file to be trained, and a word stream corresponding to each script file to be trained is generated, wherein each word stream includes multiple types of words.

[0047] Then count the number of words of different types in each word stream, and fill in the corresponding number of words according to the word type order in the preset first feature extraction result rule to form a row matrix of fixed dimension (i.e., the first feature vector / feature extraction result).

[0048] Step 203: training model 1 based on the first feature vector and label information corresponding to each script file to be trained;

[0049] Here, model 1 is any one of the M preset detection models mentioned above.

[0050] Step 204: Obtain the trained model 1;

[0051] Model 1 in this step is the confusion detection model after training the preset detection model in the previous step.

[0052] Step 205: extracting black and white words from each script file to be trained in the script file set to obtain a second feature vector corresponding to each script file to be trained;

[0053] Here, a black-white word extraction model is used to perform black-white word analysis on each script file to be trained, and all black words and white words in each script file to be trained are extracted.

[0054] Then count the number of black words and white words in each script analysis file to be trained, and fill in the corresponding numbers according to the word type order in the preset second feature extraction result rule to form a 1*2 row matrix (i.e., the second eigenvector).

[0055] Step 206: training model 2 based on the second feature vector and label information corresponding to each script file to be trained;

[0056] Here, model 2 is any one of the M preset detection models mentioned above.

[0057] It should be noted that Model 1 and Model 2 can be a model composed of a feature extraction model constructed by different feature engineering and a preset detection model constructed by the same machine learning algorithm; or, it can be a model composed of a feature extraction model constructed by the same feature engineering and a preset detection model constructed by different machine learning algorithms; or, it can be a model composed of a feature extraction model constructed by different feature engineering and a preset detection model constructed by different machine learning algorithms.

[0058] Step 207: Obtain the trained model 2.

[0059] Model 2 in this step is the confusion detection model after training the preset detection model in the previous step.

[0060] Step 102: using each of the M different obfuscation detection models to detect the script file respectively, to obtain M detection results;

[0061] It should be noted that the detection result is used to indicate whether the script file is an obfuscated script file.

[0062] Here, the detection results of different obfuscation detection models for script files may be the same or different.

[0063] Step 103: When the M detection results are consistent, determine whether the script file is an obfuscated script file based on the detection results.

[0064] That is to say, when the detection results of each obfuscation detection model for the script file are consistent, the type of the script file can be determined. If the detection result is obfuscation, the script file is determined to be an obfuscated script file; if the detection result is non-obfuscation, the script file is determined to be a non-obfuscated script file.

[0065] In some embodiments, after determining whether the script file is an obfuscated script file based on the detection result, the method further includes: using the detection result as label information of the script file; wherein the label information is used to indicate whether the script file is an obfuscated script file.

[0066] In some embodiments, after using the detection result as the label information of the script file, the method further includes: storing the script file and the corresponding label information in a script file set with label information; and using the script file and the label information to retrain the M different confusion detection models to obtain M different confusion detection models after training.

[0067] In some embodiments, the method further includes: when the M detection results are inconsistent, re-using the script file as the script file to be detected, and waiting to be re-detected next time.

[0068] Here, the execution subject of step 101 to step 103 may be a processor of the obfuscation detection device of the script file.

[0069] In this way, M obfuscation detection models are used to detect script files to obtain M detection results. When the M detection results are consistent, the script file is determined to be an obfuscated script file or a non-obfuscated script file according to the detection results. Subsequently, the obfuscation detection model can be repeatedly trained using script files with consistent detection results, so that the script files to be detected can be accurately detected as obfuscated script files or non-obfuscated script files, solving the existing problem of only being able to determine the category of specific script files, that is, solving the problem of overfitting of the obfuscation detection model.

[0070] This application also proposes a script file obfuscation detection method. Figure 3 FIG. 2 is a second flow chart of the obfuscation detection method for script files in an embodiment of the present application. Figure 3 As shown, the obfuscation detection method of the script file may specifically include:

[0071] Step 301: Obtain M different obfuscation detection models and obtain a script file to be detected; wherein M is a positive integer greater than or equal to 2;

[0072] It should be noted that the script file to be detected refers to a script file without tag information, that is, the script file does not indicate whether it is an obfuscated script file or a non-obfuscated script file. Here, the script file can be a JavaScript script file.

[0073] It should be noted that the M obfuscation detection models are all trained detection models, which are used to detect whether a script file is an obfuscated script file.

[0074] In some embodiments, the method further includes: training the obfuscation detection model. That is, before obtaining M different obfuscation detection models, the method further includes: obtaining a script file set with label information; wherein the script file set includes at least one script file to be trained and label information of each script file to be trained; using M feature extraction models to extract features from each script file to be trained in the script file set, and obtaining M feature extraction results corresponding to each script file to be trained; based on the M feature extraction results and label information, training M preset detection models to obtain the M different obfuscation detection models.

[0075] In some embodiments, the M different confusion detection models are generated based on training of different machine learning algorithms, respectively.

[0076] In some embodiments, the M different confusion detection models are generated based on training of different machine learning algorithms, respectively.

[0077] In some embodiments, the M different confusion detection models are generated based on different feature engineering and different machine learning algorithm training.

[0078] Step 302: using each obfuscation detection model of the M different obfuscation detection models to detect the script file respectively, to obtain M detection results;

[0079] It should be noted that the detection result is used to indicate whether the script file is an obfuscated script file.

[0080] Here, the detection results of different obfuscation detection models for script files may be the same or different.

[0081] Step 303: When the M detection results are consistent, determining whether the script file is an obfuscated script file based on the detection results;

[0082] That is to say, when the detection results of each obfuscation detection model for the script file are consistent, the type of the script file can be determined. If the detection result is obfuscation, the script file is determined to be an obfuscated script file; if the detection result is non-obfuscation, the script file is determined to be a non-obfuscated script file.

[0083] In some embodiments, after determining whether the script file is an obfuscated script file based on the detection result, the method further includes: using the detection result as label information of the script file; wherein the label information is used to indicate whether the script file is an obfuscated script file.

[0084] That is to say, if the detection result is obfuscation, the script file is determined to be an obfuscated script file, that is, the label information of the script file is obfuscated (that is, the detection result); if the detection result is non-obfuscation, the script file is determined to be a non-obfuscated script file, that is, the label information of the script file is non-obfuscation (that is, the detection result).

[0085] In some embodiments, after using the detection result as the label information of the script file, the method further includes: storing the script file and the corresponding label information in a script file set with label information; and using the script file and the label information to retrain the M different confusion detection models to obtain M different confusion detection models after training.

[0086] That is to say, after detecting the label information of the script file, the script file and the label information are stored in a script file set with label information, so as to facilitate the subsequent training of M different confusion detection models through the script file and the label information.

[0087] In practical applications, after the label information of multiple script files is detected, M different obfuscation detection models are trained based on the multiple script files and the corresponding label information to obtain M different obfuscation detection models after training. After the label information of the next batch of multiple script files is detected, the M different obfuscation detection models trained in the previous step are trained again to obtain new M different obfuscation detection models, and so on.

[0088] Step 304: When the M detection results are inconsistent, the script file is used again as the script file to be detected and waits for the next re-detection.

[0089] That is, when the M detection results include obfuscated script files and non-obfuscated script files, it is impossible to determine whether the script file is an obfuscated script file, and the script file needs to be re-used as a script file to be detected and wait for the next re-detection.

[0090] For example, if the value of M is 4, 4 different obfuscation detection models detect the script file and obtain 4 detection results, namely obfuscated script file, obfuscated script file, obfuscated script file and non-obfuscated script file. Since the 4 detection results are inconsistent, it is impossible to determine whether the script file is an obfuscated script file. Only when the 4 detection results are all obfuscated script files or all non-obfuscated script files, it is determined that the script file is an obfuscated script file or a non-obfuscated script file.

[0091] In this way, M obfuscation detection models are used to detect script files to obtain M detection results. When the M detection results are consistent, the script file is determined to be an obfuscated script file or a non-obfuscated script file according to the detection results. Subsequently, the obfuscation detection model can be repeatedly trained using script files with consistent detection results, so that the script files to be detected can be accurately detected as obfuscated script files or non-obfuscated script files, solving the existing problem of only being able to determine the category of specific script files, that is, solving the problem of overfitting of the obfuscation detection model.

[0092] Based on the above embodiments, Figure 4 This is a second flow chart of two different confusion detection model trainings in the embodiment of the present application, such as Figure 4 As shown, the specific steps are as follows:

[0093] Step 401: Acquire multiple script files without label information to form a script file set to be detected;

[0094] Step 402: Obtain model 1;

[0095] Step 403: extracting lexical features from each script file in the script file set to be detected, and obtaining a third feature vector corresponding to each script file;

[0096] Step 404: using the third feature vector corresponding to each script file as the input of model 1, and outputting the first detection result;

[0097] Step 405: Obtain model 2;

[0098] Step 406: extracting black and white words from each script file in the script file set to be detected, and obtaining a fourth feature vector corresponding to each script file;

[0099] Step 407: using the fourth feature vector corresponding to each script file as the input of model 2, and outputting the second detection result;

[0100] Step 408: Determine whether the first detection result is consistent with the second detection result; if consistent, execute step 409; if inconsistent, execute step 401;

[0101] Here, the two detection results are inconsistent, indicating that the label information of the corresponding script file cannot be determined, and the corresponding script file needs to be re-used as the script file to be detected.

[0102] When the two detection results are consistent, it means that the tag information of the corresponding script file can be determined, and step 409 is continued.

[0103] Step 409: determining the tag information of the corresponding script file, and storing it in a script file set with tag information;

[0104] Step 410: iteratively train model 1;

[0105] Here, model 1 is used to detect each script file to obtain the corresponding predicted label information, and compare it with the real label information, and calculate the ratio of the predicted correct label information to the total predicted label information, that is, the first predicted label information accuracy. If the first predicted label information accuracy is less than the set probability threshold, the parameters in model 1 are modified, and the first predicted label information accuracy is calculated again until the first predicted label information accuracy is greater than or equal to the set probability threshold, and the parameters in model 1 are no longer modified, indicating that the iteration is terminated. Then continue to execute step 402.

[0106] Step 411: Iteratively train model 2.

[0107] Here, model 2 is used to detect each script file to obtain the corresponding predicted label information, and compare it with the real label information, and calculate the ratio of the predicted correct label information to the total predicted label information, that is, the second predicted label information accuracy. If the second predicted label information accuracy is less than the set probability threshold, modify the parameters in model 2, and calculate the second predicted label information accuracy again, until the second predicted label information accuracy is greater than or equal to the set probability threshold, the parameters in model 2 are no longer modified, indicating that the iteration is terminated. Then continue to execute step 405.

[0108] In this way, M obfuscation detection models are used to detect script files to obtain M detection results. When the M detection results are consistent, the script file is determined to be an obfuscated script file or a non-obfuscated script file according to the detection results. Subsequently, the obfuscation detection model can be repeatedly trained using script files with consistent detection results, so that the script files to be detected can be accurately detected as obfuscated script files or non-obfuscated script files, solving the existing problem of only being able to determine the category of specific script files, that is, solving the problem of overfitting of the obfuscation detection model.

[0109] The present application provides a script file obfuscation detection device. Figure 5 Schematic diagram of the structure of the obfuscation detection device for script files in the embodiment of the present application. Figure 5As shown, the device comprises:

[0110] The acquisition unit 501 is used to acquire M different obfuscation detection models and acquire a first script file to be detected; wherein M is a positive integer greater than or equal to 2;

[0111] A detection unit 502 is used to detect the script file using each of the M different obfuscation detection models to obtain M detection results;

[0112] The determination unit 503 is used to determine whether the script file is an obfuscated script file based on the detection results when the M detection results are consistent.

[0113] In some embodiments, after determining whether the script file is an obfuscated script file based on the detection result, the detection result is used as label information of the script file; wherein the label information is used to indicate whether the script file is an obfuscated script file.

[0114] In some embodiments, after using the detection result as the label information of the script file, the script file and the corresponding label information are stored in a script file set with label information; and the M different confusion detection models are retrained using the script file and the label information to obtain M different confusion detection models after training.

[0115] In some embodiments, the method further includes: when the M detection results are inconsistent, re-using the script file as the script file to be detected, and waiting to be re-detected next time.

[0116] In some embodiments, the M different confusion detection models are generated based on different feature engineering trainings, respectively.

[0117] In some embodiments, the M different confusion detection models are generated based on training of different machine learning algorithms, respectively.

[0118] In some embodiments, the M different confusion detection models are generated based on different feature engineering and different machine learning algorithm training.

[0119] In some embodiments, the script file comprises a JavaScript file.

[0120] In this way, M different obfuscation detection models are used to detect the script file to obtain M detection results. When the M detection results are consistent, the script file category can be determined according to the detection results, that is, the obfuscated script file or the non-obfuscated script file. When the M detection results are inconsistent, wait for re-detection until the script file category is determined. The obfuscation detection method of the present application can determine any script file category, solving the problem that only a specific script file category can be determined in the existing method, that is, solving the problem of overfitting of the existing obfuscation detection model.

[0121] The present application embodiment provides a script file obfuscation detection device, Figure 6 Schematic diagram of the structure of the obfuscation detection device for script files in the embodiment of the present application, as shown in FIG. Figure 6 As shown, the device includes: a processor 601 and a memory 602 configured to store a computer program that can be run on the processor;

[0122] The processor 601 is configured to execute the steps of the script file obfuscation detection method in the aforementioned embodiment when running the computer program.

[0123] Of course, in practical applications, Figure 6 As shown in FIG. 6 , the various components in the script file obfuscation detection device are coupled together via a bus system 603. It is understood that the bus system 603 is used to realize the connection and communication between these components. In addition to the data bus, the bus system 603 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, Figure 6 Various buses are labeled as bus system 603.

[0124] In practical applications, the processor may be at least one of an application-specific integrated circuit (ASIC), a digital signal processing device (DSPD), a programmable logic device (PLD), a field-programmable gate array (FPGA), a controller, a microcontroller, and a microprocessor. It is understandable that for different devices, the electronic device used to implement the functions of the processor may also be other, and the embodiments of the present application do not specifically limit this.

[0125] The above-mentioned memory can be a volatile memory (volatile memory), such as a random access memory (RAM); or a non-volatile memory (non-volatile memory), such as a read-only memory (ROM), a flash memory, a hard disk (HDD) or a solid-state drive (SSD); or a combination of the above-mentioned types of memory, and provide instructions and data to the processor.

[0126] An embodiment of the present application also provides a computer-readable storage medium for storing a computer program.

[0127] Optionally, the computer-readable storage medium can be applied to any one of the methods in the embodiments of the present application, and the computer program enables the computer to execute the corresponding processes implemented by the processor in each method in the embodiments of the present application. For the sake of brevity, they are not repeated here.

[0128] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as: multiple units or components can be combined, or can be integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.

[0129] The units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units; some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0130] In addition, all functional units in the embodiments of the present invention may be integrated into one processing module, or each unit may be a separate unit, or two or more units may be integrated into one unit; the above integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional units. A person of ordinary skill in the art may understand that all or part of the steps of implementing the above method embodiments may be completed by hardware related to program instructions, and the above program may be stored in a computer-readable storage medium, which, when executed, executes the steps of the above method embodiments; and the above storage medium includes various media that can store program codes, such as mobile storage devices, read-only memories (ROM), random access memories (RAM), magnetic disks or optical disks.

[0131] The methods disclosed in several method embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments.

[0132] The features disclosed in several product embodiments provided in this application can be arbitrarily combined without conflict to obtain new product embodiments.

[0133] The features disclosed in several method or device embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments or device embodiments.

[0134] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A script file obfuscation detection method, characterized in that: The method comprises: Obtain M different obfuscation detection models, and obtain a script file to be detected; wherein M is a positive integer greater than or equal to 2; the M different obfuscation detection models perform feature extraction on the script file based on feature extraction models constructed by M feature engineering, obtain M feature extraction results, and input the M feature extraction results into the training generation of a preset detection model constructed by M machine learning algorithms; when the value of M is 2, the feature extraction model includes a feature extraction model constructed by lexical features and a feature extraction model constructed by black and white words, the feature extraction model constructed by lexical features is used to perform lexical analysis on the script file, generate a word stream corresponding to the script file, and perform feature extraction on the number of different types of words in the word stream according to the word type order in the first feature extraction result rule, the feature extraction model constructed by black and white words is used to perform black and white word analysis on the script file, extract all black words and white words in the script file, and perform feature extraction on the number of black words and the number of white words in the script file according to the word type order in the second feature extraction result rule; Using each of the M different obfuscation detection models to detect the script file respectively, to obtain M detection results; When the M detection results are consistent, it is determined whether the script file is an obfuscated script file based on the detection results.

2. The method according to claim 1, characterized in that After determining whether the script file is an obfuscated script file based on the detection result, the method further includes: The detection result is used as label information of the script file; wherein the label information is used to indicate whether the script file is an obfuscated script file.

3. The method according to claim 2, characterized in that After using the detection result as label information of the script file, the method further includes: The script file and the corresponding tag information are stored in a script file set with tag information; The M different obfuscation detection models are retrained using the script file and the label information to obtain the trained M different obfuscation detection models.

4. The method according to claim 1, characterized in that: The method further comprises: When the M detection results are inconsistent, the script file is used again as the script file to be detected and waits to be re-detected next time.

5. The method according to any one of claims 1 to 4, characterized in that The M different confusion detection models are generated based on different feature engineering trainings, respectively.

6. The method according to any one of claims 1 to 4, characterized in that The M different confusion detection models are generated based on training of different machine learning algorithms.

7. The method according to any one of claims 1 to 4, characterized in that The M different confusion detection models are generated based on different feature engineering and different machine learning algorithm training.

8. The method according to claim 1, characterized in that The script file includes a JavaScript file.

9. A script file obfuscation detection device, characterized in that: The device comprises: An acquisition unit is used to acquire M different obfuscation detection models and acquire a first script file to be detected; wherein M is a positive integer greater than or equal to 2; wherein the M different obfuscation detection models perform feature extraction on the script file based on feature extraction models constructed by M feature engineering to obtain M feature extraction results, and the M feature extraction results are input into a preset detection model training generation constructed by M machine learning algorithms; when the value of M is 2, the feature extraction model includes a feature extraction model constructed by lexical features and a feature extraction model constructed by black and white words, the feature extraction model constructed by lexical features is used to perform lexical analysis on the script file, generate a word stream corresponding to the script file, and perform feature extraction on the number of different types of words in the word stream according to the word type order in the first feature extraction result rule, the feature extraction model constructed by black and white words is used to perform black and white word analysis on the script file, extract all black words and white words in the script file, and perform feature extraction on the number of black words and the number of white words in the script file according to the word type order in the second feature extraction result rule; A detection unit, configured to detect the first script file using each of the M different obfuscation detection models to obtain M detection results; A determination unit is used to determine whether the script file is an obfuscated script file based on the detection results when the M detection results are consistent.

10. A script file obfuscation detection device, characterized in that: The device comprises: a processor and a memory configured to store a computer program capable of being executed on the processor, Wherein, the processor is configured to execute the steps of the method according to any one of claims 1 to 8 when running the computer program.

11. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.

Citation Information

Patent Citations

  • WebShell detection method, device and system

    CN106961419A

  • Semi-supervised biomedicine event extraction method based on co-training

    CN107978373A

  • A method and an apparatus for identifying malicious documents

    CN108985064A