WebShell communication encryption chain identification method and related device

By employing a multi-layered processing algorithm with pre-defined priorities and a readability scoring mechanism, combined with parallel key set verification of the symmetric encryption layer, encrypted WebShell communications can be automatically cracked, solving the problem of balancing cracking success rate and efficiency, and achieving highly efficient cracking.

CN123184877APending Publication Date: 2026-11-27SHANGHAI DOUXIANG INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611151214.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-31
Publication Date
2026-11-27

AI Technical Summary

Technical Problem

Existing technologies struggle to balance success rate and efficiency when cracking encrypted WebShell communications, resulting in low efficiency.

Method used

It employs a multi-layered processing algorithm with preset priority, combined with a readability scoring mechanism and preset stopping conditions. Through parallel key set verification of the symmetric encryption layer, it automatically explores the decryption path, avoiding exhaustive search of all permutations and redundant calculations.

Benefits of technology

While ensuring a high success rate in cracking, it improves cracking efficiency, avoids manual selection, and achieves a balance between the breadth of algorithm coverage, the accuracy of judgment, and the depth of key processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123184877A_ABST
    Figure CN123184877A_ABST
Patent Text Reader

Abstract

The present disclosure provides a WebShell communication encryption chain identification method and related equipment; wherein the method comprises: obtaining original data of encrypted WebShell communication, extracting to-be-processed data from the original data according to the data type of the original data; starting from the to-be-processed data, sequentially performing decryption processing of the current layer processing algorithm through the multi-layer processing algorithm arranged according to the preset priority; each layer processing algorithm includes at least one algorithm, and the multi-layer processing algorithm includes a symmetric encryption algorithm of a symmetric encryption layer; for the processing result of each algorithm in the current layer processing algorithm, readable score calculation is performed to obtain the score result of the current layer processing algorithm; if the current layer is a symmetric encryption layer, the decryption processing and the readability score calculation are performed in parallel through the preset key set and the symmetric encryption algorithm; when the score result of any layer processing algorithm meets the preset stop condition, the encryption chain information of the encrypted WebShell communication is generated. The present disclosure can balance the cracking success rate and cracking efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of vulnerability detection technology, and in particular to a method and related equipment for identifying encrypted chains in WebShell communication. Background Technology

[0002] In cybersecurity forensics scenarios, for acquired encrypted WebShell communication payloads, most existing technologies focus on expanding the breadth of algorithms or keys to attempt cracking, incorporating more algorithms and keys into the cracking process to increase the success rate. However, this also leads to increasingly lower cracking efficiency, making it difficult to strike a balance between success rate and efficiency. Summary of the Invention

[0003] In view of this, the purpose of this disclosure is to provide a method and related equipment for identifying the encrypted chain of WebShell communication, so as to balance the success rate and efficiency of cracking.

[0004] In a first aspect, embodiments of this disclosure provide a method for identifying the encrypted chain of WebShell communication. The method includes: acquiring the original data of the encrypted WebShell communication; extracting data to be processed from the original data according to the data type of the original data; performing decryption processing of the current layer processing algorithm sequentially, starting from the data to be processed, using a multi-layer processing algorithm arranged according to a preset priority; wherein each layer processing algorithm includes at least one algorithm, and the multi-layer processing algorithm includes a symmetric encryption algorithm for a symmetric encryption layer; calculating a readability score for the processing result of each algorithm in the current layer processing algorithm to obtain a score result for the current layer processing algorithm; if the current layer is the symmetric encryption layer, performing decryption processing and readability score calculation in parallel using a preset key set and the symmetric encryption algorithm; and generating encrypted chain information of the encrypted WebShell communication when the score result of any layer processing algorithm meets a preset stopping condition.

[0005] Optionally, the step of obtaining the raw data of encrypted WebShell communication and extracting data to be processed from the raw data according to the data type of the raw data includes: obtaining a network traffic packet file as the raw data of encrypted WebShell communication; if the raw data is a Hypertext Transfer Protocol request message, extracting the request body or web address query parameters from the Hypertext Transfer Protocol request message as data to be processed; if the raw data is Web Object Tag Format data, parsing the field values ​​of the Web Object Tag Format data as data to be processed; if the raw data is a key-value pair form, parsing the key-value pairs of the key-value pair form as data to be processed; if the raw data is a plain ciphertext string, using the plain ciphertext string as data to be processed.

[0006] Optionally, the multi-layer processing algorithms, ranked from high to low according to a preset priority, include: keyless encoding layer algorithms, symmetric encryption layer algorithms requiring key traversal, and decompression algorithms; wherein, the encoding layer algorithms include any of the following: web address encoding / decoding, hexadecimal encoding / decoding, secure hexadecimal encoding / decoding of web addresses, hexadecimal encoding / decoding, 13-bit rotation encoding / decoding, string reversal, Unicode encoding / decoding, secondary hexadecimal encoding / decoding, and hexadecimal encoding variant decoding; the symmetric encryption algorithms include any of the following: Advanced Encryption Standard (AES) decryption, Data Encryption Standard (DES) decryption, and Abalone encryption algorithm decryption; the decompression algorithms include any of the following: compressed format decompression algorithms and compact format decompression algorithms.

[0007] Optionally, the step of calculating a readability score for the processing result of each algorithm in the current layer processing algorithm to obtain the score result of the current layer processing algorithm includes: for the processing result of each algorithm in the current layer processing algorithm, calculating the proportion of printable characters and the number of garbled characters in the processing result; wherein, printable characters include ASCII alphanumeric characters, Chinese characters, Chinese punctuation, specified English symbols and whitespace characters, and garbled characters include characters that do not belong to the range of ASCII characters, CJK unified Chinese characters, Chinese punctuation and full-width characters; and determining the score result of the current layer processing algorithm based on the proportion of printable characters and the number of garbled characters in the processing result.

[0008] Optionally, the step of determining the scoring result of the current layer processing algorithm based on the printable character ratio and the number of garbled characters in the processing result includes: when the string length of the processing result is greater than or equal to a preset length threshold, determining whether the printable character ratio is greater than or equal to a first preset ratio threshold; when the string length of the processing result is less than the preset length threshold, determining whether the printable character ratio is greater than or equal to a second preset ratio threshold; wherein, the second preset ratio threshold is greater than the first preset ratio threshold; determining whether the number of garbled characters is less than or equal to a preset number upper limit; if the printable character ratio reaches the corresponding preset ratio threshold and the number of garbled characters does not exceed the preset number upper limit, then it is determined that the scoring result of the current layer processing algorithm indicates that it meets the preset stopping condition; otherwise, it indicates that it does not meet the preset stopping condition.

[0009] Optionally, the step of determining the scoring result of the current layer processing algorithm based on the proportion of printable characters and the number of garbled characters in the processing result includes: if the processing result is a decoding result of Unicode hexadecimal encoding, then splitting the processing result into even-indexed substrings and odd-indexed substrings according to odd-indexed and even-indexed substrings; if the proportion of printable characters in the even-indexed substring is greater than or equal to a third preset proportion threshold, and the number of garbled characters is equal to zero, and the odd-indexed substring is a delimiter, then determining that the scoring result of the current layer processing algorithm indicates that it meets the preset stopping condition; otherwise, indicating that it does not meet the preset stopping condition.

[0010] Optionally, if the current layer is the symmetric encryption layer, the steps of performing decryption processing and readability score calculation in parallel using a preset key set and the symmetric encryption algorithm include: if the current layer is the symmetric encryption layer, combining each candidate key in the preset key set with each encryption mode, each padding method, and each initial vector of the current symmetric encryption layer to obtain a candidate combination matrix; performing decryption operations in parallel for each combination in the candidate combination matrix, and performing readability score calculation in parallel for each decryption result; when the score result of any combination in the candidate combination matrix meets a preset stopping condition, determining the corresponding combination as the decryption parameter of the current symmetric encryption layer, stopping other candidate attempts in the current layer, and using the decryption result of the current layer as the processing result of the next layer to continue the subsequent decryption processing.

[0011] Optionally, when the scoring result of any layer processing algorithm meets the preset stopping condition, the step of generating the encrypted chain information of the encrypted WebShell communication includes: when the scoring result of any layer processing algorithm meets the preset stopping condition, recording the algorithm name, encryption mode, padding method and key identifier used by each layer in the decryption order, generating the encrypted chain and the decrypted plaintext content as the encrypted chain information of the encrypted WebShell communication.

[0012] Secondly, embodiments of this disclosure provide an encrypted chain identification device for WebShell communication. The device includes: an acquisition module, configured to acquire raw data of encrypted WebShell communication and extract data to be processed from the raw data according to the data type of the raw data; a decryption module, configured to perform decryption processing of the current layer processing algorithm sequentially, starting from the data to be processed, using a multi-layer processing algorithm arranged according to a preset priority; wherein each layer processing algorithm includes at least one algorithm, and the multi-layer processing algorithm includes a symmetric encryption algorithm for a symmetric encryption layer; a scoring module, configured to perform readability scoring calculation on the processing result of each algorithm in the current layer processing algorithm to obtain a scoring result of the current layer processing algorithm; a de-scoring module, configured to perform decryption processing and readability scoring calculation in parallel using a preset key set and the symmetric encryption algorithm if the current layer is the symmetric encryption layer; and a generation module, configured to generate encrypted chain information of the encrypted WebShell communication when the scoring result of any layer processing algorithm meets a preset stopping condition.

[0013] Thirdly, embodiments of this disclosure provide an electronic device, including a processor and a memory, wherein the memory stores machine-executable instructions that can be executed by the processor, and the processor executes the machine-executable instructions to implement the above-described method for identifying encrypted chains in WebShell communication.

[0014] Fourthly, embodiments of this disclosure provide a computer-readable storage medium storing computer-executable instructions. When the computer-executable instructions are invoked and executed by a processor, the computer-executable instructions cause the processor to implement the aforementioned method for identifying the encrypted chain of WebShell communication.

[0015] The embodiments disclosed herein bring the following beneficial effects: The aforementioned method and related equipment for identifying encrypted chains in WebShell communication, through a multi-layered processing algorithm with preset priorities, ensures comprehensive coverage of various algorithms while guiding exploration with the most probabilistic path, avoiding efficiency loss due to exhaustive searching of all permutations. By combining a readability scoring mechanism with preset stopping conditions, it replaces manual judgment with objective quantitative standards to avoid missed judgments, and terminates in time when the score meets the standard to avoid redundant calculations. For the symmetric encryption layer, a preset key set is set for parallel verification to compensate for cracking failures caused by insufficient experience coverage in unknown key scenarios. Simultaneously, parallel processing offsets the time cost of key traversal. Overall, the cracking process does not compromise on the breadth of algorithm coverage, the accuracy of judgment, and the depth of key processing, while also being constrained in terms of search path convergence, termination timing control, and acceleration of time-consuming steps. This balances cracking success rate and cracking efficiency, avoiding a purely manual trade-off between the two.

[0016] Other features and advantages of this disclosure will be set forth in the following description and will be apparent in part from the description or may be learned by practicing the disclosure. The objects and other advantages of this disclosure are realized and obtained through the structures particularly pointed out in the description, claims and drawings.

[0017] To make the above-mentioned objects, features and advantages of this disclosure more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description

[0018] To more clearly illustrate the technical solutions in the specific embodiments of this disclosure or the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this disclosure. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0019] Figure 1 This is a flowchart of one embodiment of the encrypted chain identification method for WebShell communication in this disclosure; Figure 2 A schematic diagram of an encrypted chain identification device for WebShell communication provided in an embodiment of this disclosure; Figure 3 This is a schematic diagram of an electronic device provided in an embodiment of the present disclosure. Detailed Implementation

[0020] To make the objectives, technical solutions, and advantages of the embodiments of this disclosure clearer, the technical solutions of this disclosure will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this disclosure, and not all embodiments. Based on the embodiments of this disclosure, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this disclosure.

[0021] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in this disclosure, claims, and accompanying drawings are used to distinguish similar objects and are not necessarily used to describe a particular order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms “comprising” or “having,” and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0022] For ease of understanding, the specific process of the embodiments of this disclosure is described below. Please refer to [link / reference]. Figure 1 One embodiment of the encryption chain identification method for WebShell communication in this disclosure includes: Step S10: Obtain the raw data of the encrypted WebShell communication, and extract the data to be processed from the raw data according to the data type of the raw data; Understandably, in real-world cybersecurity forensics scenarios, WebShell communication data comes from diverse sources. It could be a single HTTP request message extracted from server logs, a serialized communication object extracted from terminal memory, or even encoded ciphertext string fragments left behind by the attacker. Data from these sources can all serve as raw data for encrypted WebShell communication, used for identifying the encryption chain. These data from different sources differ in syntactic structure. Requiring analysts to manually trim and convert data according to different input formats before feeding it into the decryption engine not only increases manual intervention but also introduces analytical errors due to improper format processing.

[0023] This step uses data type awareness to identify the structural category of the original data and performs differentiated payload location and extraction operations accordingly to obtain the content of the original data that carries the encrypted WebShell communication payload, i.e., the data to be processed. It should be noted that the data to be processed has been stripped of the transport protocol header, structured encapsulation tags, and irrelevant fields. This preprocessing step improves the consistency of subsequent algorithm queue execution and readability scoring.

[0024] In real-world network environments, encrypted payloads may span multiple data packets (such as TCP segmentation or HTTP chunked transmission) or be nested within multiple layers of protocol encapsulation (such as the encrypted body within plaintext HTTP after HTTPS decryption). When extracting data to be processed from the original data based on its data type, further processing can be performed, such as reassembling the original data according to TCP sequence numbers or performing chunked transmission and concatenation, to more completely preserve the encrypted data.

[0025] In this embodiment, the raw data of encrypted WebShell communication can be WebShell communication data that comes directly from the network forensics collection process and has not undergone any reverse decoding or decryption processing. Specifically, it can include: network traffic packet files (such as pcap, pcapng format), text-based Hypertext Transfer Protocol request or response messages, structured data objects, and independent ciphertext string fragments. No specific limitation is made here.

[0026] In this embodiment, the data type of the raw data is the format category of the raw data at the syntax structure or protocol level. The classification of different data types is based on the structural characteristics of the data itself, rather than its content semantics. It can be initially determined by the file extension or the magic number of the file header, by matching structured syntax features through regular expressions, or by parsing attempts (such as trying to parse it into JSON, if successful, classifying it into that type, if it fails, trying the next type). The data type can also be manually specified by the analyst when inputting the data, but the specifics are not limited here.

[0027] Step S20: Starting from the data to be processed, the decryption process of the current layer processing algorithm is performed sequentially through a multi-layer processing algorithm arranged according to a preset priority; wherein, each layer processing algorithm includes at least one algorithm, and the multi-layer processing algorithm includes a symmetric encryption algorithm for the symmetric encryption layer. This step models the decryption process as a reverse stripping process of the encrypted chain, using a preset priority as a guiding strategy for the exploration order. It applies the candidate algorithm set of the current layer to the current intermediate result in turn, enabling the correct decryption path to be explored automatically without knowing the original encrypted chain construction method.

[0028] In this embodiment, the preset priority is the pre-set processing order of each level type in the multi-layer processing algorithm. It can be determined based on the objective hierarchical rules in the construction process of WebShell communication payload. For example, the preset priority from high to low is: encoding algorithm → symmetric encryption algorithm → decompression algorithm. This order holds true for any WebShell communication that conforms to the HTTP transmission standard and is not affected by specific attack tools or custom variants.

[0029] In one implementation, the encoding layer may include any of the following candidate algorithms: web address decoding, 64-bit decoding, hexadecimal decoding, 13-bit rotation decoding, string reversal, and Unicode escape decoding; the symmetric encryption layer may include any of the following candidate algorithms: Advanced Encryption Standard decryption (supporting multiple modes and padding combinations), Data Encryption Standard decryption (supporting multiple modes), and Abalone encryption algorithm decryption; and the decompression layer may include any of the following candidate algorithms: compressed format decompression and compacted format decompression. Specific details are not limited here.

[0030] When decrypting data starting from the data to be processed and sequentially performing the current layer processing algorithm, the highest priority layer processing algorithm is first determined as the current layer processing algorithm according to the preset priority. The data to be processed is decrypted through the current layer processing algorithm. If the readability score of the processing result of any algorithm in the current layer processing algorithm meets the preset stopping condition, the next layer or the next algorithm will not be entered. Otherwise, the processing result of each algorithm in the current layer processing algorithm is used as an intermediate result and entered into the next layer processing algorithm, until the preset stopping condition is met.

[0031] In one implementation, before executing the decryption operation of the current layer's processing algorithm, feature identification can be performed on the current intermediate result. Based on the identification results, the order of candidate algorithms for the current layer can be dynamically adjusted, or an algorithm can be directly selected. For example, if all characters in the current intermediate result are within the hexadecimal character set (0-9 and AF / af), hexadecimal decoding is prioritized over hexadecimal decoding; if all characters in the current intermediate result are within the hexadecimal character set, hexadecimal decoding is prioritized; if the header of the current intermediate result contains a compressed format magic number, the encoding layer is skipped, and the decompression layer is directly entered; if the length of the current intermediate result is exactly a multiple of 8 and the distribution is nearly uniform and random, Data Encryption Standard (DES) decryption is prioritized over Advanced Encryption Standard (AES) decryption (because AES blocks are 16 bytes long, while DES blocks are 8 bytes long; the length feature can narrow down the candidate algorithm range). This dynamic selection strategy can further reduce unnecessary algorithm attempts and improve decryption efficiency.

[0032] Step S30: For the processing results of each algorithm in the current layer, calculate the readability score to obtain the score result of the current layer processing algorithm; In this embodiment of the disclosure, during the automatic exploration process of the multi-layer encryption chain, decoding, decryption, decompression and other operations are performed layer by layer. After each layer of operation is completed, an intermediate result is generated. This embodiment calculates the readability score of the intermediate result to determine the validity of each decryption intermediate result, thereby determining whether the decryption intermediate result is a successful decryption result without relying on manual inspection.

[0033] In one implementation, after each candidate algorithm in the current layer (i.e., each algorithm in the current layer's processing algorithms) completes the decryption process, a readability score is calculated for the processing result produced by that algorithm. If the score is passed and the result is determined to be the final plaintext, the exploration terminates. If the score is passed but the result is determined to be an intermediate product, the process proceeds to the next layer. If the score fails, the next candidate algorithm in the same layer is triggered or a backtracking is triggered.

[0034] In this embodiment, the current layer is a dynamic concept that changes continuously as the decryption process progresses. Initially, it points to the outermost layer (e.g., the encoding algorithm with the highest preset priority). After successfully passing through each layer, it moves to an inner layer (to a layer with a lower preset priority). The processing algorithm is the calculation method that specifically performs the decryption operation at this layer, and may include encoding / decoding algorithms, symmetric encryption / decryption algorithms, decompression algorithms, etc.

[0035] In this embodiment, the processing result is the output data generated after the current layer processing algorithm performs a decryption operation on the input data. Specifically, starting from the data to be processed, when each layer of decryption processing is executed in sequence, the input of a certain layer algorithm is the intermediate result received by that layer (the outermost layer is the data to be processed extracted in the previous step). After the algorithm is executed, a new byte sequence or string is generated as the output, which is the processing result. This processing result is used as the analysis object in this scoring calculation.

[0036] When calculating readability scores, the score can be calculated by statistically analyzing the proportion of printable characters and / or the number of garbled characters. Both printable characters and garbled characters can be preset, and the specifics are not limited here. In some implementations, the score result may include a specific numerical value for the printable proportion, a specific number of garbled characters, and intermediate judgment states indicating whether each has reached its respective threshold; the specifics are not limited here.

[0037] When calculating readability scores, information entropy can also be incorporated. Information entropy measures the uniformity of values ​​within a byte sequence. For example, the entropy of purely random data (such as correctly encrypted ciphertext) is close to the maximum value of 8 bits per byte, while the entropy of natural language text is typically between 4 and 6 bits per byte, and the entropy of compressed data is between 7 and 8 bits per byte (close to random). By jointly determining the printability ratio, scrambling count, and information entropy, different types of data can be identified more accurately. For instance, a low printability ratio but also a low scrambling count, coupled with an entropy close to 8, may indicate that the data is encrypted or compressed, triggering a deeper decryption exploration rather than direct discarding.

[0038] Step S40: If the current layer is a symmetric encryption layer, then decryption and readability score calculation are performed in parallel using a preset key set and a symmetric encryption algorithm. In this implementation, when the current layer is identified as a symmetric encryption layer, instead of using a single default key for a one-time attempt, all candidate keys are extracted from a preset key set. Each candidate key is then combined with multiple encryption modes, padding methods, and initialization vectors supported by the current layer to form a candidate combination matrix. Each combination in this matrix represents a possible decryption parameter configuration. All combinations in this matrix can be decrypted in parallel, and readability scores are calculated for each decryption result in parallel. Once the decryption result of any combination passes the readability score, the system confirms that the combination is the correct decryption parameter for the current layer and stops further candidate attempts for the current layer.

[0039] In this embodiment, the preset key set is a set of candidate keys prepared in advance before performing the symmetric encryption layer decryption operation. Its sources may include: a built-in default key dictionary, user configuration, and external dictionary files; the specific sources are not limited here. The external dictionary file may contain key lists collected from publicly available cryptographic dictionaries, historical data breaches, or key lists customized by analysts based on the historical behavioral patterns of specific attack organizations. The built-in dictionary can be arranged according to the market popularity and actual usage frequency of the tool; the more popular the tool, the higher its default key will be listed.

[0040] When performing decryption and readability score calculations in parallel, multiple candidate keys in the preset key set can be combined with various modes, padding methods, and initial vectors of the current symmetric encryption algorithm to perform decryption operations and subsequent readability score calculations simultaneously within the same time interval, instead of processing them serially one by one.

[0041] In one implementation, a key hit history table can be maintained, recording the keys that have been successfully hit in the current batch analysis task, along with their corresponding algorithm types and modes. When processing new data and entering the symmetric encryption layer, the system first attempts to use the successful keys recorded in the hit history table. If a key in the hit history table can successfully decrypt the current data, there is no need to traverse the rest of the preset key set; if it cannot decrypt, the system then traverses the preset key set from the beginning according to the normal process. This implementation further improves the overall efficiency when continuously processing multiple sets of data by utilizing the key reuse feature in batch analysis.

[0042] Step S50: When the scoring result of any layer processing algorithm meets the preset stopping condition, generate the encrypted chain information of the encrypted WebShell communication.

[0043] In this embodiment of the disclosure, during the cryptographic chain exploration process, when a candidate algorithm at a certain layer completes decryption and its readability score reaches a preset termination criterion, the execution of this step is triggered. The preset termination conditions may include: the score result is passed and there is no need to continue exploration. Specifically, if the processing result of the current layer is readable but still has identifiable encoding features (such as being composed entirely of Base64 characters and having a length that is an integer multiple of the Base64 encoding, or having a high printability rate but being essentially encoded data), it is not considered as the final plaintext, but is marked as a "suspected intermediate layer" and deeper algorithms are explored; if the processing result of the current layer has already presented as natural language text or structured data (such as containing the complete structure of English words or the grammatical features of JSON / XML), and there are no identifiable residual encoding features, it is confirmed as the final plaintext and termination is triggered.

[0044] The decryption chain information can include a complete record of parameters such as the algorithm name, encryption mode, padding method, and key identifier used at each layer. The encryption chain information can consist of two parts: the encryption chain scheme and the decrypted plaintext content. The encryption chain scheme contains a complete record of each decryption operation performed from the original ciphertext to the final plaintext, arranged in the order of decryption execution (i.e., the stripping order from the outermost layer to the innermost layer). Each layer's record must at least include the name of the algorithm used at that layer. For algorithms requiring parameter configuration (such as symmetric encryption algorithms), it also includes the encryption mode, padding method, and key identifier information used at that layer (such as the key's index in a preset key set or the key's hash digest). This structured record of the encryption chain scheme allows any third party, upon obtaining the scheme, to independently reproduce the entire decryption process, starting from the same original data, following the same algorithm order and parameter configuration, and obtaining the same plaintext result.

[0045] Plaintext content is the final output after the execution of the encrypted chain scheme, that is, the instructions, file content, or command execution results actually transmitted by the attacker through WebShell communication. Plaintext content can be output in the form of raw byte sequence, or it can be converted into a displayable text form according to the character encoding of the content (such as UTF-8, GBK, etc.).

[0046] The information organization format of the encrypted chain information can be flexibly adjusted according to different use cases. For the analysis of a single piece of communication data, the encrypted chain information can be presented in structured text or JSON format; for the analysis of a large amount of communication data in batch PCAP files, the encrypted chain information can be organized in tabular form, with each row corresponding to a communication stream, including the five-tuple information of the stream, the encryption chain scheme and the plaintext content.

[0047] After generating the encrypted chain information, a cryptographic hash calculation (such as SHA-256) can be performed on the complete content of the encrypted chain scheme and the final plaintext content to obtain a digital digest value. This digest value is then digitally signed (using the private key held by the system). The encrypted chain information body, hash digest value, and digital signature value are output simultaneously. Upon receiving this output, a third party can recalculate the hash value of the encrypted chain information and compare it with the output hash digest value. If they match, it indicates that the data has not been tampered with. This implementation method provides cryptographic integrity protection and source authentication for the encrypted chain information, enhancing its evidentiary value.

[0048] In one implementation, the generated encryption chain information can be exported as a separate configuration file. This configuration file is then imported when processing new data to be decrypted (i.e., data to be processed). After import, the encryption chain scheme in the configuration file is directly used to decrypt the new data, skipping the encryption chain exploration phase. This means only the decryption operation chain (processing sequentially according to the algorithm order and parameters recorded in the configuration file) and the final readability verification are executed. Once the decryption result of the new data passes verification, a plaintext result reusing the encryption chain scheme is output. This implementation is suitable for batch processing of communication data with the same encryption structure, significantly reducing the computational overhead of repeated exploration.

[0049] The WebShell communication encryption chain identification method provided by the above implementation method ensures comprehensive coverage of various algorithms while guiding the exploration with the most probabilistic path through a multi-layer processing algorithm with preset priority, avoiding the efficiency loss caused by exhaustive search of all permutations. Through the combination of a readability scoring mechanism and preset stopping conditions, it replaces manual judgment with objective quantitative standards to avoid missed judgments, and terminates in time when the score meets the standard to avoid redundant calculations. For the symmetric encryption layer, a preset key set is set for parallel verification to compensate for the failure to crack due to insufficient experience coverage in the case of unknown keys. At the same time, parallel processing offsets the time cost of key traversal. Overall, the cracking process does not compromise on the breadth of algorithm coverage, the accuracy of judgment, and the depth of key processing. At the same time, it is constrained in terms of search path convergence, termination timing control, and acceleration of time-consuming links, thus taking into account both cracking success rate and cracking efficiency, avoiding manual trade-offs between the two.

[0050] Next, we will explain the specific identification method of the encryption chain in WebShell communication.

[0051] In one implementation, the step of obtaining raw data from encrypted WebShell communication and extracting data to be processed from the raw data according to the data type of the raw data includes: obtaining a network traffic packet file as the raw data of encrypted WebShell communication; if the raw data is a Hypertext Transfer Protocol (HTTP) request message, extracting the request body or web address query parameters from the HTTP request message as data to be processed; if the raw data is Web Object Tag format data, parsing the field values ​​of the Web Object Tag format data as data to be processed; if the raw data is a key-value pair form, parsing the key-value pairs of the key-value pair form as data to be processed; and if the raw data is a plain ciphertext string, using the plain ciphertext string as data to be processed.

[0052] This implementation provides various strategies for identifying and extracting differentiated payloads from various raw data types. Among them, network traffic packet files can include a collection of raw network data packets captured at the network link layer or network layer by traffic capture tools, usually stored in pcap or pcapng format. Hypertext Transfer Protocol request messages include request messages sent by clients to servers that conform to the HTTP / 1.1 or HTTP / 2 protocol specifications. JSON (JavaScript Object Notation) is a lightweight data exchange format that uses a text format completely independent of programming languages ​​to store and represent data objects. Key-value pairs refer to form data organized in the form of "key=value". Plain ciphertext strings refer to a continuous sequence of characters or bytes that does not contain any protocol headers, structured tags, or metadata.

[0053] In this embodiment, the network traffic packet file is a binary structured file containing multiple data frames. Each data frame contains multi-layer protocol encapsulation starting from the link layer (such as the Ethernet header), including at least the Ethernet frame header (containing the source MAC address, destination MAC address, and Ethernet type), the IP header (containing the source IP address, destination IP address, and protocol type), the transport layer header (TCP or UDP header, containing control fields such as source port, destination port, and sequence number), and the application layer payload.

[0054] In one implementation, the method for extracting data to be processed from an HTTP request message depends on the request method. Specifically, for a POST request, the complete message body content after the closing blank line in the header is extracted; for a GET request, the query string after the question mark in the request target is extracted. For requests that contain both a query string and a POST message body, the POST message body can be extracted first, or the two can be concatenated and used as the data to be processed; the specific method is not limited here.

[0055] When parsing the field values ​​of webpage object markup data as data to be processed, the original data can first be parsed using JSON syntax to verify whether it conforms to standard JSON syntax rules. If the parsing is successful, all key-value pairs of the JSON object are traversed, and the fields carrying the encrypted payload are identified according to the preset field name rules. The field name rules can be explicitly specified field names (such as analysts setting "take values ​​from the field named payload" in the configuration) or pattern matching methods (such as identifying fields whose content characteristics conform to hexadecimal encoding or high-entropy data). If neither can be matched, all string field values ​​can be used as data to be processed.

[0056] When parsing key-value pairs from a key-value pair form as data to be processed, the original data can first be split into multiple key-value pair units using the "&" character. For each key-value pair unit, it can be split into a key name and a value based on the position of the first equal sign (the string before the equal sign is the key name, and the part after the equal sign is the value). All key-value pairs can be traversed, and the field carrying the encrypted payload can be identified according to the preset key name rules (such as identifying key names as "data", "z0", "z1", etc., which are commonly used WebShell field names), and the value of the field can be extracted as data to be processed.

[0057] In one implementation, the multi-layer processing algorithms, ranked from highest to lowest according to a preset priority, include: keyless encoding layer algorithms, symmetric encryption layer algorithms requiring key traversal, and decompression algorithms; wherein, the encoding layer algorithms include any of the following: web address encoding / decoding, hexadecimal encoding / decoding, secure hexadecimal encoding / decoding of web addresses, hexadecimal encoding / decoding, 13-bit inversion encoding / decoding, string reversal, Unicode encoding / decoding, quadratic hexadecimal encoding / decoding, and hexadecimal encoding variant decoding; the symmetric encryption algorithms include any of the following: Advanced Encryption Standard (AES) decryption, Data Encryption Standard (DES) decryption, and Abalone encryption algorithm decryption; the decompression algorithms include any of the following: compressed format decompression algorithms and compact format decompression algorithms.

[0058] In this implementation, the multi-layer processing algorithm is divided into three levels according to a preset priority from high to low: keyless encoding layer algorithms, symmetric encryption layer algorithms requiring key traversal, and decompression algorithms. This implementation provides a clear and evidence-based guidance strategy for the encryption chain exploration process, avoiding blindly exhaustively exploring all possible algorithm permutations and combinations, thereby significantly improving exploration efficiency while ensuring a high success rate in cracking the encryption.

[0059] Keyless coding layer algorithms can be any algorithm that does not involve keys or secret parameters and only uses deterministic mapping rules to transform data from one representation to another. The core characteristic of such algorithms is that their transformation rules are public and deterministic, and do not depend on any external input key parameters. Therefore, the decryption process does not require key traversal, but only requires performing a deterministic inverse transformation.

[0060] In this embodiment, the encoding layer algorithm includes any of the following: web address encoding and decoding (i.e., URL decoding), base64 encoding and decoding (i.e., Base64 decoding), secure base64 encoding and decoding (i.e., Base64 URL Safe decoding), hexadecimal encoding and decoding (i.e., Hex decoding), ROT13 encoding and decoding (i.e., ROT13 decoding), string reversal, Unicode encoding and decoding (i.e., Unicode decoding), double base64 encoding and decoding (i.e., Double Base64 decoding), and base64 Variant encoding decoding (i.e., Base64 Variant decoding).

[0061] In this embodiment, symmetric encryption algorithms include any one of the following: Advanced Encryption Standard (AES) decryption, Data Encryption Standard (DES) decryption, and Blowfish decryption. Decompression algorithms include any one of the following: compressed format decompression algorithms (Gzip decompression) and compact format decompression algorithms (Deflate decompression).

[0062] In one implementation, the step of calculating a readability score for the processing result of each algorithm in the current layer processing algorithm to obtain the score result of the current layer processing algorithm includes: for the processing result of each algorithm in the current layer processing algorithm, calculating the proportion of printable characters and the number of garbled characters in the processing result; wherein, printable characters include ASCII alphanumeric characters, Chinese characters, Chinese punctuation, English specified symbols and whitespace characters, and garbled characters include characters that do not belong to the range of ASCII characters, CJK unified Chinese characters, Chinese punctuation and full-width characters; and determining the score result of the current layer processing algorithm based on the proportion of printable characters and the number of garbled characters in the processing result.

[0063] In this implementation, printable characters cover ASCII alphanumeric characters, Chinese characters, Chinese punctuation, designated English symbols, and whitespace characters; garbled characters cover characters not belonging to ASCII characters, CJK Unified Ideographs, Chinese punctuation, and full-width characters. These two dimensions complement each other: the printable ratio focuses on evaluating the semantic richness of the text, while the garbled character count focuses on evaluating the grammatical correctness of the text. Through joint judgment using these two dimensions, valid plaintext and valid intermediate data can be accurately identified in complex data environments with multiple languages ​​and formats, avoiding misjudgments due to the limitations of a single dimension.

[0064] Printable characters include ASCII alphanumeric characters, which are uppercase and lowercase English letters (AZ, az) and decimal digits (0-9) as defined in the American Standard Code for Information Interchange (ACS). Chinese characters are those in the CJK Unified Ideographs block, which includes East Asian scripts such as Chinese, Japanese, and Korean, and forms the main body of Chinese natural language text. Chinese punctuation includes characters in the CJK Symbols and Punctuation block (such as “、”, “.”, etc.) and full-width ASCII punctuation characters (such as “,”, “.”, “!”, etc.). English specified symbols are other symbol characters in the ASCII printable characters besides letters and numbers, including space characters, punctuation marks (such as period, comma, question mark, exclamation mark, semicolon, colon, quotation marks, parentheses, square brackets, curly braces, etc.) and special symbols (such as @, #, $, %, ^, &, etc.). (etc.); whitespace characters, including spaces (0x20), horizontal tabs (0x09), newlines (0x0A) and carriage returns (0x0D), the specifics are not limited here.

[0065] In this embodiment, garbled characters include characters that do not belong to the range of ASCII characters, CJK Unified Ideographs, Chinese punctuation, and full-width characters. In other words, any character other than ASCII characters, CJK Unified Ideographs, Chinese punctuation, and full-width characters is considered garbled. That is to say, if a character is a printable character, it is definitely not a garbled character; however, if a character is not a printable character, whether it is a garbled character depends on whether it falls outside the aforementioned excluded character range.

[0066] Garbled characters include, but are not limited to: ASCII control characters other than whitespace characters, such as the null character (0x00), the bell character (0x07), the backspace character (0x08), the escape character (0x1B), the delete character (0x7F), etc., which rarely appear in normal text; Unicode characters with unassigned code points or special zone characters, which do not appear in normal text; and various rare symbols or non-text characters, the appearance of which usually indicates that the data is garbled data that has been incorrectly decrypted or binary data that has not been correctly parsed.

[0067] When determining the score of the current layer processing algorithm based on the proportion of printable characters and the number of garbled characters in the processing results, the score can be calculated by weighted summation based on the proportion of printable characters and the proportion of garbled characters, or it can be determined by comparing them with their respective thresholds and determining whether the score is pass or fail based on the comparison results. The specific method is not limited here.

[0068] In one implementation, the step of determining the scoring result of the current layer processing algorithm based on the proportion of printable characters and the number of garbled characters in the processing result includes: when the string length of the processing result is greater than or equal to a preset length threshold, determining whether the proportion of printable characters is greater than or equal to a first preset proportion threshold; when the string length of the processing result is less than the preset length threshold, determining whether the proportion of printable characters is greater than or equal to a second preset proportion threshold; wherein the second preset proportion threshold is greater than the first preset proportion threshold; determining whether the number of garbled characters is less than or equal to a preset quantity limit; if the proportion of printable characters reaches the corresponding preset proportion threshold and the number of garbled characters does not exceed the preset quantity limit, then it is determined that the scoring result of the current layer processing algorithm indicates that it meets the preset stopping condition; otherwise, it indicates that it does not meet the preset stopping condition.

[0069] This implementation achieves adaptive judgment based on text length by setting two different printable ratio thresholds. The first preset ratio threshold is used for long text (length ≥ preset length threshold), and the second preset ratio threshold is used for short text (length < preset length threshold), with the second threshold being higher than the first. Simultaneously, the determination of the number of garbled characters uses a uniform preset upper limit (e.g., 5), which does not change with text length. For short text, not only is a higher printable ratio required, but the absolute number of garbled characters is also subject to the same strict limitation, making the judgment standard for short text more stringent than for long text. This design ensures efficient processing of long text while effectively controlling the risk of misjudgment in short text scenarios.

[0070] The specific value of the preset length threshold can be configured according to the implementation scenario and data type. In some WebShell communication forensics scenarios, the commands transmitted by attackers are usually short (such as system commands like "whoami", "ipconfig", and "ls -la", which are usually no more than 20 characters long), while the return results of system commands are usually long (possibly hundreds to tens of thousands of bytes). Therefore, setting the preset length threshold can balance the judgment requirements of the two types of data, and the specific value is not limited here.

[0071] In one implementation, the step of determining the scoring result of the current layer processing algorithm based on the proportion of printable characters and the number of garbled characters in the processing result includes: if the processing result is a decoding result of Unicode hexadecimal encoding, then splitting the processing result into even-indexed substrings and odd-indexed substrings according to odd-indexed and even-indexed substrings; if the proportion of printable characters in the even-indexed substring is greater than or equal to a third preset proportion threshold, and the number of garbled characters is equal to zero, and the odd-indexed substring is a delimiter, then determining that the scoring result of the current layer processing algorithm indicates that it meets the preset stopping condition; otherwise, indicating that it does not meet the preset stopping condition.

[0072] In this implementation, if the current processing result is detected as a decoded result of UTF-16 encoded Base64, the entire byte sequence is no longer uniformly scored. Instead, the sequence is split into two independent substrings based on the parity of the indices: an even-indexed substring (index positions 0, 2, 4, …) and an odd-indexed substring (index positions 1, 3, 5, …). In the UTF-16 encoded byte sequence, the bytes of the original data are usually stored at even-indexed positions, while padding null bytes or other delimiters are usually stored at odd-indexed positions.

[0073] Then, a readability score is performed on the even-indexed substrings, checking whether their printable ratio reaches a third preset threshold (e.g., 0.8) and whether the number of garbled characters is zero. Simultaneously, it is checked whether all characters in the odd-indexed substrings are delimiters (i.e., the expected padding bytes). Only when the even-indexed substrings meet the readability criteria and the odd-indexed substrings are indeed delimiters is the processing result considered to meet the preset stopping condition. This implementation can correctly identify and process the intermediate decoding results of the special format UTF-16 encoded Base64, improving decoding accuracy.

[0074] In this embodiment, the decoding result of the Unicode encoding format hexadecimal encoding refers to the byte sequence obtained after the original data is encoded in Unicode encoding format (UTF-16, i.e., 16-bit Unicode conversion format), then processed by hexadecimal encoding (Base64 or other encoding methods that convert binary to printable characters), and finally the hexadecimal encoding is decoded during the reverse decryption process.

[0075] In this embodiment, an even-indexed substring refers to a subsequence consisting of all characters at even-indexed positions after numbering the byte sequence (or character sequence) of the processing result from index 0. An odd-indexed substring refers to a subsequence consisting of all characters at odd-indexed positions. The third preset ratio threshold is the lower limit of the printable character ratio of the even-indexed substring of the UTF-16 encoded Base64 decoding result. Its value can be the same as the first preset ratio threshold mentioned above, or it can be set independently according to the statistical characteristics of the UTF-16 encoded data. Specific details are not limited here.

[0076] When the odd-indexed substring is the delimiter, all characters (or bytes) representing the odd-indexed positions are the expected fixed padding values, typically 0x00 empty bytes, but may also be 0xFF or other fixed values ​​conventionally designated as delimiters in specific implementations. This condition that the odd-indexed substring is a delimiter ensures that the byte sequence truly conforms to the fixed byte width characteristic of UTF-16 encoding, and is not a sequence of readable characters alternating with arbitrary values ​​that is randomly or accidentally formed. This check prevents some coincidentally formed garbled sequences of high printability even indices + random odd indices from being mistakenly identified as valid UTF-16 encoded data.

[0077] In one implementation, if the current layer is a symmetric encryption layer, the steps of performing decryption processing and readability score calculation in parallel using a preset key set and a symmetric encryption algorithm include: if the current layer is a symmetric encryption layer, combining each candidate key in the preset key set with each encryption mode, each padding method, and each initial vector of the current symmetric encryption layer to obtain a candidate combination matrix; performing decryption operations in parallel for each combination in the candidate combination matrix, and performing readability score calculation in parallel for each decryption result; when the score result of any combination in the candidate combination matrix meets a preset stopping condition, determining the corresponding combination as the decryption parameter of the current symmetric encryption layer, stopping other candidate attempts in the current layer, and using the decryption result of the current layer as the processing result of the next layer to continue the subsequent decryption processing.

[0078] This implementation flattens the four-dimensional parameter space into a candidate combination list by constructing a candidate combination matrix (i.e., the Cartesian product of all candidate keys, all candidate patterns, all candidate padding methods, and all candidate initialization vectors). For each combination, an independent execution unit is assigned to perform the decryption operation and subsequent readability score calculation in parallel. When the decryption result of any combination passes the readability score, the four parameters of that combination are confirmed as the correct decryption parameters for the current layer. All other candidate attempts for the current layer are stopped, and the decryption result corresponding to that combination is passed down as the processing result for the next layer. This implementation reduces the total time spent exploring symmetric encryption layer parameters from the serial accumulation time to the parallel execution time, thus improving efficiency.

[0079] In this embodiment, the encryption mode is the mode used by symmetric encryption algorithms when encrypting data longer than a single block. For block cipher algorithms (such as the Advanced Encryption Standard, with a block length of 16 bytes; and the Data Encryption Standard, with a block length of 8 bytes), when the plaintext length exceeds one block, the encryption mode indicates the processing relationship between the blocks. Encryption modes may include: electronic codebook mode, cipher block chaining mode, counter mode, and other modes such as output feedback mode, ciphertext feedback mode, and Galois counter mode, etc., which are not specifically limited here.

[0080] Padding refers to the method of adding extra bytes to the end of the plaintext to make up the block length when the plaintext length is not an integer multiple of the block size in block cipher mode. Padding methods can include: no padding, public-key cryptography standard 5 padding, and ISO 10126 padding, but the specific method is not limited here.

[0081] The initialization vector (IPV) is a randomization parameter used in encryption modes such as block chaining, counter mode, output feedback mode, and ciphertext feedback mode. It ensures that even the same plaintext will produce different ciphertexts in multiple encryptions. In block chaining, the IPV is a random byte sequence of length equal to the block size, XORed with the plaintext block before encrypting the first block. In counter mode, the IPV is an initial counter value, incremented sequentially for each subsequent block. The IPV does not need to be kept secret during decryption but must be transmitted along with the ciphertext; otherwise, the decryption end cannot correctly recover the plaintext.

[0082] In one implementation, a two-dimensional or high-dimensional data structure is formed by combining each candidate key in the preset key set with each encryption mode, padding method, and initial vector supported by the current symmetric encryption layer through a Cartesian product; this matrix constitutes the candidate combination matrix. Furthermore, depending on the computational resources and time requirements of the current analysis task, specific combinations of modes or padding methods can be enabled or disabled (for example, if the target WebShell is known to use cipher block linking mode, other modes can be disabled to reduce the matrix size). This configuration flexibility allows for a reasonable balance between performance and coverage in different application scenarios.

[0083] In one implementation, the step of generating encrypted chain information for encrypted WebShell communication when the scoring result of any layer processing algorithm meets the preset stopping condition includes: when the scoring result of any layer processing algorithm meets the preset stopping condition, recording the algorithm name, encryption mode, padding method and key identifier used by each layer in the decryption order, generating an encrypted chain and the decrypted plaintext content as encrypted chain information for encrypted WebShell communication.

[0084] When recording in decryption order, the order of each decryption operation follows its actual execution order in the decryption process, starting from the outermost layer (the first decryption operation executed) and proceeding sequentially to the innermost layer (the last decryption operation executed). In this implementation, the algorithm name, encryption mode, padding method, and key identifier of each layer, recorded in decryption order, along with the final decrypted plaintext content, serve as the encryption chain information for encrypted WebShell communication.

[0085] In this implementation, the algorithm name refers to the standardized identifier name of the decryption algorithm used in each layer; the encryption mode refers to the mode type used by the symmetric encryption algorithm; the padding method refers to the padding type used by the symmetric encryption algorithm; and the key identifier refers to the information field used to identify the decryption key used in the symmetric encryption layer. Analysts obtain both the content actually transmitted by the attacker (plaintext content) and a verifiable path (encryption chain) proving the scientific validity of the decryption process. The combination of these two can form a complete chain of evidence.

[0086] For the corresponding method embodiments described above, see [link to relevant documentation]. Figure 2The diagram illustrates a device for identifying the encrypted chain of WebShell communication. The device includes: an acquisition module 20, used to acquire the raw data of the encrypted WebShell communication and extract data to be processed from the raw data according to its data type; a decryption module 22, used to perform decryption processing of the current layer processing algorithm sequentially, starting from the data to be processed, using a multi-layer processing algorithm arranged according to a preset priority; wherein each layer processing algorithm includes at least one algorithm, and the multi-layer processing algorithm includes a symmetric encryption algorithm for a symmetric encryption layer; a scoring module 24, used to calculate a readability score for the processing result of each algorithm in the current layer processing algorithm, obtaining a score result for the current layer processing algorithm; a de-scoring module 26, used to perform decryption processing and readability score calculation in parallel using a preset key set and the symmetric encryption algorithm if the current layer is the symmetric encryption layer; and a generation module 28, used to generate the encrypted chain information of the encrypted WebShell communication when the score result of any layer processing algorithm meets a preset stopping condition.

[0087] The aforementioned WebShell communication encryption chain identification device, through a multi-layered processing algorithm with preset priorities, ensures comprehensive coverage of various algorithms while guiding the exploration with the most probabilistic path, avoiding the efficiency loss caused by exhaustive searching of all permutations. By combining a readability scoring mechanism with preset stopping conditions, it replaces manual judgment with objective quantitative standards to avoid missed judgments, and terminates the process promptly when the score meets the standard to avoid redundant calculations. For the symmetric encryption layer, a preset key set is set up for parallel verification to compensate for cracking failures caused by insufficient experience coverage in unknown key scenarios. Simultaneously, parallel processing offsets the time cost of key traversal. Overall, the cracking process does not compromise on the breadth of algorithm coverage, the accuracy of judgment, and the depth of key processing, while also being constrained in terms of search path convergence, termination timing control, and acceleration of time-consuming steps. This balances cracking success rate and cracking efficiency, avoiding a purely manual trade-off between the two.

[0088] Optionally, the acquisition module 20 is specifically used for: acquiring network traffic packet files as raw data for encrypted WebShell communication; if the raw data is a Hypertext Transfer Protocol request message, extracting the request body or web address query parameters from the Hypertext Transfer Protocol request message as data to be processed; if the raw data is web object markup format data, parsing the field values ​​of the web object markup format data as data to be processed; if the raw data is a key-value pair form, parsing the key-value pairs of the key-value pair form as data to be processed; if the raw data is a plain ciphertext string, using the plain ciphertext string as data to be processed.

[0089] Optionally, the multi-layer processing algorithms, ranked from high to low according to a preset priority, include: keyless encoding layer algorithms, symmetric encryption layer algorithms requiring key traversal, and decompression algorithms; wherein, the encoding layer algorithms include any of the following: web address encoding / decoding, hexadecimal encoding / decoding, secure hexadecimal encoding / decoding of web addresses, hexadecimal encoding / decoding, 13-bit rotation encoding / decoding, string reversal, Unicode encoding / decoding, secondary hexadecimal encoding / decoding, and hexadecimal encoding variant decoding; the symmetric encryption algorithms include any of the following: Advanced Encryption Standard (AES) decryption, Data Encryption Standard (DES) decryption, and Abalone encryption algorithm decryption; the decompression algorithms include any of the following: compressed format decompression algorithms and compact format decompression algorithms.

[0090] Optionally, the scoring module 24 includes: a statistics unit, used to calculate the proportion of printable characters and the number of garbled characters in the processing results of each algorithm in the current layer processing algorithm; wherein, printable characters include ASCII alphanumeric characters, Chinese characters, Chinese punctuation, English specified symbols and whitespace characters, and garbled characters include characters that do not belong to the range of ASCII characters, CJK unified Chinese characters, Chinese punctuation and full-width characters; and a determination unit, used to determine the scoring result of the current layer processing algorithm based on the proportion of printable characters and the number of garbled characters in the processing results.

[0091] Optionally, the determining unit is further configured to: determine whether the printable character ratio is greater than or equal to a first preset ratio threshold when the string length of the processing result is greater than or equal to a preset length threshold; determine whether the printable character ratio is greater than or equal to a second preset ratio threshold when the string length of the processing result is less than the preset length threshold; wherein the second preset ratio threshold is greater than the first preset ratio threshold; determine whether the number of garbled characters is less than or equal to a preset number upper limit; if the printable character ratio reaches the corresponding preset ratio threshold and the number of garbled characters does not exceed the preset number upper limit, then determine that the scoring result of the current layer processing algorithm indicates that it meets the preset stopping condition; otherwise, indicate that it does not meet the preset stopping condition.

[0092] Optionally, the aforementioned determining unit is further configured to: if the processing result is a decoding result of Unicode hexadecimal encoding, then split the processing result into even-indexed substrings and odd-indexed substrings according to odd-indexed and even-indexed substrings; if the proportion of printable characters in the even-indexed substring is greater than or equal to a third preset proportion threshold, and the number of garbled characters is equal to zero, and the odd-indexed substring is a delimiter, then determine that the scoring result of the current layer processing algorithm indicates that it meets the preset stopping condition; otherwise, it indicates that it does not meet the preset stopping condition.

[0093] Optionally, the above-mentioned decryption and evaluation module 26 is further configured to: if the current layer is the symmetric encryption layer, combine each candidate key in the preset key set with each encryption mode, each padding method and each initial vector of the current symmetric encryption layer to obtain a candidate combination matrix; perform decryption operations in parallel for each combination in the candidate combination matrix, and perform readability score calculation in parallel for each decryption result; when the score result of any combination in the candidate combination matrix meets the preset stopping condition, determine the corresponding combination as the decryption parameter of the current symmetric encryption layer, stop other candidate attempts of the current layer, and continue to perform subsequent decryption processing with the decryption result of the current layer as the processing result of the next layer.

[0094] Optionally, the above-mentioned generation module 28 is further configured to: when the scoring result of any layer processing algorithm meets the preset stopping condition, record the algorithm name, encryption mode, padding method and key identifier used by each layer in the decryption order, generate an encryption chain and the decrypted plaintext content, as the encryption chain information of the encrypted WebShell communication.

[0095] This embodiment also provides an electronic device, including a processor and a memory. The memory stores machine-executable instructions that can be executed by the processor. The processor executes the machine-executable instructions to implement the aforementioned encrypted chain identification method for WebShell communication. This electronic device can be a server or a terminal device.

[0096] See Figure 3 As shown, the electronic device includes a processor 100 and a memory 101. The memory 101 stores machine-executable instructions that can be executed by the processor 100. The processor 100 executes the machine-executable instructions to implement the encrypted chain identification method for WebShell communication described above.

[0097] Furthermore, Figure 3 The electronic device shown also includes a bus 102 and a communication interface 103, with the processor 100, the communication interface 103 and the memory 101 connected via the bus 102.

[0098] The memory 101 may include high-speed random access memory (RAM) and may also include non-volatile memory, such as at least one disk storage device. Communication between this system network element and at least one other network element is achieved through at least one communication interface 103 (which can be wired or wireless), such as the Internet, wide area network, local area network, metropolitan area network, etc. The bus 102 may be an ISA bus, PCI bus, or EISA bus, etc. The bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 3The symbol is represented by a single double-headed arrow, but this does not mean that there is only one bus or one type of bus.

[0099] The processor 100 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be completed by the integrated logic circuitry in the hardware of the processor 100 or by instructions in software form. The processor 100 may be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this disclosure. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this disclosure can be directly manifested as execution by a hardware decoding processor, or execution by a combination of hardware and software modules in the decoding processor. The software module can reside in a readily available storage medium in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, or registers. This storage medium is located in memory 101, and the processor 100 reads the information from memory 101 and, in conjunction with its hardware, completes the steps of the method described in the foregoing embodiments.

[0100] This embodiment also provides a computer-readable storage medium storing computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions cause the processor to implement the above-described method for identifying the encrypted chain of WebShell communication.

[0101] The computer program product of the WebShell communication encryption chain identification method, apparatus, electronic device and storage medium provided in the embodiments of this disclosure includes a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the methods described in the preceding method embodiments. For specific implementation, please refer to the method embodiments, which will not be repeated here.

[0102] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the system and apparatus described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0103] Furthermore, in the description of the embodiments of this disclosure, unless otherwise expressly specified and limited, the terms "installation," "connection," and "linking" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection of two components. Those skilled in the art can understand the specific meaning of the above terms in this disclosure based on the specific circumstances.

[0104] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this disclosure, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this disclosure. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0105] In the description of this disclosure, it should be noted that the terms "center," "upper," "lower," "left," "right," "vertical," "horizontal," "inner," and "outer," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings, and are only for the convenience of describing this disclosure and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of this disclosure. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.

[0106] Finally, it should be noted that the above embodiments are merely specific implementations of this disclosure, used to illustrate the technical solutions of this disclosure, and not to limit it. The protection scope of this disclosure is not limited thereto. Although this disclosure has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some of the technical features, within the scope of the technology disclosed in this disclosure. Such modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this disclosure, and should all be covered within the protection scope of this disclosure. Therefore, the protection scope of this disclosure should be determined by the protection scope of the claims.

Claims

1. A method for identifying encrypted chains in WebShell communication, characterized in that, The method includes: Obtain the raw data of the encrypted WebShell communication, and extract the data to be processed from the raw data according to the data type of the raw data; The decryption process is performed sequentially by a multi-layered processing algorithm arranged according to a preset priority, starting from the data to be processed; wherein each layer of processing algorithm includes at least one algorithm, and the multi-layered processing algorithm includes a symmetric encryption algorithm for a symmetric encryption layer. For the processing results of each algorithm in the current layer, a readability score is calculated to obtain the score result of the current layer processing algorithm; If the current layer is the symmetric encryption layer, then decryption and readability scoring are performed in parallel using a preset key set and the symmetric encryption algorithm. When the scoring result of any layer processing algorithm meets the preset stopping condition, the encrypted chain information of the encrypted WebShell communication is generated.

2. The method according to claim 1, characterized in that, The steps of obtaining raw data from encrypted WebShell communication and extracting data to be processed from the raw data according to the data type of the raw data include: Obtain network traffic packet files as raw data for encrypted WebShell communication; If the original data is a Hypertext Transfer Protocol request message, then the request subject or web address query parameters are extracted from the Hypertext Transfer Protocol request message as data to be processed. If the original data is in the form of web page object markup data, then the values ​​of each field in the web page object markup data are parsed as the data to be processed. If the original data is a key-value pair form, then parse the key-value pairs of the key-value pair form as the data to be processed; If the original data is a plain ciphertext string, then the plain ciphertext string will be used as the data to be processed.

3. The method according to claim 1, characterized in that, The multi-layer processing algorithms, ranked from highest to lowest according to a preset priority, include: keyless encoding layer algorithms, symmetric encryption layer algorithms requiring key traversal, and decompression algorithms; among which, The encoding layer algorithm includes any one of the following: web address encoding and decoding, hexadecimal encoding and decoding, secure hexadecimal encoding and decoding of web addresses, 13-bit rotation encoding and decoding, string reversal, Unicode encoding and decoding, quadratic hexadecimal encoding and decoding, and hexadecimal encoding variant decoding; The symmetric encryption algorithms include any one of the following: Advanced Encryption Standard (AES) decryption, Data Encryption Standard (DES) decryption, and Abalone Encryption Algorithm decryption. The decompression algorithms include any one of the following: compressed format decompression algorithms and compacted format decompression algorithms.

4. The method according to claim 1, characterized in that, The steps for calculating a readability score for the processing result of each algorithm in the current layer, and obtaining the score result of the current layer processing algorithm, include: For the processing results of each algorithm in the current layer, the proportion of printable characters and the number of garbled characters in the processing results are statistically analyzed; wherein, printable characters include ASCII alphanumeric characters, Chinese characters, Chinese punctuation, English specified symbols and whitespace characters, and garbled characters include characters that do not belong to the range of ASCII characters, CJK unified Chinese characters, Chinese punctuation and full-width characters; The scoring result of the current layer processing algorithm is determined based on the proportion of printable characters and the number of garbled characters in the processing result.

5. The method according to claim 4, characterized in that, The steps for determining the scoring result of the current layer processing algorithm based on the proportion of printable characters and the number of garbled characters in the processing result include: When the string length of the processing result is greater than or equal to a preset length threshold, it is determined whether the printable character ratio is greater than or equal to a first preset ratio threshold. When the string length of the processing result is less than the preset length threshold, it is determined whether the printable character ratio is greater than or equal to the second preset ratio threshold; wherein, the second preset ratio threshold is greater than the first preset ratio threshold; Determine whether the number of garbled characters is less than or equal to a preset maximum number; If the proportion of printable characters reaches the corresponding preset proportion threshold and the number of garbled characters does not exceed the preset maximum number, then the scoring result of the current layer processing algorithm is determined to meet the preset stopping condition; otherwise, it is determined not to meet the preset stopping condition.

6. The method according to claim 4, characterized in that, The steps for determining the scoring result of the current layer processing algorithm based on the proportion of printable characters and the number of garbled characters in the processing result include: If the processing result is a decoding result of Unicode hexadecimal encoding, then the processing result is split into even-indexed substrings and odd-indexed substrings according to odd-indexed and even-indexed substrings. If the proportion of printable characters in the even-indexed substring is greater than or equal to the third preset proportion threshold, the number of garbled characters is zero, and the odd-indexed substring is a delimiter, then the scoring result of the current layer processing algorithm indicates that it meets the preset stopping condition; otherwise, it indicates that it does not meet the preset stopping condition.

7. The method according to claim 1, characterized in that, If the current layer is the symmetric encryption layer, then the steps of performing decryption processing and readability score calculation in parallel using a preset key set and the symmetric encryption algorithm include: If the current layer is the symmetric encryption layer, then each candidate key in the preset key set is combined with each encryption mode, each padding method and each initial vector of the current symmetric encryption layer to obtain a candidate combination matrix; Decryption is performed in parallel for each combination in the candidate combination matrix, and readability scores are calculated in parallel for each decryption result; When the score of any combination in the candidate combination matrix meets the preset stopping condition, the corresponding combination is determined as the decryption parameter of the current symmetric encryption layer, other candidate attempts of the current layer are stopped, and the decryption result of the current layer is used as the processing result of the next layer to continue the subsequent decryption process.

8. The method according to claim 1, characterized in that, The step of generating the encrypted chain information for the encrypted WebShell communication when the scoring result of any layer processing algorithm meets the preset stopping condition includes: When the scoring result of any layer processing algorithm meets the preset stopping condition, the algorithm name, encryption mode, padding method and key identifier used by each layer are recorded in the decryption order to generate an encryption chain and the decrypted plaintext content, which serve as the encryption chain information for the encrypted WebShell communication.

9. A device for identifying encrypted chains in WebShell communication, characterized in that, The device includes: The acquisition module is used to acquire the raw data of the encrypted WebShell communication and extract the data to be processed from the raw data according to the data type of the raw data. The decryption module is used to perform decryption processing on the data to be processed sequentially, starting from the data to be processed, using a multi-layer processing algorithm arranged according to a preset priority; wherein each layer processing algorithm includes at least one algorithm, and the multi-layer processing algorithm includes a symmetric encryption algorithm for a symmetric encryption layer; The scoring module is used to calculate the readability score for the processing result of each algorithm in the current layer and obtain the score result of the current layer processing algorithm. The decryption and evaluation module is used to perform decryption processing and readability score calculation in parallel using a preset key set and the symmetric encryption algorithm if the current layer is the symmetric encryption layer. The generation module is used to generate the encrypted chain information of the encrypted WebShell communication when the scoring result of any layer processing algorithm meets the preset stopping condition.

10. An electronic device, characterized in that, It includes a processor and a memory, the memory storing machine-executable instructions that can be executed by the processor, the processor executing the machine-executable instructions to implement the encrypted chain identification method for WebShell communication as described in any one of claims 1-8.

11. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when invoked and executed by a processor, cause the processor to implement the encrypted chain identification method for WebShell communication as described in any one of claims 1-8.