Traffic detection method and device, equipment and storage medium

By obtaining the Nonce value and TOTP value in the SliverC2 frame request, it is determined whether the network traffic is SliverHTTP protocol traffic, which solves the problem of low detection accuracy in the existing technology and achieves effective identification of obfuscated encryption and random encoding traffic.

CN118694589APending Publication Date: 2024-09-24CHINA ELECTRONICS CLOUD DIGITAL INTELLIGENCE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410818649.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-24
Publication Date
2024-09-24

AI Technical Summary

Technical Problem

When existing security detection equipment detects the HTTP protocol traffic of the SliverC2 framework, it is easy to be bypassed by obfuscated encrypted and randomly encoded traffic, resulting in low detection accuracy.

Method used

By obtaining the Nonce value and TOTP value in the target request sent by the client to the server, it determines whether it conforms to the encoding method of the SliverHTTP protocol, thereby determining whether the network traffic is SliverHTTP protocol traffic.

Benefits of technology

The detection accuracy of SliverHTTP protocol traffic is improved, and traffic that has been obfuscated, encrypted and randomly encoded can be effectively identified.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118694589A
    Figure CN118694589A
Patent Text Reader

Abstract

The invention provides a traffic detection method and device, equipment and a storage medium. The method comprises the following steps: acquiring a first target request sent by a client to a server; obtaining a None value and a TOTP value contained in the URL of the first target request, and respectively determining whether the None value and the TOTP value conform to a coding mode of an HTTP protocol; and if it is determined that both the Non value and the TOTP value accord with the coding mode of the Sliver HTTP protocol, determining that the network flow corresponding to the first target request is the flow of the Sliver HTTP protocol. Visibly, according to the embodiment of the invention, whether the network flow corresponding to the first target request is the Sliver HTTP protocol flow or not can be determined based on the Non value and the TOTP value in the first target request, so that the detection accuracy of the Sliver HTTP protocol flow is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of data processing, and in particular to a flow detection method, device, equipment and storage medium. Background Art

[0002] Sliver is an open source, cross-platform command and control framework that supports client and server communication. Security professionals can use the SliverC2 framework to perform security testing. Similarly, threat actors can also use it to remotely control infected hosts during an attack. In the field of security defense, security detection equipment can be used to detect the network traffic of the SliverC2 framework to identify the communication traffic, such as Sliver's HTTP protocol traffic.

[0003] At present, the detection method of HTTP protocol traffic of SliverC2 framework by security detection equipment is mainly based on feature signature. This detection method has the following problems: If the Sliver HTTP protocol traffic is output after being obfuscated, encrypted and randomly encoded, it is easy to bypass the security detection equipment. At this time, the security detection equipment may not be able to accurately detect the traffic.

[0004] Therefore, how to improve the accuracy of traffic detection of the HTTP protocol for the SliverC2 framework is a technical problem that needs to be solved urgently. Summary of the invention

[0005] In order to solve the above technical problems, the present disclosure provides a traffic detection method, device, equipment and storage medium, which can improve the accuracy of traffic detection of the HTTP protocol for the SliverC2 framework.

[0006] In a first aspect, the present disclosure provides a flow detection method, the method comprising:

[0007] Obtaining a first target request sent by a client to a server; wherein the first target request carries a uniform resource locator URL;

[0008] Obtaining a Nonce value and a TOTP value contained in the URL of the first target request, and determining whether the Nonce value and the TOTP value conform to an encoding method of the SliverHTTP protocol;

[0009] If it is determined that both the Nonce value and the TOTP value conform to the encoding method of the SliverHTTP protocol, it is determined that the network traffic corresponding to the first target request is SliverHTTP protocol traffic.

[0010] In a second aspect, the present disclosure provides a flow detection device, the device comprising:

[0011] A first acquisition module is used to acquire a first target request sent by a client to a server; wherein the first target request carries a uniform resource locator URL;

[0012] A second acquisition module is used to obtain a Nonce value and a TOTP value contained in the URL of the first target request, and respectively determine whether the Nonce value and the TOTP value conform to the encoding method of the SliverHTTP protocol;

[0013] The first determination module is used to determine that the network traffic corresponding to the first target request is SliverHTTP protocol traffic if it is determined that the Nonce value and the TOTP value both conform to the encoding method of the SliverHTTP protocol.

[0014] In a third aspect, the present disclosure provides a computer-readable storage medium, wherein the computer-readable storage medium stores instructions, and when the instructions are executed on a computer device, the computer device implements the above method.

[0015] In a fourth aspect, the present disclosure provides a flow detection device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the above method is implemented when the processor executes the computer program.

[0016] In a fifth aspect, the present disclosure provides a computer program product, which includes a computer program / instructions. When the processor executes the computer program / instructions, the above method is implemented.

[0017] Compared with the prior art, the technical solution provided by the embodiments of the present disclosure has at least the following advantages:

[0018] The disclosed embodiment provides a traffic detection method, which includes: obtaining a first target request sent by a client to a server; obtaining a Nonce value and a TOTP value contained in the URL of the first target request, and respectively determining whether the Nonce value and the TOTP value comply with the encoding method of the SliverHTTP protocol; if it is determined that both the Nonce value and the TOTP value comply with the encoding method of the SliverHTTP protocol, then determining that the network traffic corresponding to the first target request is SliverHTTP protocol traffic. It can be seen that the disclosed embodiment can determine whether the network traffic corresponding to the first target request is SliverHTTP protocol traffic based on the Nonce value and the TOTP value in the first target request, thereby improving the detection accuracy of the SliverHTTP protocol traffic. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.

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

[0021] Figure 1 A flow chart of a flow detection method provided by an embodiment of the present disclosure;

[0022] Figure 2 A flow chart of another flow detection method provided by an embodiment of the present disclosure;

[0023] Figure 3 A flow chart of another flow detection method provided by an embodiment of the present disclosure;

[0024] Figure 4 A flow chart of another flow detection method provided by an embodiment of the present disclosure;

[0025] Figure 5 A schematic diagram of the structure of a flow detection device provided in an embodiment of the present disclosure;

[0026] Figure 6 A schematic diagram of the structure of a flow detection device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION

[0027] In order to more clearly understand the above-mentioned objectives, features and advantages of the present disclosure, the scheme of the present disclosure will be further described below. It should be noted that the embodiments of the present disclosure and the features in the embodiments can be combined with each other without conflict.

[0028] In the following description, many specific details are set forth to facilitate a full understanding of the present disclosure, but the present disclosure may also be implemented in other ways different from those described herein; it is obvious that the embodiments in the specification are only part of the embodiments of the present disclosure, rather than all of the embodiments.

[0029] Sliver is an open source, cross-platform command and control framework that supports client and server communication. Security professionals can use the SliverC2 framework to perform security testing. Similarly, threat actors can also use it to remotely control infected hosts during an attack. In the field of security defense, security detection equipment can be used to detect the network traffic of the SliverC2 framework to identify the communication traffic, such as Sliver's HTTP protocol traffic.

[0030] At present, the detection method of HTTP protocol traffic of SliverC2 framework by security detection equipment is mainly based on feature signature. This detection method has the following problems: If the Sliver HTTP protocol traffic is output after being obfuscated, encrypted and randomly encoded, it is easy to bypass the security detection equipment. At this time, the security detection equipment may not be able to accurately detect the traffic.

[0031] To this end, the present embodiment provides a traffic detection method, which includes: obtaining a first target request sent by a client to a server; obtaining a Nonce value and a TOTP value contained in the URL of the first target request, and respectively determining whether the Nonce value and the TOTP value comply with the encoding method of the SliverHTTP protocol; if it is determined that both the Nonce value and the TOTP value comply with the encoding method of the SliverHTTP protocol, then determining that the network traffic corresponding to the first target request is SliverHTTP protocol traffic. It can be seen that the present embodiment can determine whether the network traffic corresponding to the first target request is SliverHTTP protocol traffic based on the Nonce value and the TOTP value in the first target request, thereby improving the detection accuracy of the SliverHTTP protocol traffic.

[0032] Based on this, the present disclosure provides a flow detection method, referring to Figure 1 , is a flow chart of a flow detection method provided by an embodiment of the present disclosure, the method comprising:

[0033] S101: Obtain a first target request sent by a client to a server.

[0034] The first target request carries a uniform resource locator URL.

[0035] The traffic detection method provided in the embodiments of the present disclosure can be applied to devices that detect traffic in security products, such as intrusion prevention devices, intrusion detection devices, or security detection devices such as network firewalls. Specifically, it can be used to detect which traffic in the network traffic of penetration testing tools or frameworks is malicious, so as to prompt security personnel to defend it and take other measures.

[0036] In an optional implementation, the client and the server may belong to an open source cross-platform implant framework Sliver that supports the C2 structure (ie, the structure of the client and the server), namely, the SliverC2 framework.

[0037] In the disclosed embodiment, the penetration testing tool or framework may include a client and a server, wherein the client may be, for example, an implant Trojan file. In actual applications, the network traffic generated by the Trojan file generated by the SliverC2 framework during the communication with the server is detected to determine whether the Sliver C2 framework tool is used in the network traffic.

[0038] In an optional implementation, the first target request may include the first POST request sent by the client to the server.

[0039] In actual applications, when the Trojan file communicates with the server, the Trojan file will first exchange keys with the server. Specifically, the Trojan file can use a POST request to send the encrypted SessionKey session key to the server, where the POST request can include two parts: Body data and a uniform resource locator URL.

[0040] S102: Obtain the Nonce value and the TOTP value included in the URL of the first target request, and respectively determine whether the Nonce value and the TOTP value comply with the encoding method of the Sliver HTTP protocol.

[0041] In an optional implementation, the security detection device can detect HTTP protocol traffic based on the characteristic signature in the default configuration traffic of the Sliver framework. However, for the configuration traffic that has been modified twice, since the configuration traffic that has been modified twice lacks the characteristic signature, it is difficult for the security detection device to detect whether it is Sliver HTTP protocol traffic based on the characteristic signature. However, in the first POST request sent by the Trojan file, whether it is the default configuration traffic or the second modified configuration traffic, its corresponding Nonce value and TOTP value always exist, so the Nonce value and TOTP can be used to detect whether the network traffic corresponding to the first target request is Sliver HTTP protocol traffic.

[0042] In actual applications, after generating the Nonce value and TOTP value, the Trojan file encapsulates the Nonce value and TOTP value in the URL, and after randomly encoding the Body data, sends the first target request carrying the URL and Body data to the server.

[0043] Among them, the Nonce value, the full name of which is Number used once, is a non-repeating random value that is used only once, and the TOTP value, the full name of which is Time-based One-time Password, is a time-based one-time password. In actual applications, the server can use the TOTP value to verify whether the time of the Trojan file is synchronized with the server. If synchronized, it will continue to execute subsequent session requests.

[0044] In practical applications, since the parameter Key of the Nonce value is any character, such as any character from a to z, or the character "_", and the attribute value Value is a combination of 6 to 9 digits and 0 to 2 characters, where the positions of the characters are randomly inserted into the numbers, after obtaining the Nonce value contained in the URL of the first target request, the embodiment of the present disclosure can determine whether the Nonce value complies with the encoding method of the Sliver HTTP protocol based on the above encoding.

[0045] The parameter Key of the TOTP value is any two characters, and the attribute value Value is a combination of 6 to 9 digits and 0 to 2 characters, where the positions of the characters are randomly inserted into the numbers. Therefore, after obtaining the TOTP value contained in the URL of the first target request, it can be determined whether the TOTP value conforms to the encoding method of the Sliver HTTP protocol based on the above encoding method.

[0046] For example, assuming that the URL of the first target request sent by the Trojan file implant to the server is / login.html?f=148a345u68&mn=59370815, based on the encoding method of the Sliver HTTP protocol, "f=148a345u68" is a Nonce key-value pair, where "f" is the parameter Key of the Nonce value, and "148a345u68" is the attribute value Value of the Nonce value (including two characters 'a' and 'u'), that is, the Nonce value contained in the URL of the first target request complies with the encoding method of the HTTP protocol; "mn=59370815" is a TOTP key-value pair, where "mn" is the parameter Key of the TOTP value, and "59370815" is the attribute value Value of the TOTP value (excluding characters), that is, the TOTP value contained in the URL of the first target request complies with the encoding method of the SliverHTTP protocol.

[0047] S103: If it is determined that both the Nonce value and the TOTP value comply with the encoding method of the Sliver HTTP protocol, it is determined that the network traffic corresponding to the first target request is Sliver HTTP protocol traffic.

[0048] In actual applications, after determining that the Nonce value and the TOTP value in the URL of the first target request both conform to the encoding method of the SliverHTTP protocol, the network traffic corresponding to the first target request is determined to be Sliver HTTP protocol traffic.

[0049] In the traffic detection method provided by the embodiment of the present disclosure, a first target request sent by the client to the server is obtained; the Nonce value and TOTP value contained in the URL of the first target request are obtained, and it is determined whether the Nonce value and the TOTP value comply with the encoding method of the Sliver HTTP protocol respectively; if it is determined that both the Nonce value and the TOTP value comply with the encoding method of the Sliver HTTP protocol, it is determined that the network traffic corresponding to the first target request is Sliver HTTP protocol traffic. It can be seen that the embodiment of the present disclosure can determine whether the network traffic corresponding to the first target request is Sliver HTTP protocol traffic based on the Nonce value and the TOTP value in the first target request, thereby improving the detection accuracy of the Sliver HTTP protocol flow traffic.

[0050] On the basis of the above embodiment, in order to further improve the detection accuracy of Sliver HTTP protocol traffic, it is also possible to determine whether the network traffic corresponding to the first target request is Sliver HTTP protocol traffic by detecting whether the Nonce value is valid. In this regard, the embodiment of the present disclosure provides another traffic detection method, referring to Figure 2 A flow chart of another flow detection method provided in an embodiment of the present disclosure, the method comprising:

[0051] S201: Obtain a first target request sent by a client to a server; wherein the first target request carries a uniform resource locator URL.

[0052] S202: Obtain the Nonce value and the TOTP value included in the URL of the first target request, and respectively determine whether the Nonce value and the TOTP value comply with the encoding method of the Sliver HTTP protocol.

[0053] Step S201 and step S202 may be specifically understood with reference to S101 and S102 in the above embodiment, and will not be described in detail here.

[0054] S203: Obtain a preset number of POST requests and / or GET requests between the client and the penetration server as requests to be detected.

[0055] In actual applications, since the Nonce value first appears in the first POST request sent by the Trojan file to the server, all subsequent HTTP requests, whether POST requests or GET requests, contain the Nonce value, and the Nonce value is different each time. Therefore, it is possible to detect whether the Nonce value in the URL of the HTTP request between a preset number of clients and the server is valid to determine whether the network traffic corresponding to the first target request is Sliver HTTP protocol traffic.

[0056] In the disclosed embodiment, a valid Nonce value means that the Nonce value can be mapped to any encoder ID, and correspondingly, an invalid Nonce value means that the Nonce value cannot be mapped to any encoder ID, or the Nonce value is zero.

[0057] In the embodiment of the present disclosure, a preset number of POST requests and / or GET requests are first obtained as requests to be detected, wherein the preset number can be determined based on actual needs, for example, the preset number can be set to 10, and the requests to be detected can include at least one of POST requests and GET requests.

[0058] S204: Determine whether the proportion of the number of requests with valid Nonce values ​​in the requests to be detected to the preset number reaches a preset threshold.

[0059] In the embodiment of the present disclosure, after determining a preset number of requests to be detected, firstly, the proportion of requests with valid Nonce values ​​in the requests to be detected to the preset number is calculated, and it is determined whether the proportion reaches a preset threshold.

[0060] For example, assuming that the number of requests to be detected is 10, the preset threshold is 0.8, and the number of requests with valid Nonce values ​​is 9, after calculation, it can be known that the proportion of requests with valid Nonce values ​​to the preset number is 0.9, and it can be determined that the proportion of requests with valid Nonce values ​​to the preset number reaches the preset threshold of 0.8. In practical applications, the setting of the preset threshold can be determined based on actual needs. In order to further improve the detection accuracy of Sliver HTTP protocol traffic, the preset threshold can be set to 1, that is, when the Nonce values ​​corresponding to all requests in the requests to be detected are valid, the network traffic corresponding to the first target request can be determined to be Sliver HTTP protocol traffic.

[0061] In an optional implementation, the request to be detected may also include a second target request, wherein the second target request may be any one of the requests to be detected. Before determining whether the proportion of the number of requests with valid Nonce values ​​in the requests to be detected reaches a preset threshold, it may also include: determining whether the Nonce values ​​of each request in the requests to be detected are valid.

[0062] In actual applications, the encoder defines how the message sent to the server or client is encoded. The encoders currently supported by the SliverC2 framework include: Base64, Hex, English, Gzip, Gzip+English, Base64+Gzip, and each encoder corresponds to an encoder ID, namely encoderID. The relationship between the Nonce value and the encoder ID is: Nonce = (insecureRand.Intn(maxN)*EncoderModulus)+encoderID, where maxN is used to represent the random number and EncoderModulus is used to represent the hard-coded constant.

[0063] In the disclosed embodiment, after obtaining the Nonce value in the URL of the second target request, first, determine the attribute value of the Nonce value corresponding to the second target request, and delete the characters filled in the attribute value to obtain the number to be processed; then, divide the number to be processed by the hard-coded constant to obtain the corresponding remainder, and match the remainder with the encoder ID.

[0064] In the disclosed embodiment, the encoder ID is used to identify the encoder, and the values ​​corresponding to the encoder ID include: {64, 45, 49, 31, 13, 92}.

[0065] For example, assuming that the Nonce value corresponding to the second target request is f=148a345u68, where the attribute value of the Nonce value is 148a345u68, after deleting the characters "a" and "u" filled in the attribute value, the number to be processed is 14834568; then 14834568 is divided by the hard-coded constant, that is, 101, to obtain the remainder 92; then, the remainder 92 is matched with the encoder ID.

[0066] In the embodiment of the present disclosure, if it is determined that the preset matches any encoder ID successfully, then the Nonce value corresponding to the second target request is determined to be valid. Exemplarily, by matching the remainder 92 with the encoder ID, it can be determined that the remainder 92 matches 92 in {64, 45, 49, 31, 13, 92} successfully.

[0067] S205: If it is determined that the proportion of the number of requests with valid Nonce values ​​to the preset number reaches the preset threshold, and both the Nonce value and the TOTP value conform to the encoding method of the Sliver HTTP protocol, then it is determined that the network traffic corresponding to the first target request is Sliver HTTP protocol traffic.

[0068] In the embodiment of the present disclosure, when it is determined that the proportion of the number of requests with valid Nonce values ​​to a preset number reaches a preset threshold, and both the Nonce value and the TOTP value conform to the encoding method of the HTTP protocol, the network traffic corresponding to the first target request is determined to be HTTP protocol traffic.

[0069] In the traffic detection method provided by the embodiment of the present disclosure, a first target request sent by the client to the server is obtained; the Nonce value and TOTP value contained in the URL of the first target request are obtained, and it is determined whether the Nonce value and the TOTP value conform to the encoding method of the Sliver HTTP protocol respectively; and a preset number of POST requests and / or GET requests are obtained as requests to be detected; it is determined whether the proportion of the number of requests with valid Nonce values ​​in the requests to be detected reaches a preset threshold; if it is determined that both the Nonce value and the TOTP value conform to the encoding method of the Sliver HTTP protocol, and both the Nonce value and the TOTP value conform to the encoding method of the Sliver HTTP protocol, then it is determined that the network traffic corresponding to the first target request is Sliver HTTP protocol traffic. It can be seen that the embodiment of the present disclosure can combine the Nonce value and the TOTP value, as well as the validity detection of the Nonce value, to determine whether the network traffic corresponding to the first target request is Sliver HTTP protocol traffic, thereby further improving the detection accuracy of the SliverHTTP protocol traffic.

[0070] On the basis of the above embodiment, in order to further improve the detection accuracy of Sliver HTTP protocol traffic, it is also possible to determine whether the network traffic corresponding to the first target request is Sliver HTTP protocol traffic by detecting whether the Nonce value is valid. In this regard, the embodiment of the present disclosure provides another traffic detection method, referring to Figure 3 A flow chart of another flow detection method provided in an embodiment of the present disclosure, the method comprising:

[0071] S301: Obtain the first target request sent by the client to the server.

[0072] S302: Obtain the Nonce value and the TOTP value included in the URL of the first target request, and respectively determine whether the Nonce value and the TOTP value comply with the encoding method of the Sliver HTTP protocol.

[0073] Step S301 and step S302 may be specifically understood with reference to S101 and S102 in the above embodiment, and will not be described in detail here.

[0074] In an optional implementation, before obtaining the first target request sent by the client to the server, it may also include: detecting whether the server returns an error request after the client first requests to connect to the server based on the HTTPS protocol; if it is determined that the server returns an error request, executing the step of obtaining the first target request sent by the client to the server.

[0075] In actual applications, when the Sliver framework is configured with the HTTP protocol by default, the Trojan file generated by the Sliver framework first requests an HTTPS connection. If the connection fails, the server returns an error request, such as status code 400, and then tries the HTTP request connection. Therefore, the above process can be used as a detection condition for detecting HTTP protocol traffic.

[0076] S303: Count the heartbeat intervals sent by the client to the server, and determine whether the heartbeat intervals belong to the heartbeat intervals corresponding to the interactive real-time communication Session mode or the heartbeat intervals corresponding to the asynchronous communication Beacon mode.

[0077] In actual applications, the Trojan file will periodically use the GET method to send a heartbeat packet request task to the server to maintain the session connection with the server. Therefore, the embodiment of the present disclosure can also detect whether the network traffic corresponding to the first target request is Sliver HTTP protocol traffic based on the heartbeat packet.

[0078] Specifically, the heartbeat interval sent by the client to the server is counted, and it is determined whether the heartbeat interval belongs to the heartbeat interval corresponding to the Session mode or the heartbeat interval corresponding to the Beacon mode.

[0079] In the disclosed embodiments, Session mode and Beacon mode are two communication modes under the Sliver C2 framework; among them, Session mode, also known as interactive real-time communication mode, is used to establish an interactive session with immediate command execution and feedback, permanent network connection or long polling; Beacon mode, also known as asynchronous communication mode, the Trojan file periodically connects to C2 and obtains tasks, temporary network connection, the Trojan file enters a sleep state, and the command is not executed immediately, but queued and executed at the next Beacon check-in.

[0080] S304: If it is determined that the heartbeat interval belongs to the heartbeat interval corresponding to the Session mode or the heartbeat interval corresponding to the Beacon mode, and the Nonce value and the TOTP value both conform to the encoding method of the Sliver HTTP protocol, then it is determined that the network traffic corresponding to the first target request is Sliver HTTP protocol traffic.

[0081] In the disclosed embodiment, the heartbeat interval corresponding to the Session mode defaults to 1 to 3 seconds, and the heartbeat interval corresponding to the Beacon mode defaults to [60, 90).

[0082] In an embodiment of the present disclosure, if it is determined that the acquired heartbeat interval belongs to the heartbeat interval corresponding to the Session mode or the heartbeat interval corresponding to the Beacon mode, and the Nonce value and the TOTP value both conform to the encoding method of the Sliver HTTP protocol, then the network traffic corresponding to the first target request is determined to be the Sliver HTTP protocol traffic.

[0083] In the traffic detection method provided by the embodiment of the present disclosure, the first target request sent by the client to the server is obtained; the Nonce value and the TOTP value contained in the URL of the first target request are obtained, and it is determined whether the Nonce value and the TOTP value conform to the encoding method of the Sliver HTTP protocol respectively; and the heartbeat interval is counted, and it is determined whether the heartbeat interval belongs to the heartbeat interval corresponding to the Session mode or the heartbeat interval corresponding to the Beacon mode; if it is determined that the obtained heartbeat interval belongs to the heartbeat interval corresponding to the Session mode or the heartbeat interval corresponding to the Beacon mode, and the Nonce value and the TOTP value both conform to the encoding method of the Sliver HTTP protocol, then the network traffic corresponding to the first target request is determined to be the Sliver HTTP protocol traffic. It can be seen that the embodiment of the present disclosure can combine the heartbeat packet detection, and the Nonce value and the TOTP value to determine whether the network traffic corresponding to the first target request is the Sliver HTTP protocol traffic, thereby further improving the accuracy of the Sliver HTTP protocol traffic detection.

[0084] In addition, the embodiment of the present disclosure provides a traffic detection method applicable to both communication modes. Whether it is Session mode or Beacon mode, the above method can be used for detection with high accuracy.

[0085] In practical applications, in order to further improve the accuracy of Sliver HTTP protocol traffic detection, the embodiment of the present disclosure also provides a traffic detection method that can detect network traffic in the Sliver framework by combining multiple detection conditions (or detection points). Figure 4 As shown, it is a flow chart of another flow detection method provided by an embodiment of the present disclosure.

[0086] After inputting the network traffic to be detected, the Trojan file first attempts to connect to HTTPS. If the connection fails, the server returns a status code 400, and then tries the HTTP request. The above process can be used as an optional detection condition (or detection point), namely, detection condition 1.

[0087] Get the Nonce value and TOTP value contained in the URL of the first POST request, and determine whether the Nonce value and TOTP value conform to the encoding method of the Sliver HTTP protocol. This can be used as a mandatory detection condition. If it is determined that both the Nonce value and the TOTP value conform to the encoding method of the Sliver HTTP protocol, continue to execute subsequent detection conditions, that is, detection condition 2. If not, it is determined that the network traffic to be detected is not the HTTP protocol traffic in the Sliver framework.

[0088] Obtain a preset number of POST requests and / or GET requests, and determine whether the proportion of the number of requests with valid Nonce values ​​in the POST requests and / or GET requests to the preset number reaches a preset threshold, which can be used as a required detection condition, i.e., detection condition 3; if it is determined that the proportion of the number of requests with valid Nonce values ​​to the preset number reaches the preset threshold, continue to execute subsequent detection conditions; if the preset threshold is not reached, it is determined that the network traffic to be detected is not the HTTP protocol traffic in the Sliver framework.

[0089] The heartbeat interval in the Sliver framework is counted, and it is determined whether the heartbeat interval belongs to the heartbeat interval corresponding to the Session mode or the heartbeat interval corresponding to the Beacon mode. This can be used as a required detection condition, namely, detection condition 4. If it is determined that the heartbeat interval belongs to the heartbeat interval corresponding to the Session mode or the heartbeat interval corresponding to the Beacon mode, it is determined that the network traffic to be detected is the HTTP protocol traffic in the Sliver framework. If the preset threshold is not reached, it is determined that the network traffic to be detected is not the HTTP protocol traffic in the Sliver framework.

[0090] After determining that the network traffic to be detected is HTTP protocol traffic in the Sliver framework, an alarm is issued for the traffic.

[0091] Based on the above method embodiment, the present disclosure also provides a flow detection device, referring to Figure 5 , is a schematic diagram of the structure of a flow detection device provided in an embodiment of the present disclosure, the device comprising:

[0092] The first acquisition module 501 is used to acquire a first target request sent by the client to the server; wherein the first target request carries a uniform resource locator URL;

[0093] The second acquisition module 502 is used to obtain the Nonce value and the TOTP value contained in the URL of the first target request, and respectively determine whether the Nonce value and the TOTP value conform to the encoding method of the Sliver HTTP protocol;

[0094] The first determination module 503 is used to determine that the network traffic corresponding to the first target request is Sliver HTTP protocol traffic if it is determined that the Nonce value and the TOTP value both conform to the encoding method of the SliverHTTP protocol.

[0095] In an optional implementation, the device further includes:

[0096] A third acquisition module is used to obtain a preset number of POST requests and / or GET requests between the penetration test end and the penetration service end as requests to be detected;

[0097] A second determination module is used to determine whether the ratio of the number of requests with valid Nonce values ​​in the requests to be detected to the preset number reaches a preset threshold;

[0098] Accordingly, the first determining module includes:

[0099] The first determination submodule is used to determine that the network traffic corresponding to the first target request is Sliver HTTP protocol traffic if the ratio of the number of requests for which the Nonce value is valid to the preset number reaches the preset threshold, and the Nonce value and the TOTP value both conform to the encoding method of the Sliver HTTP protocol.

[0100] In an optional implementation manner, the request to be detected includes a second target request, and the device further includes:

[0101] A third determination module is used to determine the attribute value of the Nonce value corresponding to the second target request, and delete the characters filled in the attribute value to obtain a number to be processed;

[0102] A matching module, used for dividing the number to be processed by a hard-coded constant value to obtain a remainder, and matching the remainder with an encoder ID;

[0103] The fourth determination module is used to determine that the Nonce value corresponding to the second target request is valid if it is determined that the remainder matches any encoder ID successfully.

[0104] In an optional implementation, the device further includes:

[0105] A statistics module, used for counting the heartbeat interval sent by the client to the server, and determining whether the heartbeat interval belongs to the heartbeat interval corresponding to the interactive real-time communication Session mode or the heartbeat interval corresponding to the asynchronous communication Beacon mode;

[0106] Accordingly, the first determining module includes:

[0107] The second determination submodule is used to determine that the network traffic corresponding to the first target request is Sliver HTTP protocol traffic if it is determined that the heartbeat interval belongs to the heartbeat interval corresponding to the Session mode or the heartbeat interval corresponding to the Beacon mode, and the Nonce value and the TOTP value both conform to the encoding method of the SliverHTTP protocol.

[0108] In an optional implementation, the device further includes:

[0109] A detection module, used to detect whether the server returns an error request after the client requests to connect to the server based on the HTTPS protocol for the first time;

[0110] The fifth determination module is used to execute the step of obtaining the first target request sent by the client to the server if it is determined that the server returns the error request.

[0111] In an optional implementation, the first target request includes the first POST request sent by the client to the server.

[0112] In an optional implementation, the client and the server belong to Sliver, an open source cross-platform implant framework that supports client and server structures.

[0113] In the flow detection device provided by the embodiment of the present disclosure, the first target request sent by the client to the server is obtained; the Nonce value and TOTP value contained in the URL of the first target request are obtained, and whether the Nonce value and the TOTP value comply with the encoding method of the Sliver HTTP protocol are determined respectively; if it is determined that both the Nonce value and the TOTP value comply with the encoding method of the Sliver HTTP protocol, the network flow corresponding to the first target request is determined to be Sliver HTTP protocol flow. It can be seen that the embodiment of the present disclosure can determine whether the network flow corresponding to the first target request is Sliver HTTP protocol flow based on the Nonce value and the TOTP value in the first target request, thereby improving the detection accuracy of the SliverHTTP protocol flow.

[0114] In addition to the above-mentioned method and apparatus, the embodiments of the present disclosure further provide a computer-readable storage medium, in which instructions are stored. When the instructions are executed on a terminal device, the terminal device implements the flow detection method described in the embodiments of the present disclosure.

[0115] The embodiment of the present disclosure further provides a computer program product, which includes a computer program / instructions. When the computer program / instructions are executed by a processor, the flow detection method described in the embodiment of the present disclosure is implemented.

[0116] In addition, the present disclosure also provides a flow detection device, see Figure 6 As shown, it may include:

[0117] Processor 601, memory 602, input device 603 and output device 604. The number of processors 601 in the flow detection device can be one or more. Figure 6 In some embodiments of the present disclosure, the processor 601, the memory 602, the input device 603 and the output device 604 may be connected via a bus or other means, wherein: Figure 6 The example of connecting through bus is taken in the following.

[0118] The memory 602 can be used to store software programs and modules. The processor 601 executes various functional applications and data processing of the flow detection device by running the software programs and modules stored in the memory 602. The memory 602 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, at least one application required for a function, etc. In addition, the memory 602 can include a high-speed random access memory, and can also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. The input device 603 can be used to receive input digital or character information, and generate signal input related to user settings and function control of the flow detection device.

[0119] Specifically in this embodiment, the processor 601 will load the executable files corresponding to the processes of one or more applications into the memory 602 according to the following instructions, and the processor 601 will run the applications stored in the memory 602, thereby realizing the various functions of the above-mentioned traffic detection device.

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

[0121] The above description is only a specific embodiment of the present disclosure, so that those skilled in the art can understand or implement the present disclosure. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present disclosure. Therefore, the present disclosure will not be limited to the embodiments described herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A flow detection method, characterized in that: The method comprises: Obtaining a first target request sent by a client to a server; wherein the first target request carries a uniform resource locator URL; Obtaining a Nonce value and a TOTP value contained in the URL of the first target request, and determining whether the Nonce value and the TOTP value conform to an encoding method of the SliverHTTP protocol; If it is determined that both the Nonce value and the TOTP value conform to the encoding method of the SliverHTTP protocol, it is determined that the network traffic corresponding to the first target request is SliverHTTP protocol traffic.

2. The method according to claim 1, characterized in that Before determining that the network traffic corresponding to the first target request is SliverHTTP protocol traffic, the method further includes: Obtain a preset number of POST requests and / or GET requests between the client and the penetration server as requests to be detected; Determine whether the ratio of the number of requests with valid Nonce values ​​in the requests to be detected to the preset number reaches a preset threshold; Correspondingly, if it is determined that both the Nonce value and the TOTP value conform to the encoding method of the SliverHTTP protocol, determining that the network traffic corresponding to the first target request is SliverHTTP protocol traffic includes: If it is determined that the proportion of the number of requests with valid Nonce values ​​to the preset number reaches the preset threshold, and the Nonce value and the TOTP value both conform to the encoding method of the SliverHTTP protocol, then it is determined that the network traffic corresponding to the first target request is SliverHTTP protocol traffic.

3. The method according to claim 2, characterized in that The request to be detected includes a second target request, and before determining whether the proportion of the number of requests with valid Nonce values ​​in the request to be detected to the preset number reaches a preset threshold, the method further includes: Determine the attribute value of the Nonce value corresponding to the second target request, and delete the characters filled in the attribute value to obtain a number to be processed; Divide the number to be processed by the hard-coded constant value to obtain a remainder, and match the remainder with the encoder ID; If it is determined that the remainder successfully matches any encoder ID, it is determined that the Nonce value corresponding to the second target request is valid.

4. The method according to claim 1, characterized in that: Before determining that the network traffic corresponding to the first target request is SliverHTTP protocol traffic, the method further includes: Counting the heartbeat intervals sent by the client to the server, and determining whether the heartbeat intervals belong to the heartbeat intervals corresponding to the interactive real-time communication Session mode or the heartbeat intervals corresponding to the asynchronous communication Beacon mode; Correspondingly, if it is determined that both the Nonce value and the TOTP value conform to the encoding method of the SliverHTTP protocol, determining that the network traffic corresponding to the first target request is SliverHTTP protocol traffic includes: If it is determined that the heartbeat interval belongs to the heartbeat interval corresponding to the Session mode or the heartbeat interval corresponding to the Beacon mode, and the Nonce value and the TOTP value both conform to the encoding method of the SliverHTTP protocol, then it is determined that the network traffic corresponding to the first target request is SliverHTTP protocol traffic.

5. The method according to claim 1, characterized in that: Before obtaining the first target request sent by the client to the server, the method further includes: Detecting whether the server returns an error request after the client requests to connect to the server for the first time based on the HTTPS protocol; If it is determined that the server returns the error request, the step of obtaining the first target request sent by the client to the server is performed.

6. The method according to claim 1, characterized in that The first target request includes the first POST request sent by the penetration client to the server.

7. The method according to claim 1, characterized in that The client and the server belong to Sliver, an open source cross-platform C2 framework that supports the client and server structures.

8. A flow detection device, characterized in that: The device comprises: A first acquisition module is used to acquire a first target request sent by a client to a server; wherein the first target request carries a uniform resource locator URL; A second acquisition module is used to obtain a Nonce value and a TOTP value contained in the URL of the first target request, and respectively determine whether the Nonce value and the TOTP value conform to the encoding method of the SliverHTTP protocol; The first determination module is used to determine that the network traffic corresponding to the first target request is SliverHTTP protocol traffic if it is determined that the Nonce value and the TOTP value both conform to the encoding method of the SliverHTTP protocol.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores instructions, and when the instructions are executed on a terminal device, the terminal device implements the method according to any one of claims 1 to 7.

10. A flow detection device, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the method according to any one of claims 1 to 7 is implemented.