Webshell detection method and device, equipment and storage medium

Detecting the attack stages and types of Webshell through multiple decision trees in the target random forest model solves the problem of low accuracy of Webshell detection in the existing technology, improves the ability to identify Webshell attacks, and enhances the security of websites and business systems. Security.

CN118802209APending Publication Date: 2024-10-18CHINA MOBILE COMM CORP GUANGXI CO LTD +1
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202311308954.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-10-10
Publication Date
2024-10-18

AI Technical Summary

Technical Problem

The existing technology is not very accurate when detecting Web shells, and it is difficult to effectively detect the entire process of the function call chain. Especially when the call chain is too long or involves multiple languages, the detection difficulty increases, and there is a lack of comprehensive analysis of the attack call chain. Process testing.

Method used

Use multiple decision trees in the target random forest model to detect the data characteristics of different attack stages of Webshell. By obtaining the data to be detected, including all commands in the entire function call chain, input the random forest model to determine the attack stage and attack type of Webshell. .

Benefits of technology

It improves the accuracy of Webshell detection and can more effectively identify the attack stages and types of Webshell, thereby enhancing the security of websites and business systems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118802209A_ABST
    Figure CN118802209A_ABST
Patent Text Reader

Abstract

The invention discloses a webshell detection method and device, equipment and a storage medium, and belongs to the field of network security. The webshell detection method comprises the steps of obtaining to-be-detected data, wherein the to-be-detected data comprises all commands executed in the whole process of a function call chain; the to-be-detected data is input into the target random forest model, data features of different attack stages of the webshell are detected according to the to-be-detected data through multiple decision trees in the target random forest model, so that a webshell detection result is obtained, and the webshell detection result at least comprises the attack stage and the attack type of the webshell. According to the webshell detection method provided by the embodiment of the invention, the target random forest model can detect all commands executed in the whole process of the function call chain and determine the attack stage and the attack type of the webshell, so that the accuracy of webshell detection can be improved, and the security of a website and a service system is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of network security, and in particular to a webshell detection method, device, equipment and storage medium. Background Art

[0002] Webshell is a code execution environment in the form of script files such as asp, php, jsp or cgi, which is mainly used for website management, server management, permission management and other operations. It is easy to use. You only need to upload a code file and access it through the URL to perform many daily operations, which greatly facilitates the user's management of websites and servers. Because of this, after invading the website, the attacker can modify the code and use it as a backdoor program to achieve the purpose of controlling the website server. Now webshell specifically refers to the attacker's backdoor program for websites and business systems. After the attacker controls the website and business system, he can upload and download files, view the database, and execute arbitrary program commands, which greatly endangers the security of the website or business system.

[0003] Therefore, in order to improve the security of websites and business systems, it is particularly important to detect webshells. Summary of the invention

[0004] The embodiments of the present application provide a webshell detection method, device, equipment and storage medium, which can improve the accuracy of webshell detection and thus improve the security of websites and business systems.

[0005] In a first aspect, an embodiment of the present application provides a webshell detection method, including:

[0006] Obtain the data to be tested, which includes all commands executed in the entire process of the function call chain;

[0007] The data to be detected is input into the target random forest model, and the data features of different attack stages of the webshell are detected according to the data to be detected through multiple decision trees in the target random forest model to obtain the webshell detection result, which at least includes the attack stage and attack type of the webshell.

[0008] In some embodiments of the present application, the multiple decision trees include a first decision tree, a second decision tree, a third decision tree, a fourth decision tree, and a fifth decision tree. The multiple decision trees in the target random forest model detect the data characteristics of different attack stages of the webshell according to the data to be detected, so as to obtain the webshell detection results, including:

[0009] Using the first decision tree, detect whether all commands executed during the entire function call chain process contain attack feature vectors to obtain a first detection result;

[0010] Using the second decision tree, detect whether all commands executed during the entire function call chain process contain a file feature vector to obtain a second detection result;

[0011] Using the third decision tree, detect whether all commands executed during the entire function call chain process contain hacker semantic vectors to obtain a third detection result;

[0012] Using the fourth decision tree, detect whether all commands executed during the entire function call chain process contain an encrypted feature vector to obtain a fourth detection result;

[0013] Using the fifth decision tree, detect whether all commands executed during the entire function call chain process contain a dynamic request feature vector to obtain a fifth detection result;

[0014] The webshell detection result is determined according to the first detection result, the second detection result, the third detection result, the fourth detection result and the fifth detection result.

[0015] In some embodiments of the present application, multiple decision trees in the target random forest model are used to detect data features of different attack stages of webshell according to the data to be detected, so as to obtain webshell detection results, including:

[0016] Through any decision tree, the data characteristics of different attack stages of webshell are detected according to the data to be detected to obtain the webshell detection results, including:

[0017] Analyze all commands executed during the entire function call chain to obtain the called functions and databases;

[0018] According to the called function and database, data corresponding to the data feature vector corresponding to the decision tree is extracted from the data to be detected, and data features corresponding to the attack stage of the decision tree are obtained;

[0019] The decision tree is used to detect the data features of the attack stage corresponding to the decision tree, and the webshell detection results of the attack stage corresponding to the decision tree are obtained.

[0020] In some embodiments of the present application, the attack feature vector includes file encryption features, upload function features, and execution function features; the file feature vectors include big horse file features, small horse file features, vegetable knife horse file features, and encrypted horse file features; the hacker semantic vector includes network reconnaissance features, file viewing features, permission maintenance features, and malicious process features; the encryption feature vector includes weak encryption features and strong encryption features; the dynamic request feature vector includes local dynamic request features, same network segment dynamic request features, and cross-network segment dynamic request features.

[0021] In some embodiments of the present application, before obtaining the data to be detected, the webshell detection method further includes:

[0022] Obtain webshell sample data and real network sample data. Both webshell sample data and real network sample data contain all commands executed during the entire function call chain process.

[0023] Input the webshell sample data into multiple decision trees of a first preset random forest model for training to obtain a first random forest model, wherein the multiple decision trees are respectively used to detect data features of different attack stages of the webshell;

[0024] Input the real network sample data into multiple decision trees of the second preset random forest model for training to obtain a second random forest model, where the multiple decision trees are used to detect data features at different attack stages of the webshell respectively;

[0025] Associating the attributes of the first random forest model and the second random forest model to obtain a third random forest model;

[0026] The third random forest model is trained using the webshell sample data of the first preset ratio and the real network sample data of the second preset ratio to obtain training results of multiple decision trees;

[0027] Determine whether the third random forest model is trained according to the training results of the multiple decision trees and the preset convergence conditions;

[0028] When the training of the third random forest model is completed, the third random forest model is determined as the target random forest model.

[0029] In some embodiments of the present application, the first preset random forest model includes a first preset decision tree, a second preset decision tree, a third preset decision tree, a fourth preset decision tree, and a fifth preset decision tree; the second random forest model includes a first preset decision tree, a second preset decision tree, a third preset decision tree, and a fifth preset decision tree.

[0030] In some embodiments of the present application, the training results of the multiple decision trees include a hit probability corresponding to each decision tree; and determining whether the third random forest model is trained according to the training results of the multiple decision trees and a preset convergence condition includes:

[0031] For each decision tree in the multiple decision trees, determine a hit rate corresponding to each decision tree according to a hit probability corresponding to each decision tree and a weight corresponding to the hit probability;

[0032] When the hit rate of each decision tree is greater than or equal to the preset convergence condition corresponding to the decision tree, determining that the training of the third random forest model is completed;

[0033] When the hit rate of any one of the multiple decision trees is less than a preset convergence condition corresponding to the decision tree, it is determined that the training of the third random forest model is not completed.

[0034] In some embodiments of the present application, the third random forest model includes a first decision tree, a second decision tree, a third decision tree, a fourth decision tree, and a fifth decision tree, and the hit probability of the fourth decision tree is obtained by statistically analyzing the training result data; the hit probabilities of the first decision tree, the second decision tree, the third decision tree, and the fifth decision tree are determined by:

[0035] For each of the multiple features of the decision tree, determine the total number of hits of each feature after n trainings, where n is a positive integer greater than 1;

[0036] The total hit count of each feature after n trainings is expanded to obtain the total hit accuracy corresponding to each feature;

[0037] Determine the hit accuracy of the decision tree based on the total hit counts and total hit accuracy of multiple features;

[0038] According to the hit accuracy of the decision tree and a plurality of preset hit intervals, determining the hit interval in which the hit accuracy of the decision tree lies;

[0039] The hit probability of the decision tree is determined according to the hit interval of the hit accuracy of the decision tree.

[0040] In a second aspect, an embodiment of the present application provides a webshell detection device, the device comprising:

[0041] An acquisition module is used to acquire the data to be detected, and the data to be detected includes all commands executed in the whole process of the function call chain;

[0042] The detection module is used to input the data to be detected into the target random forest model, and detect the data characteristics of different attack stages of the webshell according to the data to be detected through multiple decision trees in the target random forest model to obtain the webshell detection result, which at least includes the attack stage and attack type of the webshell.

[0043] In a third aspect, an embodiment of the present application provides a webshell detection device, the webshell detection device comprising: a processor and a memory storing computer program instructions;

[0044] When the processor executes the computer program instructions, the webshell detection method of any of the above embodiments is implemented.

[0045] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, on which computer program instructions are stored. When the computer program instructions are executed by a processor, the webshell detection method of any of the above embodiments is implemented.

[0046] According to the webshell detection method, device, equipment and storage medium provided by the embodiments of the present application, multiple decision trees in the target random forest model are used to detect data features of different attack stages of the webshell. After the data to be detected is input into the target random forest model, the target random forest model can detect all commands executed in the entire process of the function call chain, and determine the attack stage and attack type of the webshell. Therefore, the accuracy of webshell detection can be improved, thereby improving the security of the website and business system. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] In order to more clearly illustrate the technical solution of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0048] Figure 1 A schematic diagram of a webshell detection method provided in an embodiment of the present application;

[0049] Figure 2 is a schematic diagram of the structure of the first decision tree;

[0050] Figure 3 is a schematic diagram of the structure of the second decision tree;

[0051] Figure 4 is a schematic diagram of the structure of the third decision tree;

[0052] Figure 5is a schematic diagram of the structure of the fourth decision tree;

[0053] Figure 6 is a schematic diagram of the structure of the fifth decision tree;

[0054] Figure 7 This is a flowchart of the first stage model training;

[0055] Figure 8 Schematic diagram of the second stage model training process;

[0056] Fig. 9 A schematic diagram of the structure of a webshell detection device provided in an embodiment of the present application;

[0057] Fig.10 A schematic diagram of the structure of a webshell detection device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0058] The features and exemplary embodiments of various aspects of the present application will be described in detail below. In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain the present application, rather than to limit the present application. For those skilled in the art, the present application can be implemented without the need for some of these specific details. The following description of the embodiments is only to provide a better understanding of the present application by illustrating the examples of the present application.

[0059] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the statement "include..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0060] Webshell is a code execution environment in the form of script files such as asp, php, jsp or cgi, which is mainly used for website management, server management, permission management and other operations. It is easy to use. You only need to upload a code file and access it through the URL to perform many daily operations, which greatly facilitates the user's management of websites and servers. Because of this, after invading the website, the attacker can modify the code and use it as a backdoor program to achieve the purpose of controlling the website server. Now webshell specifically refers to the attacker's backdoor program for websites and business systems. After the attacker controls the website and business system, he can upload and download files, view the database, and execute arbitrary program commands, which greatly endangers the security of the website or business system.

[0061] Therefore, in order to improve the security of websites and business systems, it is particularly important to detect webshells.

[0062] Currently, webshells are divided into five categories: file upload type, web page disguise type, command execution type, Trojan backdoor type, and memory execution type. Among them, encrypted webshells mainly use symmetric encryption, asymmetric encryption, obfuscation, shelling, and multi-layer nesting to encrypt webshells.

[0063] The call chain of webshell is difficult to fully grasp. If the call chain is too long or involves multiple different languages ​​or technologies, the detection will be more difficult. In addition, there is currently a lack of detection of the entire process of attacking the webshell call chain. Currently, webshell detection is concentrated in log detection, traffic detection, and file detection. The accuracy of webshell detection is not high.

[0064] In order to solve the above technical problems, the embodiments of the present application provide a webshell detection method, device, equipment and storage medium. Multiple decision trees in the target random forest model are used to detect data features of different attack stages of the webshell. After the data to be detected is input into the target random forest model, the target random forest model can detect all commands executed in the entire process of the function call chain, and determine the attack stage and attack type of the webshell. Therefore, the accuracy of webshell detection can be improved, thereby improving the security of websites and business systems.

[0065] In a first aspect, an embodiment of the present application provides a webshell detection method.

[0066] Figure 1 A flow chart of the webshell detection method provided in the embodiment of the present application is shown below in combination with Figure 1 To introduce the webshell detection method of the embodiment of the present application.

[0067] Webshell detection methods include:

[0068] S110, obtaining data to be detected, where the data to be detected includes all commands executed in the entire process of the function call chain.

[0069] S120, inputting the data to be detected into the target random forest model, and detecting data features of different attack stages of the webshell according to the data to be detected through multiple decision trees in the target random forest model to obtain a webshell detection result, which at least includes the attack stage and attack type of the webshell.

[0070] Regarding the above S110, the data to be detected may be logs, traffic, and files generated on the server of the website or business system, and the data to be detected includes all commands executed in the entire process of the function call chain.

[0071] Regarding the above S120, the target random forest model may include 5 decision trees, namely the first decision tree, the second decision tree, the third decision tree, the fourth decision tree and the fifth decision tree, and the data features of the multiple decision trees webshell in different attack stages, specifically: the first decision tree is used to detect the attack feature vector of the data generated by the server in the attack initiation stage, the second decision tree is used to detect the file feature vector of the data generated by the server in the attack success stage, the third decision tree is used to detect the hacker semantic vector of the data generated by the server in the attack utilization stage, the fourth decision tree is used to detect the encryption feature vector of the data generated by the server in the attack utilization stage, and the fifth decision tree is used to detect the dynamic request feature vector of the data generated by the server in the post-penetration attack stage.

[0072] Figure 2 is a schematic diagram of the structure of the first decision tree;

[0073] Combine the following Figure 2 Introducing the first decision tree,

[0074] Regarding the first decision tree, the first decision tree is used to detect the attack feature vector of the data generated by the server during the attack initiation phase, specifically involving the file encryption feature detection, upload function feature detection, execution function feature detection, etc. of the webshell.

[0075] Among them, the webshell file upload detection attack mainly involves the detection of file body encryption features, that is, the functions used for encrypted Webshell can use different related functions according to the specific encryption method, including base64_encode and base64_decode, urlencode and urldecode, str_rot13, openssl_public_encrypt and openssl_private_decrypt, gzcompress and gzuncompress, mcrypt_encrypt and mcrypt_decrypt and other detections.

[0076] Webshell upload function features:

[0077] PHP: move_uploaded_file, copy, file_put_contents, fwrite, upload_file, encode, decode, assert, assertion, system, exec, shell_exec, passthru, popen, proc_open, symlink, etc.

[0078] JSP: Runtime.exec, ProcessBuilder.start, FileOutputStream, FileWriter, BufferedWriter, PrintWriter, URL, etc.

[0079] ASP: ASP does not support file upload functions, so the script for users to upload files usually uses Server.CreateObject to create an ASP Object, such as Scripting.FileSystemObject, ADODB.Stream, MSXML2.XMLHTTP, etc.

[0080] ASPX: FileUpload, WebClient, DownloadFile, WebRequest, WebRequestMethods, Request, etc.

[0081] Webshell execution mainly involves executing system command detection, creating and executing code commands (detection, reading and writing file detection, etc.

[0082] Execute system commands: system, shell_exec, exec, popen, proc_open, passthru, escapeshellcmd, etc.

[0083] Reading and writing files: fopen, file_get_contents, file_put_contents, fwrite, fread, unlink, mkdir, rmdir, etc.

[0084] Execute SQL statements: mysql_query, mysqli_query, pg_query, sqlite_query, etc.

[0085] Create and execute code: eval, assert, create_function, etc.

[0086] Network connection and communication: fsockopen, curl_init, socket_create, etc.

[0087] Get system information and operating environment: phpinfo, get_loaded_extensions, ini_get, etc.

[0088] Figure 3 is a schematic diagram of the structure of the second decision tree;

[0089] Combine the following Figure 3 Introduce the second decision tree. The second decision tree is used to detect the file feature vector of the data generated by the server during the successful attack stage. After the attack is successful, the second decision tree is used to detect the file landing, especially for memory worms with communication features such as websocket and encrypted worms with homemade encoders. Specifically, it involves detecting the characteristics of big worm files, small worm files, chopper worm files, and encrypted worm files. The key decision for big worm file feature detection is the characteristics of big worm file web pages (for example: echo encode_pass('angel'), <div class="msgbox">The key decisions for detecting the characteristics of Pony files are to execute functions in Pony files (for example: $_FILES, FileOutputStream, etc.), and to detect the characteristics of Pony files. The key decisions for detecting the characteristics of Chaidao Pony files are to execute functions in Chaidao Pony files (str_replace, system, etc.), and to request parameters in Chaidao Pony files. The key decisions for detecting the characteristics of encrypted Pony files are to execute functions in files, and to have communication characteristics in files.

[0090] Figure 4 is a schematic diagram of the structure of the third decision tree; Figure 5 is a schematic diagram of the structure of the fourth decision tree;

[0091] Combine the following Figure 4 , Figure 5 The third decision tree and the fourth decision tree are introduced. The third decision tree and the fourth decision tree are used to detect hackers in the process of using webshell to attack. The third decision tree is used to detect the hacker semantic vector of the data generated by the server in the attack utilization stage, and the fourth decision tree is used to detect the encrypted feature vector of the data generated by the server in the attack utilization stage.

[0092] The third decision tree detects network reconnaissance, file viewing, permission maintenance, malicious processes and other aspects in the semantics of hacker attacks. The network reconnaissance semantics checks whether the hacker views the network structure of itself, whether it detects the survival of the network segment, etc.; the file viewing semantics checks whether a certain number of viewing commands appear within a unit time, whether a certain number of sensitive file accesses appear within a unit time, whether a certain number of accesses to feature files appear within a unit time, etc.; the permission maintenance semantics checks whether the hacker forwards traffic, launches remote control Trojans and other related operations, and the malicious process semantics checks whether the hacker leaves verification and calculation, extortion and other processes. By analyzing the hacker behavior to form a decision tree for hacker semantic analysis, the next step of the hacker's invasion through the webshell is analyzed to effectively analyze whether the webshell exists.

[0093] The fourth decision tree mainly divides encryption feature vectors into weak encryption features and strong encryption features for detection, among which weak encryption features include User-Agent, cookies, Accept, Cache-Control, key similarity, request packet structure features, etc. Strong encryption features include response packet structure features, certificate features, key negotiation features, etc. The fourth decision tree solves the problem of identifying encrypted / obfuscated webshells.

[0094] Figure 6 is a schematic diagram of the structure of the fifth decision tree;

[0095] Combine the following Figure 6 The fifth decision tree is introduced. The fifth decision tree is used to detect the dynamic request feature vectors of the data generated by the server in the post-penetration attack stage. The fifth decision tree is used to detect the post-attack stage features of hackers after obtaining the webshell. By detecting the dynamic request feature vectors involved in the post-penetration attack, decision analysis is mainly performed on the local dynamic request, the same network segment dynamic request, and the cross-network segment dynamic request, etc., to associate whether it is a post-penetration attack stage attack.

[0096] In this way, the data generated by the whole process of the webshell attack can be detected through the above-mentioned first decision tree, second decision tree, third decision tree, fourth decision tree and fifth decision tree to obtain the webshell detection result. According to the webshell detection result, the attack stage and attack type can be determined. The attack stage can be the attack initiation stage, the attack success stage, the attack utilization stage or the post-penetration attack stage. The attack type is what features are used to attack, such as what call function is used, what encryption method is used, etc. After obtaining the attack stage and attack type of the webshell, the attack stage and attack type can be blocked immediately to prevent hackers from continuing to attack the server and ensure the security of the website or business system.

[0097] In some embodiments of the present application, multiple decision trees in the target random forest model are used to detect data features of different attack stages of webshell according to the data to be detected, so as to obtain webshell detection results, including:

[0098] Using the first decision tree, detect whether all commands executed during the entire function call chain process contain attack feature vectors to obtain a first detection result;

[0099] Using the second decision tree, detect whether all commands executed during the entire function call chain process contain a file feature vector to obtain a second detection result;

[0100] Using the third decision tree, detect whether all commands executed during the entire function call chain process contain hacker semantic vectors to obtain a third detection result;

[0101] Using the fourth decision tree, detect whether all commands executed during the entire function call chain process contain an encrypted feature vector to obtain a fourth detection result;

[0102] Using the fifth decision tree, detect whether all commands executed during the entire function call chain process contain a dynamic request feature vector to obtain a fifth detection result;

[0103] The webshell detection result is determined according to the first detection result, the second detection result, the third detection result, the fourth detection result and the fifth detection result.

[0104] Specifically, all commands executed in the entire process of the function call chain in the data to be detected are input into the first decision tree, the second decision tree, the third decision tree, the fourth decision tree and the fifth decision tree. The data to be detected is detected by each decision tree respectively, and the detection result of each decision tree can be determined. The attack stage and attack type of the webshell can be determined by combining the detection results of each decision tree.

[0105] In some embodiments of the present application, multiple decision trees in the target random forest model are used to detect data features of different attack stages of webshell according to the data to be detected, so as to obtain webshell detection results, including:

[0106] Through any decision tree, the data characteristics of different attack stages of webshell are detected according to the data to be detected to obtain the webshell detection results, including:

[0107] Analyze all commands executed during the entire function call chain to obtain the called functions and databases;

[0108] According to the called function and database, data corresponding to the data feature vector corresponding to the decision tree is extracted from the data to be detected, and data features corresponding to the attack stage of the decision tree are obtained;

[0109] The decision tree is used to detect the data features of the attack stage corresponding to the decision tree, and the webshell detection results of the attack stage corresponding to the decision tree are obtained.

[0110] Specifically, for each decision tree, after obtaining the data to be detected, the data to be detected is analyzed to obtain the called functions and databases, and the data corresponding to the data feature vectors corresponding to each decision tree are extracted from the data to be detected to obtain the corresponding data features. After the decision tree detects the corresponding data features, the corresponding detection results can be obtained, and whether the data is a webshell can be determined based on the detection results.

[0111] In some embodiments of the present application, before obtaining the data to be detected, the webshell detection method further includes:

[0112] Obtain webshell sample data and real network sample data. Both webshell sample data and real network sample data contain all commands executed during the entire function call chain process.

[0113] Input the webshell sample data into multiple decision trees of a first preset random forest model for training to obtain a first random forest model, wherein the multiple decision trees are respectively used to detect data features of different attack stages of the webshell;

[0114] Input the real network sample data into multiple decision trees of the second preset random forest model for training to obtain a second random forest model, where the multiple decision trees are used to detect data features at different attack stages of the webshell respectively;

[0115] Associating the attributes of the first random forest model and the second random forest model to obtain a third random forest model;

[0116] The third random forest model is trained using the webshell sample data of the first preset ratio and the real network sample data of the second preset ratio to obtain training results of multiple decision trees;

[0117] Determine whether the third random forest model is trained according to the training results of the multiple decision trees and the preset convergence conditions;

[0118] When the training of the third random forest model is completed, the third random forest model is determined as the target random forest model.

[0119] Figure 7 This is a flowchart of the first stage model training;

[0120] Figure 8 Schematic diagram of the second stage model training process;

[0121] Combine the following Figure 7 and Figure 8 The training of the target random forest model of the embodiment of the present application is introduced.

[0122] Before model training, the webshell sample set is analyzed to find out all the commands it can execute, and for each command, the functions and libraries it calls are analyzed to find out the dependencies between commands, functions and libraries. For each called function and library, other functions and libraries on which they depend are tracked until a function call chain is formed and detected and analyzed. Multiple decision trees are constructed based on attack feature vectors, file feature vectors, hacker semantic vectors, encryption feature vectors, and dynamic request feature vectors. Multiple decision trees are used to detect data features at different attack stages.

[0123] The logic of algorithm training for machine learning is divided into two stages. In the first stage, webshell sample data and attack basic information-real network sample data are used to separately train model M and model N. M is the first preset random forest model, and the first preset random forest model includes the first preset decision tree, the second preset decision tree, the third preset decision tree, the fourth preset decision tree and the fifth preset decision tree. N is the second random forest model, and the second random forest model includes the first preset decision tree, the second preset decision tree, the third preset decision tree and the fifth preset decision tree.

[0124] First, obtain the basic information sample set N of the attack, randomly extract several attack information sample subsets N1-Nn from the basic information sample set N, and then enter N1-Nn into multiple decision trees for training to form a random forest algorithm model based on the attack basic information sample set, and then hand over the algorithm model to the artificial intelligence decision center; webshell sample total set training collection randomly extracts several sample subsets M1-Mn from the webshell sample total set, and then enters M1-Mn into multiple decision trees for training to form a random forest algorithm model based on the webshell sample total set, and then hand over the algorithm model to the artificial intelligence decision center.

[0125] In the second stage, the model M and the model N are combined for training. Specifically:

[0126] After the artificial intelligence decision center obtains the data model N1 and the data model M1, it generates a new model algorithm D1 after associating the rule attributes. It uses the webshell sample data accounting for 70% of the total data set and the basic information sample set-real network data accounting for 30% to train and test the model algorithm D1, and distributes the models to different trees. After rounds of real network tests (the final webshell sample data accounts for 30% and the real network data accounts for 70%), the final model matching decision is made to obtain the final result of webshell detection.

[0127] The final sample test was carried out using the webshell collection on GitHub. The detection rate in the first round of testing reached 98.72%, verifying the innovation and practicality of this method.

[0128] In this way, the target random forest model formed based on the above training method can analyze the entire process in the webshell call chain, solve the problem of discovering the entire process in webshell detection, improve the accuracy of webshell detection, and thus improve the security of websites and business systems.

[0129] The preset convergence condition can be whether the hit rate of the decision tree reaches a threshold. If the threshold is reached, the model is considered to have converged and the model has been trained. If the threshold is not reached, the model is considered to have not converged and needs to continue to be trained.

[0130] In some embodiments of the present application, the training results of the multiple decision trees include a hit probability corresponding to each decision tree; and determining whether the third random forest model is trained according to the training results of the multiple decision trees and a preset convergence condition includes:

[0131] For each decision tree in the multiple decision trees, determine a hit rate corresponding to each decision tree according to a hit probability corresponding to each decision tree and a weight corresponding to the hit probability;

[0132] When the hit rate of each decision tree is greater than or equal to the preset convergence condition corresponding to the decision tree, determining that the training of the third random forest model is completed;

[0133] When the hit rate of any one of the multiple decision trees is less than a preset convergence condition corresponding to the decision tree, it is determined that the training of the third random forest model is not completed.

[0134] In some embodiments of the present application, the third random forest model includes a first decision tree, a second decision tree, a third decision tree, a fourth decision tree, and a fifth decision tree, and the hit probability of the fourth decision tree is obtained by statistically analyzing the training result data; the hit probabilities of the first decision tree, the second decision tree, the third decision tree, and the fifth decision tree are determined by:

[0135] For each of the multiple features of the decision tree, determine the total number of hits of each feature after n trainings, where n is a positive integer greater than 1;

[0136] The total hit count of each feature after n trainings is expanded to obtain the total hit accuracy corresponding to each feature;

[0137] Determine the hit accuracy of the decision tree based on the total hit counts and total hit accuracy of multiple features;

[0138] According to the hit accuracy of the decision tree and a plurality of preset hit intervals, determining the hit interval in which the hit accuracy of the decision tree lies;

[0139] The hit probability of the decision tree is determined according to the hit interval of the hit accuracy of the decision tree.

[0140] Specifically, taking the first decision tree as an example, combined with the above Figure 2 ,Since in the first stage of model training, webshell sample data and real network sample data are used to train the model separately, among which, webshell sample data is a known webshell, while real network sample data is an unknown sample and is not necessarily a webshell. Therefore, although a single condition hit reduces missed reports, it often involves a large number of false positives. In view of this situation, a mathematical model algorithm is established, and the hit accuracy of the file encryption feature is set to Da, the number of hits is Dan, the hit accuracy of the upload function feature is set to Db, the number of hits is Dbn, and the hit accuracy of the execution function feature is set to Dc, the number of hits is Dcn, then the webshell hit accuracy HA is calculated as:

[0141] HA=(Da+Db+Dc) / 3+HAn / 3

[0142] Da=((Da1+Da2+...+Dan)^n) / n

[0143] Db=((Db1+Db2+...+Dbn)^n) / n

[0144] Dc=((Dc1+Dc2+...+Dcn)^n) / n

[0145] Total hit number HAn=(Da1+Da2+...+Dan)+(Db1+Db2+...+Dbn)+(Dc1+Dc2+...+Dcn)

[0146] Among them, Dan represents the number of hits of the file encryption feature during the nth training, Dbn represents the number of hits of the upload function feature during the nth training, and Dcn represents the number of hits of the execution function feature during the nth training.

[0147] In the attack initiation phase, HA is divided into intervals. Through a large number of sample environment training, the first hit interval is [3, 6), the second hit interval is [1, 3), [6, 11), and the third hit interval is [0, 1), [11, +∞);

[0148] The hit probability of the first hit interval is 87.42%, the hit probability of the second hit interval is 63.31%, and the hit probability of the third hit interval is 33.31%. The hit rate after hitting the decision tree can be obtained by obtaining the corresponding weight according to the hit probability.

[0149] In this way, by combining various features and expanding the hit accuracy, the hit probability can be determined from a larger dimension, solving the problem of a large number of false positives and negatives in the webshell detection method.

[0150] The second decision tree is similar to the first decision tree. The same data model algorithm is established. In the attack initiation phase, the HA is divided into intervals. Through a large number of sample environment training, the first hit interval is [4, 8), the second hit interval is [1, 4), [8, 15), and the third hit interval is [0, 4), [15, +∞);

[0151] The hit probability of the first hit interval is 93.91%, the hit probability of the second hit interval is 73.12%, and the hit probability of the third hit interval is 51.11%. The hit rate after hitting the decision tree can be obtained by obtaining the corresponding weight according to the hit probability.

[0152] The third decision tree is similar to the first decision tree. The same data model algorithm is established. In the attack initiation phase, the HA is divided into intervals. Through a large number of sample environment training, the first hit interval is [2, 6), the second hit interval is [6, 16), and the third hit interval is [0, 2), [16, +∞);

[0153] The hit probability of the first hit interval is 89.21%, the hit probability of the second hit interval is 69.31%, and the hit probability of the third hit interval is 42.84%. The hit rate after hitting the decision tree can be obtained by obtaining the corresponding weight according to the hit probability.

[0154] Since the fourth decision tree completely uses webshell sample data for feature extraction in the first stage of model training, it does not involve the problem of inaccurate hit probability caused by feature extraction and model training of real network sample data. Therefore, the hit probability is obtained by statistics through the training result data, among which the hit probability of strong encryption features is 97.53%, and the hit probability of weak encryption features is 67.51%.

[0155] The fifth decision tree is similar to the first decision tree. The same data model algorithm is established. In the attack initiation phase, the HA is divided into intervals. Through a large number of sample environment training, the first hit interval is [0, 3), the second hit interval is [3, 8), and the third hit interval is [8, +∞);

[0156] The hit probability of the first hit interval is 94.64%, the hit probability of the second hit interval is 84.62%, and the hit probability of the third hit interval is 52.15%. The hit rate after hitting the decision tree can be obtained by obtaining the corresponding weight according to the hit probability.

[0157] According to the webshell detection method provided in the embodiment of the present application, multiple decision trees in the target random forest model are used to detect data features of different attack stages of the webshell. After the data to be detected is input into the target random forest model, the target random forest model can detect all commands executed in the entire process of the function call chain, and determine the attack stage and attack type of the webshell. Therefore, the accuracy of webshell detection can be improved, thereby improving the security of the website and business system.

[0158] In a second aspect, an embodiment of the present application provides a webshell detection device.

[0159] Fig. 9 This is a schematic diagram of the structure of the webshell detection device provided in the embodiment of the present application. Fig. 9 To introduce the webshell detection device of an embodiment of the present application.

[0160] The webshell detection device includes:

[0161] The acquisition module 901 is used to acquire the data to be detected, and the data to be detected includes all the commands executed in the whole process of the function call chain;

[0162] The detection module 902 is used to input the data to be detected into the target random forest model, and detect the data characteristics of different attack stages of the webshell according to the data to be detected through multiple decision trees in the target random forest model to obtain the webshell detection result, which at least includes the attack stage and attack type of the webshell.

[0163] In some embodiments of the present application, the multiple decision trees include a first decision tree, a second decision tree, a third decision tree, a fourth decision tree, and a fifth decision tree, and the detection module 902 includes:

[0164] A first detection unit, configured to detect whether all commands executed in the entire function call chain process contain attack feature vectors through a first decision tree to obtain a first detection result;

[0165] A second detection unit is used to detect whether all commands executed in the whole process of the function call chain contain a file feature vector through a second decision tree to obtain a second detection result;

[0166] A third detection unit, used to detect whether all commands executed in the whole process of the function call chain contain hacker semantic vectors through a third decision tree to obtain a third detection result;

[0167] a fourth detection unit, configured to detect whether all commands executed in the entire function call chain process contain the encrypted feature vector through a fourth decision tree, and obtain a fourth detection result;

[0168] a fifth detection unit, configured to detect whether all commands executed in the entire function call chain process contain a dynamic request feature vector through a fifth decision tree, and obtain a fifth detection result;

[0169] The first determining unit is used to determine the webshell detection result according to the first detection result, the second detection result, the third detection result, the fourth detection result and the fifth detection result.

[0170] In some embodiments of the present application, the detection module 902 includes:

[0171] The detection unit is used to detect data features of different attack stages of webshell according to the data to be detected through any decision tree to obtain the webshell detection result. The detection unit is specifically used to:

[0172] Analyze all commands executed during the entire function call chain to obtain the called functions and databases;

[0173] According to the called function and database, data corresponding to the data feature vector corresponding to the decision tree is extracted from the data to be detected, and data features corresponding to the attack stage of the decision tree are obtained;

[0174] The decision tree is used to detect the data features of the attack stage corresponding to the decision tree, and the webshell detection results of the attack stage corresponding to the decision tree are obtained.

[0175] In some embodiments of the present application, the attack feature vector includes file encryption features, upload function features, and execution function features; the file feature vectors include big horse file features, small horse file features, vegetable knife horse file features, and encrypted horse file features; the hacker semantic vector includes network reconnaissance features, file viewing features, permission maintenance features, and malicious process features; the encryption feature vector includes weak encryption features and strong encryption features; the dynamic request feature vector includes local dynamic request features, same network segment dynamic request features, and cross-network segment dynamic request features.

[0176] In some embodiments of the present application, the webshell detection device also includes a training module, and the training module includes:

[0177] An acquisition unit, used to acquire webshell sample data and real network sample data, both of which contain all commands executed in the entire process of the function call chain;

[0178] A first training unit is used to input webshell sample data into multiple decision trees of a first preset random forest model for training to obtain a first random forest model, wherein the multiple decision trees are respectively used to detect data features of different attack stages of the webshell;

[0179] A second training unit is used to input the real network sample data into multiple decision trees of a second preset random forest model for training to obtain a second random forest model, and the multiple decision trees are used to detect data features of different attack stages of the webshell respectively;

[0180] A model association unit, used to associate attributes of the first random forest model and the second random forest model to obtain a third random forest model;

[0181] A third training unit is used to train a third random forest model using a first preset proportion of webshell sample data and a second preset proportion of real network sample data to obtain training results of multiple decision trees;

[0182] A second determining unit, used to determine whether the third random forest model is trained according to the training results of the multiple decision trees and a preset convergence condition;

[0183] The fourth determination unit is used to determine the third random forest model as the target random forest model when the training of the third random forest model is completed.

[0184] In some embodiments of the present application, the first preset random forest model includes a first preset decision tree, a second preset decision tree, a third preset decision tree, a fourth preset decision tree, and a fifth preset decision tree; the second random forest model includes a first preset decision tree, a second preset decision tree, a third preset decision tree, and a fifth preset decision tree.

[0185] In some embodiments of the present application, the training results of the multiple decision trees include the hit probability corresponding to each decision tree; the second determination unit is specifically used to:

[0186] For each decision tree in the multiple decision trees, determine a hit rate corresponding to each decision tree according to a hit probability corresponding to each decision tree and a weight corresponding to the hit probability;

[0187] When the hit rate of each decision tree is greater than or equal to the preset convergence condition corresponding to the decision tree, determining that the training of the third random forest model is completed;

[0188] When the hit rate of any one of the multiple decision trees is less than a preset convergence condition corresponding to the decision tree, it is determined that the training of the third random forest model is not completed.

[0189] In some embodiments of the present application, the third random forest model includes a first decision tree, a second decision tree, a third decision tree, a fourth decision tree and a fifth decision tree, and the hit probability of the fourth decision tree is obtained by statistically analyzing the training result data; the hit probabilities of the first decision tree, the second decision tree, the third decision tree and the fifth decision tree are determined in the following manner, and the third training unit is specifically used for:

[0190] For each of the multiple features of the decision tree, determine the total number of hits of each feature after n trainings, where n is a positive integer greater than 1;

[0191] The total hit count of each feature after n trainings is expanded to obtain the total hit accuracy corresponding to each feature;

[0192] Determine the hit accuracy of the decision tree based on the total hit counts and total hit accuracy of multiple features;

[0193] According to the hit accuracy of the decision tree and a plurality of preset hit intervals, determining the hit interval in which the hit accuracy of the decision tree lies;

[0194] The hit probability of the decision tree is determined according to the hit interval of the hit accuracy of the decision tree.

[0195] According to the webshell detection device provided by the embodiment of the present application, multiple decision trees in the target random forest model are used to detect data features of different attack stages of the webshell. After the data to be detected is input into the target random forest model, the target random forest model can detect all commands executed in the entire process of the function call chain, and determine the attack stage and attack type of the webshell. Therefore, the accuracy of webshell detection can be improved, thereby improving the security of the website and business system.

[0196] Fig.10 It is a structural diagram of the webshell detection device provided in an embodiment of the present application.

[0197] The webshell detection device may include a processor 1001 and a memory 1002 storing computer program instructions.

[0198] Specifically, the processor 1001 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.

[0199] The memory 1002 may include a large capacity memory for data or instructions. By way of example and not limitation, the memory 1002 may include a hard disk drive (HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive or a combination of two or more of these. In appropriate cases, the memory 1002 may include a removable or non-removable (or fixed) medium. In appropriate cases, the memory 1002 may be inside or outside the integrated gateway disaster recovery device. In a specific embodiment, the memory 1002 is a non-volatile solid-state memory.

[0200] The memory may include a read-only memory (ROM), a random access memory (RAM), a magnetic disk storage medium device, an optical storage medium device, a flash memory device, an electrical, optical or other physical / tangible memory storage device. Thus, typically, the memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., a memory device) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the method according to the first aspect of the present disclosure.

[0201] The processor 1001 implements the webshell detection method in the above embodiment by reading and executing computer program instructions stored in the memory 1002.

[0202] In one example, the webshell detection device may further include a communication interface 1003 and a bus 1010. Fig.10 As shown, the processor 1001, the memory 1002, and the communication interface 1003 are connected via a bus 1010 and communicate with each other.

[0203] The communication interface 1003 is mainly used to implement communication between various modules, devices, units and / or equipment in the embodiments of the present application.

[0204] Bus 1010 includes hardware, software or both, and the components of the payment device are coupled to each other. For example, but not limitation, the bus may include an accelerated graphics port (AGP) or other graphics bus, an enhanced industrial standard architecture (EISA) bus, a front-side bus (FSB), a hypertransport (HT) interconnect, an industrial standard architecture (ISA) bus, an infinite bandwidth interconnect, a low pin count (LPC) bus, a memory bus, a microchannel architecture (MCA) bus, a peripheral component interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a serial advanced technology attachment (SATA) bus, a video electronics standard association local (VLB) bus or other suitable bus or a combination of two or more of these. Where appropriate, bus 1010 may include one or more buses. Although the present application embodiment describes and illustrates a specific bus, the present application considers any suitable bus or interconnect.

[0205] The payment device executes the data processing method in the embodiment of the present application, thereby achieving Figure 1 The webshell detection method shown.

[0206] In addition, in combination with the webshell detection method in the above embodiment, the embodiment of the present application can provide a computer storage medium for implementation. The computer storage medium stores computer program instructions; when the computer program instructions are executed by the processor, any one of the webshell detection methods in the above embodiment is implemented.

[0207] It should be clear that the present application is not limited to the specific configuration and processing described above and shown in the figures. For the sake of simplicity, a detailed description of the known method is omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present application is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between the steps after understanding the spirit of the present application.

[0208] The functional blocks shown in the above-described block diagram can be implemented as hardware, software, firmware or a combination thereof. When implemented in hardware, it can be, for example, an electronic circuit, an application specific integrated circuit (ASIC), appropriate firmware, a plug-in, a function card, etc. When implemented in software, the elements of the present application are programs or code segments that are used to perform the required tasks. Programs or code segments can be stored in machine-readable media, or transmitted on a transmission medium or a communication link by a data signal carried in a carrier wave. "Machine-readable media" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, optical fiber media, radio frequency (RF) links, etc. Code segments can be downloaded via computer networks such as the Internet, intranets, etc.

[0209] It should also be noted that the exemplary embodiments mentioned in this application describe some methods or systems based on a series of steps or devices. However, this application is not limited to the order of the above steps, that is, the steps can be performed in the order mentioned in the embodiment, or in a different order from the embodiment, or several steps can be performed simultaneously.

[0210] Aspects of the present disclosure are described above with reference to the flowchart and / or block diagram of the method, device (system) and computer program product according to the embodiment of the present disclosure. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device to produce a machine so that these instructions executed by the processor of the computer or other programmable data processing device enable the implementation of the function / action specified in one or more boxes of the flowchart and / or block diagram. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor, or a field programmable logic circuit. It can also be understood that each box in the block diagram and / or flowchart and the combination of boxes in the block diagram and / or flowchart can also be implemented by dedicated hardware that performs a specified function or action, or can be implemented by a combination of dedicated hardware and computer instructions.

[0211] The above is only a specific implementation of the present application. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working processes of the systems, modules and units described above can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here. It should be understood that the protection scope of the present application is not limited to this. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in this application, and these modifications or replacements should be included in the protection scope of this application.

Claims

1. A webshell detection method, characterized in that: The method comprises: Acquire the data to be detected, wherein the data to be detected includes all commands executed in the whole process of the function call chain; The data to be detected is input into the target random forest model, and the data features of different attack stages of the webshell are detected according to the data to be detected through multiple decision trees in the target random forest model to obtain a webshell detection result, wherein the webshell detection result at least includes the attack stage and attack type of the webshell.

2. The method according to claim 1, characterized in that The multiple decision trees include a first decision tree, a second decision tree, a third decision tree, a fourth decision tree, and a fifth decision tree. The multiple decision trees in the target random forest model detect data features of different attack stages of webshell according to the data to be detected, so as to obtain a webshell detection result, including: Using the first decision tree, detect whether all commands executed during the entire process of the function call chain contain attack feature vectors to obtain a first detection result; Using the second decision tree, detect whether all commands executed in the entire process of the function call chain contain a file feature vector to obtain a second detection result; Using the third decision tree, detect whether all commands executed in the entire process of the function call chain contain hacker semantic vectors to obtain a third detection result; Using the fourth decision tree, detect whether all commands executed in the entire process of the function call chain contain an encrypted feature vector to obtain a fourth detection result; Using the fifth decision tree, detect whether all commands executed during the entire process of the function call chain contain a dynamic request feature vector to obtain a fifth detection result; Determine a webshell detection result according to the first detection result, the second detection result, the third detection result, the fourth detection result, and the fifth detection result.

3. The method according to claim 2, characterized in that The method of detecting data features of different attack stages of webshells according to the data to be detected by using multiple decision trees in the target random forest model to obtain webshell detection results includes: By using any decision tree to detect the data features of different attack stages of the webshell according to the data to be detected, the webshell detection results are obtained, including: Analyze all commands executed in the whole process of the function call chain to obtain the called functions and database; According to the called function and the database, data corresponding to the data feature vector corresponding to the decision tree is extracted from the data to be detected to obtain data features of the attack stage corresponding to the decision tree; The data features of the attack stage corresponding to the decision tree are detected through the decision tree to obtain the webshell detection result of the attack stage corresponding to the decision tree.

4. The method according to claim 2 or 3, characterized in that: The attack feature vector includes file encryption feature, upload function feature and execution function feature; the file feature vector includes big horse file feature, small horse file feature, vegetable knife horse file feature and encrypted horse file feature; the hacker semantic vector includes network reconnaissance feature, file viewing feature, permission maintenance feature and malicious process feature; the encryption feature vector includes weak encryption feature and strong encryption feature; the dynamic request feature vector includes local dynamic request feature, same network segment dynamic request feature and cross-network segment dynamic request feature.

5. The method according to claim 1, characterized in that: Before obtaining the data to be detected, the method further includes: Obtain webshell sample data and real network sample data, wherein the webshell sample data and the real network sample data both contain all commands executed during the entire function call chain process; Input the webshell sample data into multiple decision trees of a first preset random forest model for training to obtain a first random forest model, wherein the multiple decision trees are respectively used to detect data features of different attack stages of the webshell; Input the real network sample data into multiple decision trees of a second preset random forest model for training to obtain a second random forest model, wherein the multiple decision trees are respectively used to detect data features of different attack stages of the webshell; Associating the first random forest model with the second random forest model to obtain a third random forest model; The third random forest model is trained using the webshell sample data of the first preset ratio and the real network sample data of the second preset ratio to obtain training results of multiple decision trees; Determining whether the third random forest model has been trained according to the training results of the multiple decision trees and a preset convergence condition; When the training of the third random forest model is completed, the third random forest model is determined as the target random forest model.

6. The method according to claim 5, characterized in that The first preset random forest model includes a first preset decision tree, a second preset decision tree, a third preset decision tree, a fourth preset decision tree and a fifth preset decision tree; the second random forest model includes a first preset decision tree, a second preset decision tree, a third preset decision tree and a fifth preset decision tree.

7. The method according to claim 6, characterized in that The training results of the multiple decision trees include a hit probability corresponding to each decision tree; and determining whether the third random forest model is trained according to the training results of the multiple decision trees and a preset convergence condition includes: For each decision tree in the multiple decision trees, determine a hit rate corresponding to each decision tree according to a hit probability corresponding to each decision tree and a weight corresponding to the hit probability; When the hit rate of each decision tree is greater than or equal to the preset convergence condition corresponding to the decision tree, determining that the training of the third random forest model is completed; When the hit rate of any one of the multiple decision trees is less than a preset convergence condition corresponding to the decision tree, it is determined that the training of the third random forest model is not completed.

8. The method according to claim 7, characterized in that The third random forest model includes a first decision tree, a second decision tree, a third decision tree, a fourth decision tree and a fifth decision tree, wherein the hit probability of the fourth decision tree is obtained by statistically analyzing the training result data; the hit probabilities of the first decision tree, the second decision tree, the third decision tree and the fifth decision tree are determined by the following method: For each of the multiple features of the decision tree, determine the total number of hits of each feature after n trainings, where n is a positive integer greater than 1; Expanding the total hit count of each feature after n trainings to obtain the total hit accuracy corresponding to each feature; Determining the hit accuracy of the decision tree according to the total hit counts and total hit accuracy of the multiple features; According to the hit accuracy of the decision tree and a plurality of preset hit intervals, determining the hit interval in which the hit accuracy of the decision tree lies; The hit probability of the decision tree is determined according to the hit interval in which the hit accuracy of the decision tree lies.

9. A webshell detection device, characterized in that: The device comprises: An acquisition module is used to acquire the data to be detected, wherein the data to be detected includes all commands executed in the whole process of the function call chain; The detection module is used to input the data to be detected into the target random forest model, and detect the data characteristics of different attack stages of the webshell according to the data to be detected through multiple decision trees in the target random forest model to obtain a webshell detection result, wherein the webshell detection result at least includes the attack stage and attack type of the webshell.

10. A webshell detection device, characterized in that: The device comprises: a processor and a memory storing computer program instructions; When the processor executes the computer program instructions, the webshell detection method according to claims 1-8 is implemented.

11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer program instructions, and when the computer program instructions are executed by the processor, the webshell detection method according to claims 1-8 is implemented.

Citation Information

Cited By

  • Alarm feature extraction method for business risk control and related device

    CN120979900A