Method and device for detecting remote command injection attack

By identifying and matching the first character and position in the command line to be detected, the problem of low detection accuracy of remote command injection attacks in the prior art is solved, and recognition and defense of wildcard bypass attacks is realized.

CN118940262APending Publication Date: 2024-11-12BEIJING HUAWEI DIGITAL TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310531764.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-05-11
Publication Date
2024-11-12

AI Technical Summary

Technical Problem

In the prior art, the detection accuracy of remote command injection attacks is low, and the attack commands that are bypassed by wildcards cannot be recognized, resulting in missed and false alarms.

Method used

By obtaining the first character and its position in the command line to be detected, matching with the preset attack detection library, identifying characters that have not been replaced by wildcards, and then RCE attack detection is performed to improve detection accuracy.

Benefits of technology

In the case of wildcard bypass, RCE attacks after wildcard bypass can be identified, which improves the detection accuracy of remote command injection attacks and reduces missed and false alarms.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118940262A_ABST
    Figure CN118940262A_ABST
Patent Text Reader

Abstract

The invention discloses a method and a device for detecting a remote command injection attack, relates to the technical field of computer security, and is used for solving the problem of low detection accuracy of the remote command injection attack. According to the specific scheme, a to-be-detected command line comprising a wildcard character and a first character is obtained, wherein the first character is a character except a separator and the wildcard character; and then, based on the first character in the to-be-detected command line and the position of the first character in the to-be-detected command line, carrying out attack detection in the attack detection library to obtain a detection result, and further determining whether the to-be-detected command line has a remote command injection attack behavior or not based on the detection result. According to the method, under the condition that wildcard bypassing exists, the characters which are not replaced by the wildcard and except the separators in the to-be-detected command line are matched with the attack detection library, so that the detection of the remote command injection attack is realized, the RCE attack after the wildcard bypassing can be identified, and the detection efficiency is improved. And thus, the recognition accuracy of the RCE attack is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of computer security technology, and in particular to a method and device for detecting remote command injection attacks. Background Art

[0002] Remote Command Injection / Remote Code Execution (RCE) attacks are a common method of attack on the World Wide Web (WWW). A RCE attack typically involves an attacker accessing a web service and exploiting a vulnerability in the service to inject an attacking command line into the server. After the server executes the injected command line, the attacker can steal critical information or cause the server to crash.

[0003] To prevent RCE attacks from affecting servers, it's necessary to identify RCE attacks before the server executes the injected command line and block the command line corresponding to the detected RCE attack. Existing techniques typically use manual rule patterns (such as regular expressions) to detect RCE attacks, but this detection method can miss some RCE attacks and has low detection accuracy. Summary of the Invention

[0004] The embodiments of the present application provide a method and device for detecting remote command injection attacks, which solve the problem of low accuracy in detecting RCE attacks.

[0005] According to a first aspect of an embodiment of the present application, a method for detecting a remote command injection attack is provided. A command line to be detected is obtained, including a wildcard and a first character, where the first character refers to a character other than a separator and a wildcard. After obtaining the command line to be detected, the command line to be detected is matched with an attack detection library based on the first character in the command line to be detected and the position of the first character in the command line to be detected, to obtain a detection result. Furthermore, based on the detection result, it is determined whether an RCE attack behavior exists in the command line to be detected.

[0006] Through the above method, in the case of wildcard bypass, by matching the characters other than separators in the command line to be detected that are not replaced by wildcards with the preset attack detection library, RCE attack detection is performed, so that the RCE attack after the wildcard bypass can be identified, thereby improving the recognition accuracy of RCE attacks.

[0007] In an optional embodiment, the characters included in the command line to be detected correspond to a first command; the detection result includes: a first detection result, the first detection result is used to indicate whether the first command is an attack command; when the first detection result is used to indicate that the first command is an attack command, it is determined that the command line to be detected has RCE attack behavior.

[0008] In an optional embodiment, based on multiple first characters included in the command line to be detected and the positions of the multiple first characters in the command line to be detected, RCE attack detection is performed in a preset attack detection library to obtain a detection result, including: determining the first character included in the first command and the position of the first character included in the first command based on the type of each character included in the command line to be detected; matching the first command with the attack detection library based on the first character included in the first command and the position of the first character included in the first command to obtain a first detection result; wherein, if there is a command matching the first command in the attack detection library, the first detection result is used to indicate that the first command is an attack command. In this way, if the command line to be detected includes a command, detection can be performed on the command rather than the entire command line, making detection more efficient.

[0009] In an optional embodiment, the command line to be detected further includes: a separator; based on the type of each character in the characters included in the command line to be detected, determining the first character included in the first command and the position of the first character included in the first command in the first command, including: determining the position of the separator in the command line to be detected in the command line to be detected based on the type of each character in the characters included in the command line to be detected; determining the position of the first command in the command line to be detected based on the position of the separator in the command line to be detected; determining the first character included in the first command and the position of the first character included in the first command in the first command based on the positions of multiple first characters included in the command line to be detected and the position of the first command in the command line to be detected. In this way, the position of each first character in the first command can be conveniently determined based on the separator, so as to facilitate detection.

[0010] In an optional embodiment, the characters included in the command line to be detected also correspond to a first path; the detection result includes a second detection result, the second detection result being used to indicate whether the first path is an attack path; if the first detection result indicates that the first command is an attack command, and / or if the second detection result indicates that the first path is an attack path, the command line to be detected is determined to contain an RCE attack. In this way, if the command to be detected includes a path, the path can be separately detected, which can improve detection efficiency.

[0011] In an optional embodiment, a first path includes multiple second paths, where the second path is a path corresponding to a folder at a level in the first path; based on multiple first characters included in the command line to be detected and the positions of the multiple first characters in the command line to be detected, RCE attack detection is performed in a preset attack detection library to obtain a detection result; the method includes: for each second path in the multiple second paths: determining the position of the first character included in the second path and the first character included in the second path in the second path based on the type of each character included in the command line to be detected; matching the second path with the attack detection library based on the first character included in the second path and the position of the first character included in the second path in the second path to obtain a matching result corresponding to the second path, the matching result corresponding to the second path being used to indicate whether there is a path matching the second path in the attack detection library; determining a second detection result based on the matching result corresponding to each second path in the multiple second paths; wherein, if the matching result corresponding to each second path in the multiple second paths indicates that there is a path matching the second path in the attack detection library, the second detection result is used to indicate that the first path is an attack path. Compared with matching the entire path with the attack path library, this method can improve the matching accuracy.

[0012] In an optional embodiment, the method further includes: obtaining a search score for the first path, the search score being used to indicate the similarity between each second path in the first path and a path in the attack detection library; and determining whether the command line to be detected contains an RCE attack based at least on the detection result, including: determining whether the command line to be detected contains an RCE attack based on the detection result and the search score for the first path; wherein, if the first detection result indicates that the first command is an attack command and / or the second detection result indicates that the first path is an attack path, if the search score for the first path is greater than a threshold, determining that the command line to be detected contains an RCE attack. Determining whether an RCE attack exists based on the search score avoids misdetecting a command line that is not an RCE attack as an RCE attack.

[0013] In an optional embodiment, obtaining the retrieval score of the first path includes: obtaining a first score corresponding to each second path in a plurality of second paths, wherein the first score is a ratio of the number of first characters corresponding to the second path to the number of all characters in a third path, where the third path is a path in the attack detection library that matches the second path; and determining the retrieval score of the first path based on the first score corresponding to each second path in the plurality of second paths.

[0014] In an optional embodiment, the method further includes: determining a first recognition result of whether the command line to be detected includes an injection symbol; and determining whether the command line to be detected is an RCE attack based at least on the detection result, including: determining whether the command line to be detected is an RCE attack based on the detection result and the first recognition result; wherein, when the first detection result indicates that the first command is an attack command and / or the second detection result indicates that the first path is an attack path, if the first recognition result indicates that the command line to be detected includes an injection symbol, determining that the command line to be detected is an RCE attack. Further performing RCE attack detection based on the injection symbol improves detection accuracy.

[0015] In an optional embodiment, the method further includes converting the command line to be detected into a plurality of tuples based on lexical analysis technology, wherein each tuple includes at least one character in the command line to be detected, the type of at least one character, and the position of at least one character in the command line to be detected. This facilitates detection.

[0016] In an optional embodiment, if a command injection attack is determined to exist in the command line to be detected, the method further includes: obtaining and displaying a restoration result of the command line to be detected; wherein, if the characters included in the command line to be detected correspond to a first command, the restoration result includes: a command matching the first command in the attack detection library; if the characters included in the command line to be detected correspond to a first path, the restoration result includes: a path matching the first path in the attack detection library. This can improve the interpretability of the results.

[0017] In an optional embodiment, the method further includes: displaying at least one of the following: a detection result, a result of whether the command line to be detected contains an RCE attack, and a result of identifying whether an injection symbol exists in the command line to be detected. This can improve the interpretability of the results.

[0018] In an optional embodiment, the method further includes: obtaining metadata from the traffic data; parsing the metadata to extract the command line to be detected.

[0019] According to a second aspect of an embodiment of the present application, a device for detecting a remote command injection attack is provided, the device comprising: an acquisition module for acquiring a command line to be detected, the command line to be detected comprising multiple first characters and wildcards, the first characters being characters other than separators and wildcards; a detection module for performing RCE attack detection in a preset attack detection library based on the multiple first characters included in the command line to be detected and the positions of the multiple first characters in the command line to be detected, and obtaining a detection result; a determination module for determining whether the command line to be detected contains an RCE attack based at least on the detection result.

[0020] In an optional embodiment, the characters included in the command line to be detected correspond to a first command; the detection result includes: a first detection result, the first detection result is used to indicate whether the first command is an attack command; when the first detection result is used to indicate that the first command is an attack command, it is determined that an RCE attack exists in the command line to be detected.

[0021] In an optional embodiment, the detection module is specifically used to: determine the first character included in the first command and the position of the first character included in the first command based on the type of each character included in the command line to be detected; match the first command with an attack detection library based on the first character included in the first command and the position of the first character included in the first command to obtain a first detection result; wherein, if there is a command matching the first command in the attack detection library, the first detection result is used to indicate that the first command is an attack command.

[0022] In an optional embodiment, the command line to be detected also includes: a separator; the detection module is specifically used to: determine the position of the separator in the command line to be detected based on the type of each character in the command line to be detected; determine the position of the first command in the command line to be detected based on the position of the separator in the command line to be detected in the command line to be detected; determine the first character included in the first command and the position of the first character included in the first command in the first command based on the positions of multiple first characters included in the command line to be detected and the position of the first command in the command line to be detected.

[0023] In an optional embodiment, the characters included in the command line to be detected also correspond to a first path; the detection result includes: a second detection result, the second detection result is used to indicate whether the first path is an attack path; when the first detection result is used to indicate that the first command is an attack command, and / or the second detection result is used to indicate that the first path is an attack path, it is determined that an RCE attack exists in the command line to be detected.

[0024] In an optional embodiment, the first path includes multiple second paths, and the second path is a path corresponding to a folder at a level in the first path; the detection module is specifically used to: for each second path in the multiple second paths: determine, based on the type of each character in the command line to be detected, the first character included in the second path and the position of the first character included in the second path in the second path; based on the first character included in the second path and the position of the first character included in the second path in the second path, match the second path with the attack detection library to obtain a matching result corresponding to the second path, and the matching result corresponding to the second path is used to indicate whether there is a path matching the second path in the attack detection library; determine a second detection result based on the matching result corresponding to each second path in the multiple second paths; wherein, when the matching results corresponding to each second path in the multiple second paths all indicate that there is a path matching the second path in the attack detection library, the second detection result is used to indicate that the first path is an attack path.

[0025] In an optional embodiment, the acquisition module is further used to obtain a retrieval score of the first path, where the retrieval score is used to indicate the similarity between each second path in the first path and the path in the attack detection library; the determination module is specifically used to determine whether the command line to be detected has an RCE attack based on the detection result and the retrieval score of the first path; wherein, when the first detection result is used to indicate that the first command is an attack command and / or the second detection result is used to indicate that the first path is an attack path, if the retrieval score of the first path is greater than a threshold, it is determined that the command line to be detected has an RCE attack.

[0026] In an optional embodiment, the acquisition module is specifically configured to: obtain a first score corresponding to each second path in a plurality of second paths; the first score is used to indicate a ratio of the number of first characters corresponding to the second path to the number of all characters in a third path, where the third path is a path in the attack detection library that matches the second path; and determine a retrieval score for the first path based on the first score corresponding to each second path in the plurality of second paths.

[0027] In an optional embodiment, the determination module is further used to determine a first recognition result of whether the command line to be detected includes an injection symbol; the determination module is specifically used to determine whether the command line to be detected has an RCE attack based on the detection result and the first recognition result; wherein, when the first detection result is used to indicate that the first command is an attack command and / or the second detection result is used to indicate that the first path is an attack path, if the first recognition result indicates that the command line to be detected includes an injection symbol, it is determined that the command line to be detected has an RCE attack.

[0028] In an optional embodiment, the device further includes a conversion module, which is used to convert the command line to be detected into multiple tuples based on lexical analysis technology; a tuple includes: at least one character in the command line to be detected, the type of at least one character, and the position of at least one character in the command line to be detected.

[0029] In an optional embodiment, when the determination module determines that a command injection attack behavior exists in the command line to be detected, the acquisition module is further used to: obtain and display the restoration result of the command line to be detected; wherein, when the characters included in the command line to be detected correspond to a first command, the restoration result includes: a command in the attack detection library that matches the first command; when the characters included in the command line to be detected correspond to a first path, the restoration result includes: a path in the attack detection library that matches the first path.

[0030] In an optional embodiment, the device further includes: a display module, the display module being configured to display at least one of the following: a detection result, a result of determining whether an RCE attack exists in the command line to be detected, and an identification result of determining whether an injection symbol exists in the command line to be detected.

[0031] In an optional embodiment, the device further includes an extraction module, which is configured to obtain metadata from the traffic data; parse the metadata, and extract the command line to be detected.

[0032] According to a third aspect of an embodiment of the present application, an electronic device is provided, comprising a memory and a processor, wherein the memory is used to store a computer program, and the processor is used to execute the computer program, thereby implementing the method for detecting a remote command injection attack of the first aspect of the embodiment of the present application.

[0033] According to a fourth aspect of an embodiment of the present application, a computer-readable storage medium is provided, on which a computer program is stored. The computer program is used to implement the remote command injection attack detection method of the first aspect of the embodiment of the present application.

[0034] According to the fifth aspect of the embodiments of the present application, a computer program product is provided, including a computer-readable code, or a non-volatile computer-readable storage medium carrying the computer-readable code. When the computer-readable code runs in an electronic device, the processor in the electronic device executes the remote command injection attack detection method of the first aspect of the embodiments of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] Figure 1 A simplified schematic diagram of a system architecture provided in an embodiment of the present application;

[0036] Figure 2 A flowchart of a method for detecting a remote command injection attack provided in an embodiment of the present application;

[0037] Figure 3A Another system framework diagram provided for an embodiment of the present application;

[0038] Figure 3B A flowchart of another method for detecting remote command injection attacks provided in an embodiment of the present application;

[0039] Figure 4A A structural block diagram of a remote command injection attack detection device provided in an embodiment of the present application

[0040] Figure 4B This is a structural block diagram of another remote command injection attack detection device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0041] An RCE attack refers to a remote command injection attack, not a remote code execution attack. Specifically, an attacker can enter and send an attack command line to a server through commands in a web service provided by the server or by exploiting a vulnerability in the web service. The server then executes the attack command line, allowing the attacker to obtain important data stored on the server or cause the server to crash.

[0042] The attack command line is the command line that the attacker enters and wants the server to execute to launch an attack on the server. The attack command line can include the attack command or the attack command and its corresponding parameters. The attack command parameters can be the attack path or other parameters.

[0043] Next, we will take the Linux operating system as an example to illustrate the command line format corresponding to the RCE attack.

[0044] For example, the attacker's input might consist of a single attack command. For example, the attacker might enter "whoami." This command instructs the server to provide (e.g., return) its username to the attacker's client. This command carries no parameters. Because this command could potentially allow the attacker to obtain important server data (the server's own username), it can be considered an attack command.

[0045] For another example, the attacker's input might include attack commands and attack paths. For example, the attacker might enter "cat / etc / passwd." "cat" (which stands for "concatenate," meaning "connect") is a command that instructs a server to provide file contents. This command typically carries parameters, which are the paths to which the server is expected to provide the file contents. For example, " / etc / passed" is the parameter carried by the "cat" command, which is the path to which the server is expected to provide the file contents. In other words, this command instructs the server to provide the contents of the files in the " / etc / passwd" path. Because the "cat" command instructs the server to return critical files, it can be considered an attack command. The " / etc / passwd" path stores basic server information. If the attacker obtains, tampers with, or deletes files in this path, it poses a threat to the server, making this path a suitable attack path.

[0046] For another example, the attacker's input may include attack commands and other parameters besides the attack path. For example, the attacker may enter "ping 127.0.0.0." The "ping" command is generally used to determine network status and typically carries parameters, such as the host name or Internet Protocol (IP) address of the host whose status needs to be determined. Because this command can obtain key information about the host's operating status, it can be considered an attack command.

[0047] In related technologies, there are generally two detection methods for RCE attacks:

[0048] First, use manual rule pattern matching to detect attacks.

[0049] Manual rule pattern recognition of RCE means manually summarizing the rules of the content input by the attacker in the RCE attack. When content that meets the rules is matched, the input content is determined to be an RCE attack.

[0050] Identifying RCE attacks through manual rule patterns can be achieved through regular expressions. Regular expressions describe a string matching pattern and can be used to check whether a string contains a certain character substring, replace matching substrings, or extract matching substrings from a string. Therefore, by setting a regular expression corresponding to RCE attacks, RCE attacks can be identified.

[0051] Second, after parsing the command and parameters (parameters can be paths, etc.) from the command line to be executed on the server, it is determined whether there is an RCE attack based on the preset dangerous command library, thereby determining whether to allow the command line to be executed.

[0052] For example, if the user input is parsed as the command "whoami", then the command is matched with the preset dangerous command library. If a dangerous command identical to the command is matched in the dangerous command library, that is, the command "whoami" is also in the dangerous command library, then it is determined that an RCE attack has occurred and the command is not allowed to be executed.

[0053] While the two aforementioned identification methods can identify RCE attacks, they have the following issues: attackers are flexible and may use various methods to circumvent RCE attack detection. For example, attackers may use wildcard bypasses to bypass RCE attack detection. In such cases, the two aforementioned methods may not be able to identify attacks that use wildcard bypasses.

[0054] Specifically, wildcards were originally a tool that facilitates fuzzy searches for users, but attackers used this tool to rewrite attack command lines to avoid being detected by RCE attack detection methods in related technologies.

[0055] The wildcard characters are listed in Table 1. The first column of Table 1 lists several wildcard characters, the second column explains the meaning of the wildcard characters in the first column, and the third column lists a command line rewritten with the wildcard characters, such as "cat / etc / passwd".

[0056]

[0057] Table 1

[0058] Table 1 shows only one rewriting method. Rewriting methods are, of course, not limited to the examples in the table above. For example, "cat" can also be rewritten as "c*," "c*t," "c?t," "c[adsg]t," and so on. Although each row in Table 1 shows a command line rewritten using only one wildcard character, multiple wildcard characters can be used in practice. For example, " / etc / passwd" can be rewritten as " / et? / pa[adsg]*wd," " / e* / pass??", and so on.

[0059] As can be seen above, due to the wide variety of wildcard characters and their diverse replacement methods, wildcard bypassing and transformation methods are complex, making it impossible to predict how an attacker will use wildcards to bypass them. In other words, it is impossible to predict all possible forms of attack command lines after a wildcard bypass. However, if you want to detect RCE attacks using manual rules or a pre-set library of dangerous commands, you need to obtain all possible forms of attack command lines after a wildcard bypass. Therefore, the two RCE attack detection methods in the related art cannot identify RCE attacks after a wildcard bypass, resulting in low detection accuracy for RCE attacks in the related art.

[0060] In order to solve the above problems, the present application provides a remote command injection attack detection method, which obtains a command line to be detected including a wildcard and a first character, where the first character refers to a character other than a separator and a wildcard. Afterwards, based on the first character in the command line to be detected and the position of the first character in the command line to be detected, an attack detection is performed in an attack detection library to obtain a detection result, and further based on the detection result, it is determined whether the command line to be detected contains a remote command injection attack behavior. Through this method, in the case of a wildcard bypass, the characters other than the separator in the command line to be detected that are not replaced by the wildcard are matched with the attack detection library, thereby realizing the detection of a remote command injection attack, so that the RCE attack after the wildcard bypass can be identified, thereby improving the recognition accuracy of the RCE attack.

[0061] The implementation of the embodiments of the present application will be described in detail below with reference to the accompanying drawings.

[0062] Figure 1 What is shown is a simplified schematic diagram of a system architecture to which the embodiments of the present application can be applied. Figure 1 As shown, the system architecture may include: a server 11 , a client 12 , a detector 13 and a collector 14 .

[0063] The server 11 is a server that provides web services, which is used to provide web services that can be accessed by users. In this embodiment, the server 11 can be a server that an attacker wants to attack. The client 12 is a client used by an attacker or other user accessing a web service, which has the function of accessing a web service. The client 12 is connected to the server 11 in communication, and based on the communication link corresponding to the communication connection, the client 12 can send traffic data corresponding to the command line entered by the user in the web service to the server. After receiving the command line sent by the client 12, the server 11 can execute the received command line. Among them, Figure 1 The line between the client 12 and the server 11 represents a communication link between the two.

[0064] The detector 13 and collector 14 are used to detect whether there is an RCE attack in the command line sent by the client 12 to the server 11 by executing the remote command injection attack detection method provided in the embodiment of the present application. The collector 14 is used to obtain the command line sent by the client 12 to the server 11, and the detector 13 is used to detect whether there is an RCE attack in the command line sent by the client 12 to the server 11.

[0065] As for the deployment positions of the detector 13 and the collector 14, Figure 1 As shown, the detector 13 and collector 14 can be deployed on the communication link between the server 11 and the client 12. Exemplarily, both can be deployed in network devices on the communication link, i.e., both can be deployed in the same device. For example, the collector 14 and detector 13 can be deployed on a firewall, extracting metadata directly from the data received by the firewall and implementing attack detection based on this metadata. In another example, the collector 14 and detector 13 can also be on a device connected to the aforementioned network device (e.g., if there is a server connected to the communication link, the detector 13 can be deployed on this server), and the server obtains metadata via a probe mounted next to the network device. In another example, both can be deployed in different devices. For example, the detector 13 can be deployed on a device connected to the aforementioned communication link (e.g., a big data platform connected to the communication link), while the collector 14 can be deployed in a network device on the communication link (e.g., a firewall). In another example, the detector 13 can be deployed on the big data platform, while the collector 14 can be deployed on a device other than the big data platform connected to the aforementioned communication link. The big data platform is a network platform for data analysis. The big data platform can analyze the acquired data, for example, it can analyze and detect whether there is an RCE attack on the metadata. This application does not limit the deployment location of the collector 14 and the detector 13.

[0066] In addition to being deployed on big data platforms, the detector 13 can also be deployed on devices or products such as perimeter protection cloud services and application programming interface (API) security. Deploying on perimeter protection cloud services and API security devices can improve device security and prevent RCE attacks from affecting normal device operation.

[0067] in, Figure 1 The connection line between the detector 13, the collector 14 and the communication link represents the direction of data processing, that is, the collector 14 obtains data including the command line to be detected from the communication link and sends the obtained data to the detector 13, so that the detector 13 can detect whether there is an RCE attack in the data obtained by the collector 14.

[0068] When the collector 14 is deployed on the communication link between the client 12 and the server 11, the collector 14 obtains traffic data (or network data stream) from the network device on the communication link and extracts metadata from the traffic data. For example, when the collector 14 is deployed on the network device itself, the above process means that the collector 14 directly extracts metadata from the traffic data received from the network device.

[0069] Metadata generally includes the request message header, request message body, and Uniform Resource Locator (URL). In some cases, metadata also includes the response message header and response message body.

[0070] As an example, the metadata may be in the following form:

[0071] "6^9cb75ecb2c12000e01000000^11.0.0.13^12.0.0.14^22202^80^6^614^3^1460^3^1590373394^1590373394^^^^^^^^^^^^HTTP^*HTTP^Networ k^Infrestructure^POST^12.0.0.14^200^text / html; charset=utf-8^http: / / 12.0.0.14 / dvwa / vulnerabilities / exec / ^Mozilla / 5.0(Windows NT 10.0;Win64;x64;rv:66.0)Gecko / 20100101

[0072] Firefox / 66.0^http: / / 12.0.0.14 / dvwa / vulnerabilities / exec /

[0073] ^11^11^HTTP / 1.1^HTTP / 1.1^^^^^^^^^^^^^^^^^^^^^^1590373394312^^^^^US^^- 95.71^37.09^US^^-95.71^37.09^^^^^2020-05-25T02:23:14.312^^614^352^^^^^^

[0074] 26;51;1;4;3;40;21;14;9;19;Upgrade-Insecure-Requests*Upgrade-Insecure-Requests:1^TCP^^^^^^^11.0.0.13^12.0.0.14^^^^^^^^^SG9zdDogMTIuMC4wLjE0DQpVc2VyLUFnZ W50OiBNb3ppbGxhLzUuMCAoV21uZG93cyBOVCAxMC4wOyBXaW42NDsgeDYOOyBy djo2Ni4wKSBHZWNrby8yMDEwMDEwMSBGaXJlZm94LzY2LjANCkFjY2VwdDogdGV4dC9odGlsLGFwcGxpY2F0aW9uL3hodGlsK3htbCxhcHBsaWNhdGlvbi94bWw7cT0wLjksKi8qO3E9MC44DQpBY2NlcHQtTGFuZ3VhZ2U6lHpoLUN0LHpo03E9MC44LHpoLVRX03E9MC43LHpoLUhL03E9MC41LGVuLWT03E9MC4zLGVuO3E9MC4yDQpBY2NlcHQtRW5jb2Rpbmc6lGd6aXAsIGRlZmxhdGUNCUlZmVyZXl6lGh0dHA6Ly8xMi4wLjAuMTQvZHZ 3YS92dWxuZXJhYmlsaXRpZXMvZXhlYySNCkNvbnRlbnQtVHlwZTogYXBwbGljYXRpb24veC13d3ctZm9ybSllcmxlbmNvZGVkDQpDb250ZW50LUxlbmd0aDogNDANCkNvbm51Y3Rpb246lGtlZXAtYWxpdmUNCkNvb2tpZTogc2VjdXJpdHk9bG930yBQSFBTRVNTSUQ9Y3NwcDVwNmRjYzg4ajJrMW9iODRpbW12a2UNClVwZ3JhZGUtSW5zZWNlcmUtUmVx dWVzdHM6lDENCg0K*aXA9MTl3LjAuMC4xKyUyNiUyNit3aG9hbWkmU3VibW10PVNl YmlpdA==*RGFOZTogU2FOLCAwOSBNYXkgMjAyMCAwNjoyNTolOSBHTVQNClNlcnZlcjogQXBhY2hlLzIuNC4zNyAoRGViaWFuKQ0KRXhwaXJlczogVHVlLCAyMyBKdW4g MjAwOSAxMjowMDowMCBHTVQNCkNhY2hlLUNvbnRyb2w6lG5vLWNhY2hlLCBtdXN 0LXJldmFsaWRhdGUNClByYWdtYTogbm8tY2FjaGUNClZhcnk6lEFjY2VwdClFbmNvZGl uZwOKQ29udGVudClFbmNvZGluZzogZ3ppcA0KQ29udGVudClMZW5ndGg6lDElNTENCktlZXAtQWxpdmU6lHRpbWVvdXQ9NSwgbWF4PTEWMA0KQ29ubmVjdGlvbjogS2VlcCl BbG12ZQ0KQ29udGVudClUeXB10iBOZXhOL2hObWw7Y2hhcnNldDlldGYtOAOKDQo=^DQo8lURPQlRZUEUgaHRtbCBQVUJMSUMgliOvLlczQy8vRFREIFhIVElMIDEuMCBTdH JpY3QvLOVOliAiaHROcDovL3d3dy53My5vcmcvVFIveGh0bWwxL0RURC94aHRtbDEtc3RyaWN0LmR0ZCI+DQoNCjxodGlsIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3h odGlsIj4NCg0KCTxoZWFkPg0KCQk8bWV0YSBodHRwLWVxdW12PSJDb250ZW50LVR5cGUiIGNvbnRlbnQ9lnRleHQvaHRtbDsgY2hhcnNldDlWEYtOCIgLz4NCgOKCQk8dG10bG U+VnVsbmVyYWJpbG10eTogQ29tbWFuZCBJbmplY3Rpb24gOjogRGFtbiBWdWxuZXJhY mxlIFdlYiBBcHBsaWNhdGlvbiAoRFZXQSkgdjEuMTAgKkRldmVsb3BtZW50KjwvdGlOb GU+DQoNCgkJPGxpbmsgcmVsPSJzdHlsZXNoZWVO^^^^”

[0075] After the collector 14 obtains the metadata, it can first parse the metadata according to the metadata format to extract information such as the URL, request message header, and request message body. For example, the metadata in the above example can extract the following information:

[0076] ①Application protocol: HTTP.

[0077] ②Operation type: POST.

[0078] ③Request URL: http: / / 12.0.0.14 / dvwa / vulnerabilities / exec / .

[0079] ④Request message header:

[0080] SG9zdDogMTIuMC4wLjE0DQpVc2VyLUFnZW50OiBNb3ppbGxhLzUuMCAoV2luZG 93cyBOVCAxMC4wOyBXaW42NDsgeDY0OyBydjo2Ni4wKSBHZWNrby8yMDEwMDEw MSBGaXJlZm94LzY2LjANCkFjY2VwdDogdGV4dC9odG1sLGFwcGxpY2F0aW9uL3hodG1sK3htbCxhcHBsaWNhdGlvbi94bWw7cT 0wLjksKi8qO3E9MC44DQpBY2NlcHQtTGFuZ3VhZ2U6IHpoLUNOLHpoO3E9MC44LHpoLVRXO3E9MC43LHpoLUhLO3E9MC41LGVuL VVTO3E9MC4zLGVuO3E9MC4yDQpBY2NlcHQtRW5jb2Rpbmc6IGd6aXAsIGRlZmxhdG UNClJlZmVyZXI6IGh0dHA6Ly8xMi4wLjAuMTQvZHZ3YS92dWxuZXJhYmlsaXRpZXMv ZXhlYy8NCkNvbnRlbnQtVHlwZTogYXBwbGljYXRpb24veC13d3ctZm9ybS11cmxlbmNvZ GVkDQpDb250ZW50LUxlbm

[0081] ⑤Request message body:

[0082] aXA9MTI3LjAuMC4xKyUyNiUyNit3aG9hbWkmU3VibWl0PVN1Ym1pdA==

[0083] ⑥Response message header:

[0084] RGF0ZTogU2F0LCAwOSBNYXkgMjAyMCAwNjoyNTo1OSBHTVQNClNlcnZlcjogQ XBhY2hlLzIuNC4zNyAoRGViaWFuKQ0KRXhwaXJlczogVHVlLCAyMyBKdW4gMjAwOS AxMjowMDowMCBHTVQNCkNhY2hlLUNvbnRyb2w6IG5vLWNhY2hlLCBtdXN0LXJldm FsaWRhdGUNClByYWdtYTogbm8tY2FjaGUNClZhcnk6IEFjY2VwdC1FbmNvZGluZw0KQ 29udGVudC1FbmNvZGluZzogZ3ppcA0KQ29udGVudC1MZW5ndGg6IDE1NTENCktlZXAt QWxpdmU6IHRpbWVvdXQ9NSwgbWF4PTEwMA0KQ29ubmVjdGlvbjogS2VlcC1BbGl2Z Q0KQ29udGVudC1UeXBlOiB0ZXh0L2h0bWw7Y2hhcnNldD11dGYtOA0KDQo=

[0085] ⑦ response report:

[0086] DQo8IURPQ1RZUEUgaHRtbCBQVUJMSUMgIi0vL1czQy8vRFREIFhIVE1MIDEuMC BTdHJpY3QvL0VOIiAiaHR0cDovL3d3dy53My5vcmcvVFIveGh0bWwxL0RURC94aHRtbDEtc3RyaWN0LmR0ZCI+DQoNCjxodG1sIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8xO Tk5L3hodG1sIj4NCg0KCTxoZWFkPg0KCQk8bWV0YSBodHRwLWVxdWl2PSJDb250ZW50LVR5cGUiIGNvbnRlbnQ9InRleHQvaHRtbDsgY2hhcnNldD1VVEYtOCIgLz4NCg0KCQk8d Gl0bGU+VnVsbmVyYWJpbGl0eTogQ29tbWFuZCBJbmplY3Rpb24gOjogRGFtbiBWdWxuZ Gl0bGU+DQoNCgkJPGxpbmsgcmVsPSJzdHlsZXNoZWV0

[0087] Since the command line entered by the user may be in any of the request headers, request body, response headers, or response body, after obtaining this data, it is necessary to further parse it to extract the payload. The payload is the command line entered by the user in the client that the server needs to execute. The specific method for parsing the payload can be found in the description of related technologies and will not be elaborated here.

[0088] The step of parsing the payload from the metadata may be performed by the detector 13 or the collector 14 .

[0089] In other words, before performing RCE attack detection, it is necessary to obtain metadata from the traffic data and parse the metadata to extract the command line to be detected.

[0090] It should be noted that in some embodiments, the payload can be directly used as the command line to be detected. In other embodiments, the user input may include information that does not need to be detected. For example, it may include some parts that are clearly not attack command lines. Therefore, after parsing the payload, the part required for RCE attack detection can be first obtained from the payload and used as the command line to be detected.

[0091] For example, in the metadata example above, the payload is within the request body. By performing base64 decoding and URL decoding on the metadata, the payload can be parsed as "ip=127.0.0.1+&&+whoami&Submit=Submit." "ip=127.0.0.1" is the IP address, "Submit" is the form submission command, and "&" and "&&" are logical AND operators. These contents do not contain attack commands or attack paths, and therefore do not require RCE attack detection. Therefore, only the "whoami" portion of the payload can be extracted as the command line to be detected.

[0092] In addition, before obtaining the command line to be detected, it is also possible to detect whether the payload or the part of the payload that needs to be detected for RCE attack includes wildcards. Since wildcards are usually some special symbols (see Table 1 above for details), it is possible to detect whether the above content includes these special symbols, such as detecting whether the above content contains symbols such as "*", "?", "{", "}", "[", "]". In this way, the payload that does not contain wildcards can be detected according to the method in the relevant technology, and the payload that contains wildcards can be detected by the method provided in the embodiment of the present application to achieve more targeted detection.

[0093] In addition, in addition to being deployed on the communication link between the client 12 and the server 11, the detector 13 and the collector 14 can also be deployed in the client 12 or the server 11. In this case, the deployment locations of the detector 13 and the collector 14 can be the same or different, for example, both are deployed in the client 12, or both are deployed in the server 11. For example, the collector 14 can be deployed in the client 12 or the server 11, while the detector 13 is deployed in another server (such as a big data platform). In the above case, the collector 14 can obtain the command line to be detected from the data packet sent by the client 12 or the data packet received by the server 11.

[0094] The collector 14 can also directly obtain the command line to be detected from the client 12 and the server 13. For example, when the collector 14 is deployed in the server 11, the collector 14 can scan the file on the server 11. The command line to be executed by the server 11 (that is, the payload extracted from the metadata) is stored in the file. The collector 14 can obtain the command line to be detected from the scanned file and use the command line to be executed as the command line to be detected. When the collector 14 is deployed in the client 12, the collector 14 can also scan the file. The command line to be sent by the client 12 to the server 11 (that is, the payload extracted from the metadata) is stored in the file. The collector can obtain the command line to be detected from the scanned file.

[0095] like Figure 1 As shown, the system may further include a display device 15. The display device 15 may be used to display the RCE attack detection results for the command line to be detected. The specific detection content will be described below and will not be repeated here. The display device 15 may be deployed at any location that can receive data sent by the detector 13. For example, if the detector 13 is a big data platform, the display device 15 may be deployed on a terminal of a user using the big data platform. The embodiment of the present application does not limit the deployment location of the display device 15. Figure 1 The arrow from the detector 13 to the display device 15 shown in FIG. 1 represents that the detector 13 sends the detection result to the display device 15 for display.

[0096] After describing the possible system structure of the embodiment of the present application, Figure 2 The detection method of remote command injection attack provided by the embodiment of the present application is described. Figure 2 As shown, the method includes the following steps:

[0097] Step 201: Obtain the command line to be detected.

[0098] The command line to be detected includes a first character and a wildcard, and the first character is a character other than a separator and a wildcard.

[0099] The command line to be detected is the command line to be executed by the server, and can also be understood as the part of the command line sent by the client to the server that needs to be detected for RCE attacks. The command line to be detected includes multiple characters. In some embodiments, some of the multiple characters can constitute a command, and another part of the multiple characters can constitute a parameter (such as a path). In other embodiments, the command line to be detected can also only include commands composed of characters. Exemplarily, taking the example that the characters included in the command line to be detected correspond to commands and paths, the command line to be detected can be "c*t / e[twcypa]* / pass*".

[0100] For the convenience of description below, the command corresponding to the characters included in the command line to be detected is referred to as the command included in the command line to be detected, and the parameters corresponding to the characters included in the command line to be detected are referred to as the parameters included in the command line to be detected.

[0101] The object of the RCE attack detection targeted by this application is a command line that includes wildcards. In the case of an RCE attack that is bypassed by wildcards, the command line includes wildcards and content that is not replaced by wildcards. The content in the command and parameters of the command line that is not replaced by wildcards is referred to as the first character in this embodiment. In conjunction with the above example, in "c*t / e[twcypa]* / pass*", "*" and "[twcypa]" are wildcards, and "c", "t", "e" and "pass" are the first characters. On the other hand, the first character can also be understood as a letter, a number, and a symbol other than a separator and a wildcard, that is, a character that may appear in a command line, such as a command or a path.

[0102] The meaning of wildcard characters is as described above and is not further explained here. Separators are symbols that separate commands or commands from parameters. Separators can include spaces, "|," "&," and "&&." Spaces are used to separate commands from parameters. Symbols such as |, &, and && are logical operators between commands and can be used to separate commands.

[0103] For example, the command line to be tested is "ping 127.0.0.0|cat / et{a,c} / pass[abcw]d". The "|" character separates the "ping" and "cat" commands, and a space separates commands from their parameters. For example, the space after "ping" separates the command "ping" from the parameter "127.0.0.0", and the space after "cat" separates the command "cat" from the path " / et{a,c} / pass[abcw]d".

[0104] Step 202 : Based on the multiple first characters included in the command line to be detected and the positions of the multiple first characters in the command line to be detected, perform RCE attack detection in a preset attack detection library to obtain a detection result.

[0105] Step 203: Determine whether the command line to be detected contains an RCE attack based at least on the detection result.

[0106] In some embodiments, the preset attack detection library can be a detection library that stores command lines for RCE attacks that have not been replaced by wildcards, which can be stored in the form of a file. The attack detection library can be similar to the dangerous command library in the related art. When the attack detection library includes command lines corresponding to RCE attacks, step 202 is to match the characters in the command line to be detected that have not been replaced by wildcards with each command line in the attack detection library.

[0107] For example, consider the command line to be detected as "c*t / e[twcypa]* / pass*," where "c*t" is the command and " / e[twcypa]* / pass*" is the path corresponding to the command. "c," "t," "e," and "pass" are the first characters, with "c" being the first character of the command, "t" being the last character of the command, "e" being the first character of the first-level folder in the path, and "pass" being the first four characters of the second-level folder in the path. Step 202 can specifically be performed by performing the following match in the attack detection library: searching the attack detection library for a command line in which "c" is the first character of the command, "t" is the last character of the command, "e" is the first character of the first-level folder in the path, and "pass" is the first four characters of the second-level folder in the path. If a command line meeting these conditions is found in the attack detection library, then step 203 can determine that an RCE attack has occurred.

[0108] In other embodiments, the aforementioned preset attack detection library may further include an attack command library and an attack path library. The attack command library may be a detection library that stores commands for RCE attacks that have not been replaced by wildcards. The contents stored in the attack command library may be referred to as attack commands. The attack path library may be a detection library that stores paths for RCE attacks that have not been replaced by wildcards. The contents stored in the attack path library may be referred to as attack paths. In this embodiment, the commands and paths included in the command line to be detected may be first determined. In step 202, the command included in the command line to be detected may be tested in the attack command library to determine whether the command is susceptible to an RCE attack. The path included in the command line to be detected may be tested in the attack path library to determine whether the path is susceptible to an RCE attack. Based on the above two detection results, it is then determined whether the command line to be detected contains an RCE attack.

[0109] Since the parameters corresponding to the attack commands are diverse, the combination of attack commands and attack paths also becomes diverse, which results in a large number of attack command lines. In the above method, RCE attack detection is performed separately for commands and paths, which can reduce the space occupied by the attack detection library, and can also improve the detection speed and efficiency.

[0110] It should be noted that since a command line may only include a command, or a command and other parameters besides a path, in this case, only the command in the command line to be tested can be tested, that is, to determine whether the command included in the command line to be tested is an attack command. If the command included in the command line to be tested is an attack command, then it is determined that the command line to be tested has an RCE attack; otherwise, it is determined that the command line to be tested does not have an RCE attack.

[0111] In the case of performing RCE attack detection on commands and paths respectively, the specific implementation of step 202 and step 203 will be described in the specific embodiment below and will not be described in detail here.

[0112] In addition, when an RCE attack is detected, the command line to be detected can be blocked to ensure the security of the server. Figure 1 As shown, if detector 13 is deployed on client 12, client 12 may not send the command line to be detected to server 11. If detector 13 is deployed on the communication link between client 12 and server 11, detector 13 may block the transmission of metadata corresponding to the command line to be detected. If detector 13 is deployed on server 11, the server may not execute the command line to be detected.

[0113] In the method provided in the embodiment of the present application, in the case of wildcard bypass, only the first character that is not replaced by the wildcard is used for incomplete matching, so that the command line including the wildcard can be detected to see if there is an RCE attack, thereby improving the accuracy of RCE attack detection.

[0114] Next, a method for detecting a remote command injection attack provided by an embodiment of the present application will be described through a specific embodiment.

[0115] Combine Figure 1 , see Figure 3A , Figure 3A The system framework diagram of this specific embodiment is shown in FIG, including a big data platform 31, a collector 14 and a display device 15. The big data platform 31 also corresponds to Figure 1 Detector 13 in.

[0116] Figure 3AIn the process, the collector 14 collects the traffic data, extracts the files for the traffic data, extracts the metadata, and sends the metadata to the big data platform 31. After receiving the metadata, the big data platform 31 parses the metadata to obtain the payload. For example, the payload obtained may be "| / * / b* / cat / e[twcypa]* / pass*", which is the command line to be detected mentioned above. The big data platform 31 then performs semantic restoration on the payload, and then obtains and outputs the detection result of whether the payload has an RCE attack, as well as the semantic restoration result. Figure 3A As shown, the big data platform 31 can send the test results to the display device 15 so that the display device 15 can display the test results. The specific content of the displayed test results will be explained in the subsequent related steps and will not be repeated here.

[0117] The attack detection library can be imported into the big data platform 31 via file import. For example, the attack detection library includes an attack command library and an attack path library. The attack command library and attack path library can be imported into the big data platform 31 via file import. The attack command library and attack path library can participate in the semantic restoration process described above. The attack command library imported as a file includes complete attack commands, such as "whoami" and "cat." The attack path library imported as a file includes complete attack paths, such as " / etc / passwd" and " / apache / logs."

[0118] The following combination Figure 3B The specific embodiments are described in detail. Figure 3B As shown, the specific embodiment provided in this application includes the following steps:

[0119] In step 301, the collector obtains metadata from traffic data and extracts information such as URL, request header, and request body from the metadata.

[0120] In step 302, the collector sends the extracted URL, request header, request body and other information to the big data platform.

[0121] In step 311, the big data platform extracts the payload from the received URL, request header, request body and other information.

[0122] It should be noted that the specific implementation of step 301, step 302 and step 311 is detailed in Figure 1 The description part will not be repeated here.

[0123] The payload is the command line to be detected. The following will be explained with the payload "| / * / b* / cat / e[twcypa]* / pass*" as an example. The payload includes the command to be detected " / * / b* / cat" and the path to be detected " / e[twcypa]* / pass*". Among them, the command to be detected can be the first command in this application, and the path to be detected can be the first path in this application.

[0124] It should be noted that the payload can also include only commands, that is, the command line to be detected can include only commands or other forms. Here, the example of a payload including commands and paths is used. The processing methods for other forms of payloads are similar and will not be repeated here.

[0125] In step 312, the big data platform converts the payload into multiple tuples based on lexical analysis technology.

[0126] In some embodiments of the present application, a tuple may include: at least one character in the payload, the type of the at least one character, and the position of the at least one character in the payload.

[0127] The type of the character may be predefined. Specifically, different types may be defined for different characters, or multiple different characters may be classified into one category and correspond to the same type. This embodiment does not impose any specific limitation on this.

[0128] In some embodiments of the present application, the above types can be used to characterize whether at least one character is the first character, a wildcard or a separator, that is, the above types can include: the first character, the wildcard and the separator. In this embodiment, all characters except wildcards and separators are classified into one category, which is the first character. As described above, the above types can also include other types. For example, the type corresponding to the first character can be divided into a more fine-grained type. The character " / " included in the path can be regarded as a separate type, which is referred to as the first type here. The characters other than " / " in the first character can be divided into another type, which is referred to as the second type here. The first type and the second type can be other types that are different from the above-mentioned first character, wildcard and separator. The smaller the character classification granularity, the higher the accuracy of subsequent identification of whether the command / path in the command line to be detected has an RCE attack. For example, in the above example, the type of the character " / " is defined as the first type that is different from the above-mentioned first character, wildcard and separator, rather than defining its type as the first character. This can facilitate the subsequent division of the path to be detected into multiple levels of sub-paths, and then each sub-path can be compared separately, which can make matching more convenient and improve matching accuracy.

[0129] Among them, the above-mentioned tuple includes three elements: character, type and position, and the tuple can be called a triple. However, in this embodiment, the triple is only an example. In some other embodiments, the tuple can also be a binary tuple. For example, a tuple includes two elements: character and type, and the tuple can be called a bigram. In this embodiment, the position of the characters included in a bigram in the payload can be determined based on the sorting of the tuple. In some other embodiments, the tuple can also be a quadruple, a quintuple, etc., for example, the tuple can also include other data that helps with semantic analysis.

[0130] Lexical analysis, also known as word segmentation, breaks the payload into multiple groups of characters. The characters in each group must be of the same type. In other words, the same group cannot contain characters of different types.

[0131] Step 312 can be implemented by breaking the payload into a stream of tokens, where multiple tuples are referred to as token streams. The token stream can be generated by extracting it using a lexical analyzer such as an abstract syntax tree or state machine, or by pattern matching, or by manual customization. This application does not limit the method for generating the token stream.

[0132] Continuing with the payload of “| / * / b* / cat / e[twcypa]* / pass*” as an example, the token stream obtained by disassembly can be specifically: “[('|',20,0),(' / ',7,1),('*',9,2),(' / ',7,3),('b',0,4),('*',9,5),(' / ',7,6),('cat',0,7),(”,23,8),(' / ',7,9),('e',0,10),('[twcypa]',4,11),('*',9,12),(' / ',7,13),('pass',0,14),('*',9,15)]”.

[0133] Among them, the data in each parenthesis represents a tuple. The first digit of the tuple is the character obtained from the payload, the second digit is the type of the character obtained from the disassembly, and the third digit is the position of the character obtained from the disassembly in the payload. For the type of the characters obtained from the disassembly in the above example, 0 represents the type of characters other than spaces, separators, " / " and wildcards, and 20 represents the type of separator "|", which is used to represent the OR logic of two command executions. 7 represents the type of " / ", which is the symbol that separates different levels of folders in the path to be detected, 9 represents the type of the wildcard "*", 23 represents the type of space, and 4 represents the type of wildcard "[twcypa]".

[0134] In the above example, different types are set for different wildcards, which makes it easier to determine the position of the first character in the command line to be detected. For example, in the case where the command to be detected is "c?t", if the types of different wildcards are not distinguished, then the above tuple will not be able to determine which type of wildcard the wildcard in the command to be detected is, and thus it is unknown how many characters the wildcard replaces. In this way, it can only be determined that "c" is in the first position and "t" is in the last position in the command, but the specific position of "t" in the command to be detected cannot be determined. However, if the types of different wildcards are distinguished, it can be determined that the wildcard in the command to be detected is a wildcard of the type "?", and thus it can be determined that the wildcard replaces 1 character, and thus it can be determined that "c" is in the first position in the command to be detected and "t" is in the last position in the command to be detected. In this way, the accuracy of the subsequent matching process can be improved.

[0135] Furthermore, for characters in the payload that aren't replaced by wildcards, if there are multiple consecutive characters, these characters can be included as a whole in a tuple. This improves search efficiency during subsequent matching compared to matching character by character. Furthermore, for wildcards that require multiple characters to represent them, these characters can be included in a tuple when the token stream is decomposed for easier matching.

[0136] It should be noted that the conversion of the payload into a token stream is intended to facilitate the subsequent determination of the first character in the payload and its position within the command or path. In other words, determining the first character in the payload and its position within the command or path using the converted token stream is only one implementation method. In another possible implementation method, the payload can be directly identified to determine the first character in the payload and its position within the command or path.

[0137] In step 313, the big data platform determines the commands to be detected and the paths to be detected included in the payload, and performs RCE attack detection on the commands to be detected in the attack command library and performs RCE attack detection on the paths to be detected in the attack path library.

[0138] Through step 313 , a first detection result of whether the command to be detected is an attack command and a second detection result of whether the path to be detected is an attack path can be obtained.

[0139] As an example, performing RCE attack detection on a command to be detected in the attack command library may specifically include the following process:

[0140] First, based on the type of each character in the payload, the first character included in the command to be detected and the position of the first character included in the command to be detected in the command to be detected are determined.

[0141] In some embodiments, taking the case where the character types include wildcards, first characters, and separators, the command to be detected in the payload can be determined based on the type of each character in the payload, and then the first character can be determined from the command to be detected, and the position of the first character in the command to be detected can be determined based on the order of each character in the command to be detected.

[0142] In other embodiments, when the payload is converted into a token stream, the first character of the command to be detected and the position of the first character in the command to be detected can be determined based on the type of characters included in each of the multiple tuples included in the obtained token stream. The specific determination method will be described in detail below and is not detailed here.

[0143] Afterwards, based on the first character included in the command to be detected and the position of the first character included in the command to be detected in the command to be detected, the command to be detected is matched with an attack detection library including an attack command library to obtain a first detection result.

[0144] If a command matching the command to be detected exists in the attack detection library, such as if a command matching the command to be detected exists in the attack command library, the first detection result indicates that the command to be detected is an attack command. For example, if the command to be detected is "c?t," it can be determined that the command to be detected "c?t" includes the first characters "c" and "t," and that the character "c" is the first character in the command to be detected, and the character "t" is the last character in the command to be detected. Furthermore, based on the meaning of the wildcard "?", it can be determined that the command to be detected is three characters long. Then, a command that meets the conditions of three characters, with the first character being "c" and the last character being "t" can be matched in the attack command library. If a command meeting these conditions is found in the attack command library, the command to be detected "c?t" can be determined to be an attack command. Otherwise, the command to be detected "c?t" is determined not to be an attack command. For example, if the commands "cat" and "cut" meeting these conditions are found in the attack command library, the command to be detected "c?t" can be determined to be an attack command.

[0145] As an example, performing RCE attack detection on a path to be detected in the attack path library may specifically include the following process:

[0146] Generally speaking, the path to be detected may include multiple levels of paths. For the convenience of description, the path corresponding to a folder at one level in the path to be detected will be referred to as a sub-path to be detected in the following text. The sub-path to be detected may be the second path in this application. Continuing with the example of the path to be detected being " / e[twcypa]* / pass*", it can be seen from the separation of the " / " symbol that the path to be detected includes two sub-paths to be detected, namely "e[twcypa]*" and "pass*". Based on this, the following describes the implementation of determining whether the path to be detected is an attack path.

[0147] First, for each of the multiple subpaths to be detected, based on the type of each character in the payload, determine the first character included in the subpath to be detected and the position of the first character included in the subpath to be detected in the subpath to be detected.

[0148] For each subpath to be detected, based on the first character in the subpath to be detected and the position of the first character in the subpath to be detected within the subpath to be detected, the subpath to be detected is matched against an attack detection library including an attack path library to obtain a matching result corresponding to the subpath to be detected. The matching result indicates whether there is a path in the attack detection library that matches the subpath to be detected.

[0149] It should be noted that the specific implementation of determining the first character of the sub-path to be detected and the position of the first character of the sub-path to be detected in the sub-path to be detected is similar to the specific implementation of determining the first character of the command to be detected and the position of the first character of the command to be detected in the command to be detected, and will not be repeated here.

[0150] If a folder at a certain level in the attack path library matches the sub-path to be detected, then a path matching the sub-path to be detected can be determined. Continuing with the above example, for "e[twcypa]*," taking " / etc / passwd" as an example, it can be understood that if the first-level folder "etc" in the path matches "e[twcypa]*," then a path matching the sub-path to be detected can be determined. The specific matching method is similar to the method for matching the command to be detected above and will not be repeated here.

[0151] Secondly, based on the matching results corresponding to each of the multiple sub-paths to be detected, a second detection result is determined, that is, whether the path to be detected is an attack path.

[0152] In which case, when the matching results corresponding to each of the multiple sub-paths to be detected indicate that there is a path matching the sub-path to be detected in the attack detection library, the second detection result is used to indicate that the first path is an attack path.

[0153] In other words, if each sub-path to be detected has a matching attack path in the attack path library, the path to be detected is determined to be an attack path. If any sub-path to be detected does not match an attack path in the attack path library, the path to be detected is determined not to be an attack path.

[0154] It should be noted that the above embodiments determine whether the path to be detected is an attack path based on the matching results of the multiple sub-paths to be detected after determining the matching results for each sub-path to be detected within the path to be detected. In other embodiments, one sub-path to be detected within the path to be detected may be detected first to determine whether an attack path matching the sub-path to be detected exists in the attack path library. If not, there is no need to continue attack path matching for the remaining sub-paths to be detected, and the path to be detected can be determined to be non-attack path. If there is an attack path matching the sub-path to be detected, the attack path in the attack path library that includes the sub-path to be detected can be used as a second attack path library, and attack path matching can be performed for the remaining sub-paths to be detected within the path to be detected in the second attack path library. If an attack path matching the remaining sub-paths to be detected exists in the second attack path library, detection continues using the above method. If no attack path matching the remaining sub-paths to be detected exists in the second attack path library, there is no need to continue detection, and the path to be detected can be determined to be non-attack path. This allows for rapid elimination of sub-paths to be detected that are not attack paths, improving detection efficiency.

[0155] To improve matching accuracy, if each sub-path to be detected has a matching attack path in the attack path library, it is possible to further determine whether the paths matching each sub-path to be detected are the same path. If the paths matching each sub-path to be detected are the same path, the path to be detected is determined to be an attack path; otherwise, it is determined that the path to be detected is not an attack path. This allows for more accurate identification of whether the path to be detected is an attack path and prevents paths that are not attack paths from being mistakenly detected as attack paths. For example, if the attack path library includes " / usr / bin" and " / etc / passwd", if the path to be detected is " / etc / bin", this prevents " / etc / bin" from being mistakenly identified as an attack path.

[0156] Furthermore, in the above embodiment, attack paths are matched against multiple sub-paths to be detected in the attack path library. To measure the overall matching of the path to be detected, in this embodiment, a search score for the path to be detected is also obtained. This search score indicates the similarity between each sub-path to be detected in the path to be detected and the paths in the attack path library. The search score can be used to describe the degree of match between the path to be detected and the attack path library.

[0157] As an example, the retrieval score of the path to be detected can be obtained through the following process.

[0158] First, a first score corresponding to each subpath to be detected can be obtained. This first score is used to represent the degree of similarity between the subpath to be detected and the matching path in the attack path library. In other words, the first score is used to represent the ratio of the number of first characters corresponding to the subpath to be detected to the total number of characters in the attack path. The attack path is the path in the attack path library that matches the subpath to be detected. The attack path that matches the subpath to be detected can be the third path in this application.

[0159] After obtaining the first scores corresponding to each sub-path to be detected, a search score for the path to be detected can be determined based on the first scores corresponding to the multiple sub-paths to be detected. For example, an average of the first scores of the sub-paths to be detected can be determined and used as the search score for the path to be detected. This example does not limit the embodiments of the present application.

[0160] Continuing with the above example, let's take the path " / etc / passwd" in the attack path library that matches " / e[twcypa]* / pass*" as an example. For the sub-path "e[twcypa]*" to be detected, its first character is "e", the number of characters of the first character is 1, and the number of characters in the attack path "etc" is 3. Correspondingly, the first score of "e[twcypa]*" is the ratio of 1 to 3, which is 1 / 3. Similarly, in the sub-path "pass*" to be detected, the first character is "pass", the number of characters is 4, and the number of characters in the attack path "passwd" is 4, then the first score of "pass*" is 4 / 6. Afterwards, it can be determined that the average value of the two sub-paths to be detected is 0.5, so it can be determined that the retrieval score of " / e[twcypa]* / pass*" is 0.5.

[0161] The above example illustrates RCE attack detection by dividing the path to be detected into multiple sub-paths. In other embodiments, the path to be detected can be considered as a whole for RCE attack detection. Continuing with the above example, " / e[twcypa]* / pass*" can be compared as a whole, matching paths in the pre-set attack path library that meet the following criteria: paths with the first two digits " / e" and a non-ending " / pass" in the middle.

[0162] Before detecting the command to be detected and the path to be detected respectively, the command to be detected and the path to be detected can be determined from the payload. The following uses the tuple obtained in step 312 as a token stream as an example to illustrate the process of determining the command to be detected and the path to be detected from the payload.

[0163] In some embodiments, a payload may include multiple commands to be detected. Therefore, it is possible to first determine whether there are separators such as "|" and "&" in the payload that can separate different commands. If there are separators, the payload can be split into multiple commands based on the determined separators. In some embodiments, the payload can be split into multiple commands based on the type and position of the characters in each tuple in the token stream. For example, it is possible to first determine whether there is a tuple of type 20 (the type of the separator "|" is recorded as 20) in the token stream. After determining that the tuple exists in the token stream, the position of the characters in the tuple in the payload is determined. For example, in the above example, it is determined that the character of the tuple of type 20 is at the 0th position in the payload, then it can be determined that bits 1-15 correspond to a command and the parameters corresponding to the command. For another example, if it is determined that the character in the tuple of type 20 is at the 7th position in the payload, then it can be determined that bits 0-6 correspond to a command and the parameters corresponding to the command, and the bits after 7 correspond to another command and the parameters corresponding to the command.

[0164] Afterwards, it is possible to detect whether there are characters of type space in the content obtained by splitting based on the delimiter. Since spaces are used to separate commands and parameters, if there are spaces, the content before the space can be used as a command, and the content after the space can be used as a parameter. If there are no spaces, it is determined that this part of the content is all commands. Specifically, it is determined whether there is a tuple of type 23 (the type of space is recorded as 23) in bits 1-15 of the token stream. If there is a tuple of type 23, then based on the position of the characters in the tuple in the payload, it can be determined that the content before the position in the content obtained by splitting based on the delimiter is a command, and the content after the position is a parameter of the command. For example, if it is determined that there is a tuple of type 23, and the position of the character in the tuple is the 8th position, it can be determined that bits 1-7 are the command to be detected, and bits 9-15 are the parameters of the command to be detected.

[0165] In other words, the position of the delimiters in the payload can be determined based on the type of each character in the payload. For example, in the above example, the delimiter "|" is determined to be at position 0, and the delimiter "space" is determined to be at position 8. Then, based on the position of the delimiters in the payload, the position of the first command (i.e., the command to be detected) in the payload can be determined. For example, in the above example, the command to be detected is determined to be at positions 1-7 in the payload.

[0166] Above example is to determine a kind of implementation of command to be detected based on separator.In some embodiments of the application, also provide another kind of mode that determines command to be detected: first determine the possible position of command to be detected based on separator "|" and space, afterwards, determine whether to include type in the possible position of command to be detected that is 7 tuples (the type of " / " is recorded as 7).If including type is 7 tuples, then the content after the last type is 7 tuples in the possible position of command to be detected is determined as command to be detected.Continue to take payload as "| / * / b* / cat / e[twcypa]* / pass*" as example, in 1-7 position, type is 7 symbols respectively at 1,3 and 6, and last type is 7 symbols at the 6th, so the content in the 7th tuple can be redefined as command to be detected.

[0167] In some cases, to evade command blocking, attackers may not only include the command to be detected in the payload, but also the storage path corresponding to the command to be detected. For example, if the cat command is stored in the / usr / bin path, the attacker may rewrite the cat path to " / usr / bin / cat." In this case, because the command is recorded after the last " / ", and attackers generally do not rewrite " / " as a wildcard, the above method can more accurately identify the command to be detected, thereby improving detection accuracy.

[0168] After determining the command to be detected, the position of each first character in the command to be detected can also be determined based on the token stream, which is used to perform RCE attack detection on the command to be detected in the attack command library. In other words, after determining the position of the command to be detected in the payload, the position of the first character of the command to be detected and the first character of the first command in the command to be detected are determined based on the positions of multiple first characters included in the payload and the position of the command to be detected in the payload.

[0169] Continuing with the example of a payload of "| / * / b* / cat / e[twcypa]* / pass*", if the command to be detected is at position 7 of the payload, and that position 7 is the first character, then we can determine that the first character accounts for the entire command to be detected, meaning that the command to be detected does not include wildcards. In this case, we can use the detection methods in related technologies to perform attack detection on the command to be detected, or we can use the method of this application to match the command to be detected with the attack command library to achieve RCE attack detection.

[0170] For another example, let's take the example of determining that the command to be detected is at positions 7-9 of the payload, and the 8th position is a single character replaced by the wildcard "?". The command to be detected is represented in the token stream as "('c',0,7),('?',9,8),('t',0,9)", then it can be determined that the characters of type 0 in the command to be detected are at positions 7 and 9 of the payload respectively. Since the command to be detected is at positions 7-9 in the payload, according to the above-mentioned position of the command to be detected in the payload and the position relationship of the characters of type 0 in the command to be detected in the payload, in some embodiments, it can be determined that the first character "c" is at the 1st position of the command to be detected, and the first character 't' is at the 3rd position of the command to be detected. It can also be determined that the command to be detected has a total of three characters. In some other embodiments, if the type of wildcard is not considered, it can also be determined that the first character 'c' is at the 1st position of the command to be detected, and the first character 't' is at the last position of the command to be detected.

[0171] After determining the command to be detected in the payload, the parameters in the payload can also be processed. As an example, it is possible to determine whether the parameter is a path based on the type of characters in the parameter. For example, " / " generally exists in the path, and taking the type of " / " represented by 7 as an example, it is possible to determine whether the parameter includes characters of type 7. If there are characters of type 7 in the parameter, it is determined that the parameter is the path of the command, and the path can be used as the path to be detected in this application for further RCE attack detection. If it is determined that there are no characters of type 7 in the parameter, it can be determined that the parameter is other than the path. Among them, the attack characteristics of other parameters except the path are not obvious. In this case, further RCE attack detection can be performed on the other parameters.

[0172] In some embodiments, if the RCE attack detection is performed on the to-be-detected path using the sub-paths to be detected as mentioned above, then after determining the to-be-detected path, each sub-path to be detected can also be determined. Taking the type of " / " represented by 7 as an example, the determination method can be: determine the position of the tuple of type 7 in the token stream corresponding to the to-be-detected path, and divide each sub-path to be detected according to the tuple of type 7. In other words, the content between every two adjacent characters of type 7 in the to-be-detected path is regarded as a sub-path to be detected, so that multiple sub-paths to be detected can be obtained.

[0173] Continuing with the example of a payload of "| / * / b* / cat / e[twcypa]* / pass*", in the path to be detected from bits 9 to 15, the type 7 symbol is at bits 7 and 13, respectively. Since bits 7 to 15 in the token stream are the path to be detected, the above method can be used to determine that bits 8 to 12 are one sub-path to be detected, and bits 14 to 15 are another sub-path to be detected.

[0174] After determining the token stream corresponding to the path to be detected and the sub-path to be detected, in some embodiments of the present application, the position of the first character in the path to be detected or the sub-path to be detected can also be determined. The determination method is similar to the method for determining the position of the first character in the command to be detected mentioned above, and will not be repeated here.

[0175] It should be noted that in some cases, the payload may include multiple commands to be detected, and may also include multiple paths to be detected. In this case, based on the above method, the position of the first character in each command to be detected and the position of the first character in each path to be detected can be determined, and RCE attack detection can be performed for each command to be detected and path to be detected respectively.

[0176] In some embodiments of the present application, a first identification result of whether an injection symbol exists in the payload may also be obtained.

[0177] The injection symbol may be a symbol that frequently appears in RCE attacks, such as “|”, “||”, “;”, “&”, “&&”, “$”, “$$”, “$(”, “${”, etc. In this embodiment, it is possible to detect whether the above injection symbol exists in the payload, and the identification result of whether the injection symbol is included may assist in RCE attack detection.

[0178] In other words, step 313 may further include: determining whether the payload includes the first recognition result of the injection symbol.

[0179] Step 314: Determine whether the payload has an RCE attack based on the result obtained in step 313, and restore the payload.

[0180] If the payload includes a command to be detected, then if the first detection result indicates that the command to be detected is an attack command, the payload is determined to have an RCE attack. Conversely, if the first detection result indicates that the command to be detected is not an attack command, the payload is determined to have no RCE attack.

[0181] In the case where the payload includes a command to be detected and a path to be detected, if the first detection result indicates that the command to be detected is an attack command, and / or the second detection result indicates that the path to be detected is an attack path, the payload is determined to contain an RCE attack. In other words, as long as the command to be detected is an attack command or the path to be detected is an attack path, an RCE attack can be determined to exist. This ensures that all RCE attacks can be identified, minimizing server security. Conversely, if the command to be detected is not an attack command and the path to be detected is not an attack path, an RCE attack is determined to exist.

[0182] In addition, if a search score is obtained when detecting an attack path for the path to be detected, then whether the payload contains an RCE attack can be determined based on the detection result and the search score of the path to be detected. In this case, if the first detection result indicates that the command to be detected is an attack command and / or the second detection result indicates that the path to be detected is an attack path, if the search score of the path to be detected is greater than a threshold, then the payload is determined to contain an RCE attack.

[0183] The detection results include the first detection result and the second detection result. The above process means that if either the command to be detected or the path to be detected has an RCE attack, if the search score is too low, it means that the match between the path to be detected and the attack path is very low, and there may be a false detection. Therefore, only when the command to be detected is an attack command and / or the path to be detected is an attack path, and the search score is greater than the threshold, is it determined that the payload has an RCE attack behavior.

[0184] Correspondingly, if the command to be detected is an attack command and / or the path to be detected is an attack path, but the retrieval score is less than the threshold, RCE attack behavior is not considered to exist. If the command to be detected is not an attack command and the path to be detected is not an attack path, RCE attack behavior is not considered to exist either.

[0185] In this way, the retrieval score is taken into consideration when making RCE attack judgments, which prevents excessive non-RCE attack command lines from being mistakenly identified as RCE attack behaviors, thereby improving the detection accuracy of RCE attacks.

[0186] In addition, if there is a first detection result corresponding to the command to be detected, a second detection result corresponding to the path to be detected, and a first identification result corresponding to the injector, it can be determined whether the payload has an RCE attack based on the detection result and the first identification result. Specifically, if the first detection result indicates that the command to be detected is an attack command and / or the second detection result indicates that the path to be detected is an attack path, if the first identification result indicates that the payload includes an injector, then it can be determined that the payload has an RCE attack.

[0187] In other words, when determining whether an RCE attack exists in a payload, the injection symbol can be further considered to further improve detection accuracy. The above process means that if the payload contains an attack path and / or an attack command, and the payload also contains an injection symbol, then the payload is determined to contain an RCE attack.

[0188] Furthermore, since the injector is only a common symbol in RCE attacks, it represents the execution logic between commands and does not indicate the presence of injection in the payload. Other non-RCE attacks may also use the injector. Therefore, if the payload only contains the injector without the attack path and / or attack command, it cannot be determined that the payload contains RCE attack behavior.

[0189] For the process of restoring the payload, the process of restoring the payload is to use the content that matches the payload / command to be detected / path to be detected in the attack detection library as the restoration result.

[0190] For example, if the command "c?t" matches "cat" in the attack command library, then "cat" can be used as the result of the restoration of "c?t." Continuing with the example of the payload "| / * / b* / cat / e[twcypa]* / pass*," we can see that the command to be detected, "| / * / b* / cat," matches "cat" in the attack command library, so the restoration result is "cat." The restoration result of the path " / e[twcypa]* / pass*" is " / etc / passwd."

[0191] In step 315, the big data platform sends the results obtained in steps 313 and 314 to a display device for display.

[0192] In order to facilitate user viewing and improve the interpretability of the above method, the various detection results, recognition results and restoration results obtained can be sent to a display device for display, so that the overall effect of the above method is better.

[0193] For example, after obtaining the restoration result of the command line to be detected, the restoration result of the command line to be detected can be displayed to facilitate viewing by the user.

[0194] In other words, if the payload is determined to contain an RCE attack, the following can also be done: Obtain and display the restoration result of the payload. If the characters included in the payload correspond to the command to be detected, the restoration result includes: the command that matches the command to be detected in the attack detection library. If the characters included in the payload correspond to the path to be detected, the restoration result includes: the path that matches the path to be detected in the attack detection library.

[0195] In some embodiments, if there are multiple commands in the attack command library that match the command to be detected, then all of these matching commands may be displayed. If there are multiple paths in the attack path library that match the path to be detected, then all of these matching commands may also be displayed. In other embodiments, to improve detection efficiency, detection may be stopped when there is a command in the attack command library that matches the command to be detected, and finally, only this single detected command may be output.

[0196] In addition, if the payload includes other parameters besides the path, in order to ensure the integrity of the restored payload, the other parameters besides the path can also be displayed.

[0197] In some embodiments, other detection results may also be displayed to the user, such as at least one of the following: the detection result, the result of whether the payload has an RCE attack, and the result of whether the command line to be detected has an injection symbol.

[0198] For example, if the payload is "| / * / b* / cat / e[twcypa]* / pass*", the display result of step 315 can be as follows: Figure 3A That is, the content shown in Table 2 is displayed.

[0199] Whether to include attack commands 1 Whether to include attack paths 1 Whether to include other parameters 0 Whether to include injection symbols 1 Restore command ['cat'] Restore path and other parameters [' / etc / passwd'] Retrieve ratings 0.5 Restored payload cat / etc / passwd

[0200] Table 2

[0201] Among them, the 1 corresponding to whether the table includes the attack command indicates that the attack command is included. Correspondingly, if the table is 0, 0 indicates that the attack command is not included. The meanings of whether the attack path is included, whether the injection symbol is included, and whether other parameters are included in other rows are similar. In other words, 1 indicates that the attack command is included, the attack path is included, the injection symbol is included, or other parameters are included, and 0 indicates that the attack path, the injection symbol, or other parameters are not included. Of course,

[0202] Table 2 is only an example, and other methods may be used to indicate whether an attack command, an attack path, an injection symbol, or other parameters are included.

[0203] For another example, if the payload is ping 127.0.0.0|cat / et{a,c} / pass[abcw]d, the results in this case can be shown in Table 3:

[0204] Whether to include attack commands 1 Whether to include attack paths 1 Whether to include other parameters 1 Whether to include injection symbols 1 Restore command ['ping','cat'] Restore path and other parameters ['127.0.0.0',' / etc / passwd'] Retrieve ratings 0.75 Restored payload ping 127.0.0.0|cat / etc / passwd

[0205] Table 3

[0206] The payload in the above table includes two commands. As for whether the attack command is included, the result can be: as long as any one of the two commands is an attack command, the attack command is output and the RCE attack is determined to be included.

[0207] The method provided in this application embodiment utilizes semantic restoration and other techniques to restore wildcard bypass payloads and detect attacks, determining whether traffic data contains RCE attack behavior. This method can reduce false negatives, improve the generalization and accuracy of RCE detection, and enhance the interpretability of detection results.

[0208] The above mainly introduces the solution provided by the embodiment of the present application from the perspective of the interaction between various network elements. It can be understood that, in order to realize the above functions, each network element, such as a server and a terminal, includes a hardware structure and / or software module corresponding to the execution of each function. It should be easy for those skilled in the art to realize that, in combination with the algorithm steps of each example described in the embodiments disclosed in this document, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in a hardware or computer software-driven hardware manner depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0209] In the embodiment of the present application, the server, terminal, and network device can be divided into functional modules according to the above method examples. For example, each functional module can be divided according to each function, or two or more functions can be integrated into one processing module. The above integrated modules can be implemented in the form of hardware or in the form of software functional modules. It should be noted that the division of modules in the embodiment of the present application is schematic and is only a logical functional division. In actual implementation, there may be other division methods.

[0210] In the case of dividing each functional module into corresponding functional modules, Figure 4A The figure shows a structural block diagram of a remote command injection attack detection device, which can also be understood as an internal structural diagram of the device where the detector is located. Figure 4A As shown, the device includes:

[0211] The acquisition module 410 is configured to acquire a command line to be detected, where the command line to be detected includes a plurality of first characters and wildcards, where the first characters are characters other than separators and wildcards.

[0212] The detection module 420 is configured to perform RCE attack detection in a preset attack detection library based on the multiple first characters included in the command line to be detected and the positions of the multiple first characters in the command line to be detected, and obtain a detection result.

[0213] The determination module 430 is configured to determine whether an RCE attack exists in the command line to be detected based at least on the detection result.

[0214] In an optional embodiment, the characters included in the command line to be detected correspond to a first command; the detection result includes: a first detection result, the first detection result is used to indicate whether the first command is an attack command; when the first detection result is used to indicate that the first command is an attack command, it is determined that an RCE attack exists in the command line to be detected.

[0215] In an optional embodiment, the detection module 420 is specifically used to: determine the first character included in the first command and the position of the first character included in the first command based on the type of each character in the command line to be detected; match the first command with an attack detection library based on the first character included in the first command and the position of the first character included in the first command to obtain a first detection result; wherein, when there is a command matching the first command in the attack detection library, the first detection result is used to indicate that the first command is an attack command.

[0216] In an optional embodiment, the command line to be detected also includes: a separator; the detection module 420 is specifically used to: determine the position of the separator in the command line to be detected based on the type of each character in the command line to be detected; determine the position of the first command in the command line to be detected based on the position of the separator in the command line to be detected in the command line to be detected; determine the first character included in the first command and the position of the first character included in the first command in the first command based on the positions of multiple first characters included in the command line to be detected and the position of the first command in the command line to be detected.

[0217] In an optional embodiment, the characters included in the command line to be detected also correspond to a first path; the detection result includes: a second detection result, the second detection result is used to indicate whether the first path is an attack path; when the first detection result is used to indicate that the first command is an attack command, and / or the second detection result is used to indicate that the first path is an attack path, it is determined that an RCE attack exists in the command line to be detected.

[0218] In an optional embodiment, the first path includes multiple second paths, and the second path is a path corresponding to a folder at a level in the first path; the detection module 420 is specifically used to: for each second path in the multiple second paths: determine the first character included in the second path and the position of the first character included in the second path in the second path based on the type of each character in the command line to be detected; match the second path with the attack detection library based on the first character included in the second path and the position of the first character included in the second path in the second path to obtain a matching result corresponding to the second path, and the matching result corresponding to the second path is used to indicate whether there is a path matching the second path in the attack detection library; determine a second detection result based on the matching result corresponding to each second path in the multiple second paths; wherein, when the matching results corresponding to each second path in the multiple second paths all indicate that there is a path matching the second path in the attack detection library, the second detection result is used to indicate that the first path is an attack path.

[0219] In an optional embodiment, the acquisition module 410 is further used to obtain a retrieval score of the first path, where the retrieval score is used to indicate the similarity between each second path in the first path and the path in the attack detection library; the determination module 430 is specifically used to determine whether the command line to be detected has an RCE attack based on the detection result and the retrieval score of the first path; wherein, when the first detection result is used to indicate that the first command is an attack command and / or the second detection result is used to indicate that the first path is an attack path, if the retrieval score of the first path is greater than a threshold, it is determined that the command line to be detected has an RCE attack.

[0220] In an optional embodiment, the acquisition module 410 is specifically configured to: obtain a first score corresponding to each second path in the plurality of second paths; the first score is used to indicate the ratio of the number of first characters corresponding to the second path to the number of all characters in a third path, where the third path is a path in the attack detection library that matches the second path; and determine a retrieval score for the first path based on the first score corresponding to each second path in the plurality of second paths.

[0221] In an optional embodiment, the determination module 430 is further used to determine a first recognition result of whether the command line to be detected includes an injection symbol; the determination module 430 is specifically used to determine whether an RCE attack exists in the command line to be detected based on the detection result and the first recognition result; wherein, when the first detection result is used to indicate that the first command is an attack command and / or the second detection result is used to indicate that the first path is an attack path, if the first recognition result indicates that the command line to be detected includes an injection symbol, it is determined that an RCE attack exists in the command line to be detected.

[0222] In an optional embodiment, the device further includes a conversion module (not shown in the figure), which is used to convert the command line to be detected into multiple tuples based on lexical analysis technology; a tuple includes: at least one character in the command line to be detected, the type of at least one character, and the position of at least one character in the command line to be detected.

[0223] In an optional embodiment, when the determination module 430 determines that a command injection attack behavior exists in the command line to be detected, the acquisition module 410 is further used to: obtain and display the restoration result of the command line to be detected; wherein, when the characters included in the command line to be detected correspond to a first command, the restoration result includes: a command in the attack detection library that matches the first command; when the characters included in the command line to be detected correspond to a first path, the restoration result includes: a path in the attack detection library that matches the first path.

[0224] In an optional embodiment, the device also includes: a display module (not shown in the figure), the display module is used to display at least one of the following contents: the detection result, the result of whether the command line to be detected has an RCE attack, and the identification result of whether there is an injection symbol in the command line to be detected.

[0225] In an optional embodiment, the device further includes an extraction module (not shown in the figure), which is used to obtain metadata from the traffic data; parse the metadata, and extract the command line to be detected.

[0226] It should be noted that all relevant contents of each step involved in the above method embodiment can be referred to the functional description of the corresponding functional module and will not be repeated here.

[0227] The remote command injection attack detection device provided in the embodiment of the present application is used to execute the above-mentioned remote command injection attack detection method, and thus can achieve the same effect as the above-mentioned remote command injection attack detection method.

[0228] In the case of an integrated unit, Figure 4B FIG. 1 shows another possible structural diagram of the detection device for remote command injection attacks in the above embodiment, that is, a possible structural diagram of the device where the above detector is located. Figure 4B As shown, the device includes: a processing module 42 and a communication module 41.

[0229] The processing module 42 is used to control and manage the actions of the device. For example, the processing module 42 is used to support the device to execute Figure 2 The communication module 41 is used to support the communication of the device with other network entities, such as Figure 1 and / or Figure 3B The apparatus may further comprise a storage module 43 for storing program codes and data of the server.

[0230] The processing module 42 may be a processor or controller. It may implement or execute the various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of this application. A processor may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, and so on. The communication module 41 may be a transceiver, a transceiver circuit, or a communication interface. The storage module 43 may be a memory.

[0231] Through the description of the above implementation methods, technical personnel in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.

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

[0233] Units described as separate components may or may not be physically separate, and components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0234] The above-mentioned device can be deployed in an electronic device, that is, an embodiment of the present application also provides an electronic device, including a memory and a processor, the memory is used to store computer programs, and the processor is used to execute computer programs to implement the remote command injection attack detection method of the first aspect of the embodiment of the present application.

[0235] In addition, an embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored. The computer program is used to implement the method for detecting remote command injection attacks of the first aspect of the embodiment of the present application.

[0236] An embodiment of the present application also provides a computer program product, including a computer-readable code, or a non-volatile computer-readable storage medium carrying the computer-readable code. When the computer-readable code runs in an electronic device, the processor in the electronic device executes the remote command injection attack detection method of the first aspect of the embodiment of the present application.

[0237] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.

[0238] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling a device (which can be a single-chip microcomputer, chip, etc.) or a processor to execute all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0239] The above are only specific embodiments of the present application, but the scope of protection of the present application is not limited thereto. Any changes or replacements within the technical scope disclosed in this application should be included in the scope of protection of the present application. Therefore, the scope of protection of the present application should be based on the scope of protection of the claims.

Claims

1. A remote command injection attack detection method, characterized in that: The method comprises: Acquire a command line to be detected, where the command line to be detected includes a plurality of first characters and wildcards, where the first characters are characters other than separators and wildcards; Based on the multiple first characters included in the command line to be detected and the positions of the multiple first characters in the command line to be detected, performing remote command injection attack detection in a preset attack detection library to obtain a detection result; At least based on the detection result, it is determined whether the command line to be detected contains remote command injection attack behavior.

2. The method according to claim 1, characterized in that: The characters included in the command line to be detected correspond to a first command; the detection result includes: a first detection result, the first detection result is used to indicate whether the first command is an attack command; When the first detection result indicates that the first command is an attack command, it is determined that the command line to be detected has a remote command injection attack behavior.

3. The method according to claim 2, characterized in that The performing remote command injection attack detection in a preset attack detection library based on the multiple first characters included in the command line to be detected and the positions of the multiple first characters in the command line to be detected to obtain a detection result includes: Determine, based on the type of each character in the characters included in the command line to be detected, a first character included in the first command and a position of the first character included in the first command in the first command; Based on a first character included in the first command and a position of the first character included in the first command in the first command, matching the first command with the attack detection library to obtain the first detection result; Wherein, when there is a command matching the first command in the attack detection library, the first detection result is used to indicate that the first command is an attack command.

4. The method according to claim 3, characterized in that The command line to be detected also includes: a separator; The determining, based on the type of each character in the characters included in the command line to be detected, the first character included in the first command and the position of the first character included in the first command in the first command comprises: Determining the position of the separator in the command line to be detected based on the type of each character in the characters included in the command line to be detected; Determining the position of the first command in the command line to be detected based on the position of the separator in the command line to be detected; Based on the positions of the plurality of first characters included in the command line to be detected and the position of the first command in the command line to be detected, the first character included in the first command and the position of the first character included in the first command in the first command are determined.

5. The method according to any one of claims 2 to 4, characterized in that: The characters included in the command line to be detected also correspond to a first path; the detection result includes: a second detection result, the second detection result is used to indicate whether the first path is an attack path; When the first detection result is used to indicate that the first command is an attack command, and / or the second detection result is used to indicate that the first path is an attack path, it is determined that the command line to be detected has a remote command injection attack behavior.

6. The method according to claim 5, characterized in that The first path includes multiple second paths, and the second path is a path corresponding to a folder of a level in the first path; The performing remote command injection attack detection in a preset attack detection library based on the multiple first characters included in the command line to be detected and the positions of the multiple first characters in the command line to be detected to obtain a detection result includes: For each second path of the plurality of second paths: based on the type of each character in the characters included in the command line to be detected, determining a first character included in the second path and a position of the first character included in the second path in the second path; based on the first character included in the second path and the position of the first character included in the second path in the second path, matching the second path with the attack detection library to obtain a matching result corresponding to the second path, wherein the matching result corresponding to the second path is used to indicate whether there is a path in the attack detection library that matches the second path; Determine the second detection result based on the matching result corresponding to each second path in the plurality of second paths; Wherein, when the matching results corresponding to each second path in the plurality of second paths all indicate that there is a path matching the second path in the attack detection library, the second detection result is used to indicate that the first path is an attack path.

7. The method according to claim 6, characterized in that The method further comprises: Obtaining a retrieval score of the first path, the retrieval score being used to indicate a similarity between each second path in the first path and a path in the attack detection library; The step of determining whether the command line to be detected contains a remote command injection attack behavior at least based on the detection result includes: Based on the detection result and the search score of the first path, determining whether the command line to be detected has a remote command injection attack behavior; Among them, when the first detection result is used to indicate that the first command is an attack command and / or the second detection result is used to indicate that the first path is an attack path, if the retrieval score of the first path is greater than a threshold, it is determined that the command line to be detected contains a remote command injection attack behavior.

8. The method according to claim 7, characterized in that The obtaining of the search score of the first path includes: Obtaining a first score corresponding to each second path in the plurality of second paths; the first score being a ratio of the number of first characters corresponding to the second path to the number of all characters in a third path, wherein the third path is a path in the attack detection library that matches the second path; Based on the first scores corresponding to each second path in the plurality of second paths, a search score of the first path is determined.

9. The method according to claim 5, characterized in that The method further comprises: Determine whether the command line to be detected includes a first recognition result of an injection symbol; The step of determining whether the command line to be detected contains a remote command injection attack behavior at least based on the detection result includes: Based on the detection result and the first recognition result, determining whether the command line to be detected has remote command injection attack behavior; Among them, when the first detection result is used to indicate that the first command is an attack command and / or the second detection result is used to indicate that the first path is an attack path, if the first identification result indicates that the command line to be detected includes an injection symbol, it is determined that the command line to be detected contains a remote command injection attack behavior.

10. The method according to any one of claims 1 to 9, characterized in that: The method further comprises: Based on lexical analysis technology, the command line to be detected is converted into multiple tuples; a tuple includes: at least one character in the command line to be detected, the type of the at least one character, and the position of the at least one character in the command line to be detected.

11. The method according to any one of claims 1 to 10, characterized in that: In the case where it is determined that the command line to be detected has a command injection attack behavior, the method further includes: Obtaining and displaying the restoration result of the command line to be detected; Wherein, when the characters included in the command line to be detected correspond to a first command, the restoration result includes: a command in the attack detection library that matches the first command; when the characters included in the command line to be detected correspond to a first path, the restoration result includes: a path in the attack detection library that matches the first path.

12. The method according to any one of claims 1 to 11, characterized in that: The method further comprises: At least one of the following contents is displayed: the detection result, the result of whether the command line to be detected contains remote command injection attack behavior, and the identification result of whether the command line to be detected contains an injection symbol.

13. The method according to any one of claims 1 to 12, characterized in that: The method further comprises: Get metadata from traffic data; The metadata is parsed to extract the command line to be detected.

14. A remote command injection attack detection device, characterized in that: The device comprises: An acquisition module, used for acquiring a command line to be detected, wherein the command line to be detected includes a plurality of first characters and wildcards, wherein the first characters are characters other than separators and wildcards; A detection module, configured to perform remote command injection attack detection in a preset attack detection library based on the multiple first characters included in the command line to be detected and the positions of the multiple first characters in the command line to be detected, and obtain a detection result; A determination module is used to determine whether the command line to be detected contains remote command injection attack behavior based at least on the detection result.

15. The device according to claim 14, characterized in that The characters included in the command line to be detected correspond to a first command; the detection result includes: a first detection result, the first detection result is used to indicate whether the first command is an attack command; When the first detection result indicates that the first command is an attack command, it is determined that the command line to be detected has a remote command injection attack behavior.

16. The device according to claim 15, characterized in that The detection module is specifically configured to determine, based on the type of each character in the characters included in the command line to be detected, a first character included in the first command and a position of the first character included in the first command in the first command; based on the first character included in the first command and the position of the first character included in the first command in the first command, match the first command with the attack detection library to obtain the first detection result; Wherein, when there is a command matching the first command in the attack detection library, the first detection result is used to indicate that the first command is an attack command.

17. The device according to claim 16, characterized in that The command line to be detected also includes: a separator; The detection module is specifically used to: determine the position of a separator in the command line to be detected based on the type of each character in the command line to be detected; determine the position of the first command in the command line to be detected based on the position of the separator in the command line to be detected in the command line to be detected; and determine the first character included in the first command and the position of the first character included in the first command in the first command based on the positions of the multiple first characters included in the command line to be detected and the position of the first command in the command line to be detected.

18. The device according to any one of claims 15 to 17, characterized in that: The characters included in the command line to be detected also correspond to a first path; the detection result includes: a second detection result, the second detection result is used to indicate whether the first path is an attack path; When the first detection result is used to indicate that the first command is an attack command, and / or the second detection result is used to indicate that the first path is an attack path, it is determined that the command line to be detected has a remote command injection attack behavior.

19. The device according to claim 18, characterized in that The first path includes multiple second paths, and the second path is a path corresponding to a folder of a level in the first path; The detection module is specifically used to: for each second path in the plurality of second paths: determine, based on the type of each character in the characters included in the command line to be detected, a first character included in the second path and a position of the first character included in the second path in the second path; match the second path with the attack detection library based on the first character included in the second path and the position of the first character included in the second path in the second path to obtain a matching result corresponding to the second path, wherein the matching result corresponding to the second path is used to indicate whether there is a path matching the second path in the attack detection library; determine the second detection result based on the matching result corresponding to each second path in the plurality of second paths; Wherein, when the matching results corresponding to each second path in the plurality of second paths all indicate that there is a path matching the second path in the attack detection library, the second detection result is used to indicate that the first path is an attack path.

20. The device according to claim 19, characterized in that The acquisition module is further used to acquire a retrieval score of the first path, wherein the retrieval score is used to indicate a similarity between each second path in the first path and a path in the attack detection library; The determination module is specifically used to determine whether the command line to be detected has a remote command injection attack behavior based on the detection result and the search score of the first path; Among them, when the first detection result is used to indicate that the first command is an attack command and / or the second detection result is used to indicate that the first path is an attack path, if the retrieval score of the first path is greater than a threshold, it is determined that the command line to be detected contains a remote command injection attack behavior.

21. The device according to claim 20, characterized in that The acquisition module is specifically used to: acquire a first score corresponding to each second path in the multiple second paths; the first score is a ratio of the number of first characters corresponding to the second path to the number of all characters in a third path, and the third path is a path in the attack detection library that matches the second path; and determine a retrieval score of the first path based on the first score corresponding to each second path in the multiple second paths.

22. The device according to claim 18, characterized in that The determination module is further configured to determine whether the command line to be detected includes a first recognition result of an injection symbol; The determination module is specifically used to determine whether the command line to be detected contains remote command injection attack behavior based on the detection result and the first recognition result; Among them, when the first detection result is used to indicate that the first command is an attack command and / or the second detection result is used to indicate that the first path is an attack path, if the first identification result indicates that the command line to be detected includes an injection symbol, it is determined that the command line to be detected contains a remote command injection attack behavior.

23. The device according to any one of claims 14 to 22, characterized in that The device also includes a conversion module; The conversion module is used to convert the command line to be detected into multiple tuples based on lexical analysis technology; a tuple includes: at least one character in the command line to be detected, the type of the at least one character, and the position of the at least one character in the command line to be detected.

24. The device according to any one of claims 14 to 23, characterized in that In the case where the determination module determines that the command line to be detected has a command injection attack behavior, the acquisition module is further used to: acquire and display the restoration result of the command line to be detected; Wherein, when the characters included in the command line to be detected correspond to a first command, the restoration result includes: a command in the attack detection library that matches the first command; when the characters included in the command line to be detected correspond to a first path, the restoration result includes: a path in the attack detection library that matches the first path.

25. The device according to any one of claims 14 to 24, characterized in that The device further comprises: a display module; The display module is used to display at least one of the following contents: the detection result, the result of whether the command line to be detected contains remote command injection attack behavior, and the recognition result of whether there is an injection symbol in the command line to be detected.

26. The device according to any one of claims 14 to 25, characterized in that The device also includes an extraction module; The extraction module is used to obtain metadata from traffic data; parse the metadata and extract the command line to be detected.

27. An electronic device, characterized in that: It comprises a memory and a processor, wherein the memory is used to store a computer program, and the processor is used to execute the computer program to implement the remote command injection attack detection method according to any one of claims 1 to 13.

28. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and the computer program is used to implement the remote command injection attack detection method according to any one of claims 1 to 13.

29. A computer program product, characterized in that It includes a computer-readable code, or a non-volatile computer-readable storage medium carrying the computer-readable code. When the computer-readable code runs in an electronic device, a processor in the electronic device executes the remote command injection attack detection method according to any one of claims 1 to 13.