A method, apparatus, device, and storage medium for locating network traffic ROP chains.
By sampling and classifying network traffic, and combining the ROP chain detection model with location coordinate division, the problem of insufficient ROP chain positioning accuracy in existing technologies has been solved, achieving higher-precision ROP chain positioning.
Patent Information
- Application Number
- CN202310442578.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-23
- Publication Date
- 2026-11-17
- Estimated Expiration
- 2043-04-23
AI Technical Summary
Existing technologies have accuracy issues in ROP chain location, mainly because they assume that ROP Gadget addresses are distributed in a specific area, which may lead to location errors.
By sampling network traffic, statistically analyzing the categorization values of byte sequences, using a pre-defined ROP chain detection model to filter suspicious byte sequences, and determining the final ROP chain location result by dividing the location coordinates, including sliding window sampling and neural network training.
This improved the accuracy of ROP chain localization, reduced the false alarm rate of the detection model, and ensured the accuracy of ROP chain localization.
Smart Images

Figure CN116436679B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of network security, and in particular to a method, apparatus, device, and storage medium for locating network traffic ROP chains. Background Technology
[0002] Current research on ROP chain localization is still in its early stages. It primarily relies on the assumption that ROP Gadget addresses within the chain are fixedly distributed across certain specific regions (dynamic link libraries and the .text segment, etc.). The method determines whether a byte in the traffic might be the first byte of a ROP Gadget by checking if it falls within that region, and then uses a sliding pick mechanism to locate the ROP chain. However, this approach has accuracy limitations. Current methods assume that ROP Gadget addresses are distributed within a specific range; however, this range is typically chosen from dynamic link libraries and the program's .text segment, resulting in a relatively large address range. Directly locating ROPs based on whether certain bytes fall within a specific region may introduce errors. Summary of the Invention
[0003] In view of this, the purpose of this invention is to provide a method, apparatus, device, and storage medium for locating network traffic ROP chains, which can obtain accurate ROP chain location results. The specific solution is as follows:
[0004] Firstly, this application provides a method for locating network traffic ROP chains, including:
[0005] Several byte sequences to be detected are obtained by sampling network traffic;
[0006] The number of different byte values in the byte sequence to be detected is counted to obtain the categorized value corresponding to the byte sequence to be detected;
[0007] Suspicious byte sequences are obtained by using a preset ROP chain detection model to detect byte sequences whose categorization value is less than a preset categorization threshold;
[0008] The location coordinates corresponding to all the suspicious byte sequences are filtered to determine the final ROP chain location result.
[0009] Optionally, the sampling of network traffic to obtain several byte sequences to be detected includes:
[0010] The network traffic is sampled according to a preset channel sampling method to obtain the channel byte sequence;
[0011] The channel byte sequence is sampled using a preset sliding window size to obtain the byte sequence to be detected, and the position information corresponding to the byte sequence to be detected is recorded.
[0012] Optionally, the step of sampling network traffic according to a preset channel sampling method to obtain a channel byte sequence includes:
[0013] The network traffic is sampled four times at an interval of 3 to obtain the channel byte sequence of the four channels;
[0014] Alternatively, network traffic can be sampled 8 times at intervals of 7 to obtain the channel byte sequence of the eight channels.
[0015] Optionally, before detecting the byte sequence to be detected with a classification value less than a preset classification threshold using a preset ROP chain detection model, the method further includes:
[0016] One-Hot encoding is used to process the existing ROP sequence set and the normal sequence set to obtain the ROP chain dataset and the normal traffic dataset;
[0017] The preset ROP chain detection model is obtained by training a preset neural network using the ROP chain dataset and the normal traffic dataset.
[0018] Optionally, before processing the existing ROP sequence set and normal sequence set using One-Hot encoding to obtain the ROP chain dataset and normal traffic dataset, the method further includes:
[0019] Extract the first byte of the existing ROP chain to obtain a first byte sequence array, and perform internal randomization expansion processing on several of the first byte sequence arrays to obtain an expanded sequence array;
[0020] The first preset number of bytes of a single expanded sequence array are used as candidate sequence arrays;
[0021] The candidate sequence arrays are deduplicated to obtain the existing ROP sequence set.
[0022] Optionally, after obtaining suspicious byte sequences by detecting byte sequences whose categorization values are less than a preset categorization threshold using a preset ROP chain detection model, the method further includes:
[0023] The location coordinates of the suspicious byte sequence in the corresponding network traffic are recorded in a preset suspicious location list so that the location coordinates corresponding to all the suspicious byte sequences can be filtered to determine the final ROP chain location result.
[0024] Optionally, the step of filtering the location coordinates corresponding to all the suspicious byte sequences to determine the final ROP chain location result includes:
[0025] The position coordinates corresponding to the suspicious byte sequences are sorted in order of size to obtain a sorted position list;
[0026] The suspicious byte sequences corresponding to several location coordinates in the sorted location list whose difference between adjacent location coordinates is not greater than a preset sequence interval threshold are identified as the location area.
[0027] The longest region among the several positioning regions is determined as the final ROP chain positioning result.
[0028] Secondly, this application provides a network traffic ROP chain location device, comprising:
[0029] The traffic sampling module is used to sample network traffic to obtain several byte sequences to be detected;
[0030] The categorization value statistics module is used to count the number of different byte values in the byte sequence to be detected, so as to obtain the categorization value corresponding to the byte sequence to be detected;
[0031] The sequence detection module is used to detect suspicious byte sequences by using a preset ROP chain detection model to detect byte sequences whose categorization value is less than a preset categorization threshold.
[0032] The location determination module is used to filter the location coordinates corresponding to all the suspicious byte sequences to determine the final ROP chain location result.
[0033] Thirdly, this application provides an electronic device, comprising:
[0034] Memory, used to store computer programs;
[0035] A processor for executing the computer program to implement the network traffic ROP chain location method as described above.
[0036] Fourthly, this application provides a computer-readable storage medium, characterized in that it is used to store a computer program, which, when executed by a processor, implements the network traffic ROP chain location method as described above.
[0037] Therefore, this application first samples network traffic to obtain several byte sequences to be detected; then, it counts the number of different byte values in the byte sequences to obtain the categorization value corresponding to the byte sequences; then, it uses a preset ROP chain detection model to detect byte sequences whose categorization value is less than a preset categorization threshold to obtain suspicious byte sequences; finally, it filters the location coordinates corresponding to all the suspicious byte sequences to determine the final ROP chain location result. In this way, this application first filters out a portion of byte sequences by the categorization value of the byte sequences, thus obtaining byte sequences that may be ROP chains. Then, it uses a preset ROP chain detection model to further filter out suspicious byte sequences. Finally, it determines the final ROP chain location result by dividing the suspicious location area. This multi-layer processing and location coordinate division method can filter out scattered coordinate points generated by false alarms of the ROP chain detection model, improving the location accuracy of ROP chains. Attached Figure Description
[0038] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0039] Figure 1 This application discloses a flowchart of a network traffic ROP chain location method.
[0040] Figure 2 This is a comparison diagram of a four-channel sampling method disclosed in this application;
[0041] Figure 3 This application discloses a specific method for locating network traffic ROP chains.
[0042] Figure 4 This is a flowchart of a sequence set acquisition method disclosed in this application;
[0043] Figure 5 This application discloses a flowchart for byte sequence detection.
[0044] Figure 6 This application discloses a flowchart for position coordinate division.
[0045] Figure 7 This application discloses a specific flowchart for position coordinate division;
[0046] Figure 8 This is a flowchart of another specific network traffic ROP chain location method disclosed in this application;
[0047] Figure 9 This is a schematic diagram of a ROP chain detection model disclosed in this application;
[0048] Figure 10 This is a schematic diagram of a ROP chain positioning result disclosed in this application;
[0049] Figure 11 This is a schematic diagram of a network traffic ROP chain positioning device disclosed in this application.
[0050] Figure 12 This is a structural diagram of an electronic device disclosed in this application. Detailed Implementation
[0051] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0052] Since ROP Gadget addresses in a ROP chain typically originate from one or more executable programs or shared libraries, their addresses are distributed in a contiguous space, and the first byte of each address usually contains a few fixed values. Therefore, a byte sequence containing only a few fixed values may be a ROP chain or a partial sequence of the first bytes of a ROP chain. Current methods utilize the fixed distribution of ROP Gadget addresses in certain specific regions (dynamic link libraries and the .text segment) in the ROP chain. Whether a byte is distributed within this region determines whether it might be the first byte of a ROP Gadget in the traffic, and the ROP chain is located using a sliding window approach. This application, however, can obtain a more accurate ROP chain location result by using categorized values, a ROP detection model, and regional division of location coordinates.
[0053] See Figure 1 As shown, this embodiment of the invention discloses a method for locating network traffic ROP chains, including:
[0054] Step S11: Sample the network traffic to obtain several byte sequences to be detected.
[0055] In this embodiment, network traffic is first sampled to obtain several byte sequences to be detected. It should be noted that, in specific embodiments, sampling network traffic to obtain several byte sequences to be detected may include: sampling network traffic according to a preset channel sampling method to obtain a channel byte sequence; performing sliding window sampling on the channel byte sequence based on a preset sliding window size to obtain the byte sequence to be detected, and recording the position information corresponding to the byte sequence to be detected. Correspondingly, sampling network traffic according to the preset channel sampling method to obtain a channel byte sequence may include: sampling network traffic four times at intervals of 3 to obtain a four-channel channel byte sequence; or, sampling network traffic eight times at intervals of 7 to obtain an eight-channel channel byte sequence. Specifically, the channel byte sequence can be obtained by sampling network traffic using a preset channel sampling method. For a 32-bit operating system, four-channel sampling is used, that is, sampling network traffic four times sequentially at intervals of 3. Figure 2 The image shows a comparison of four-channel sampling. For a byte sequence, the bytes at positions n, n+4, n+8… (n = 0, 1, 2, 3) are taken as one channel sequence, resulting in four channel byte sequences. Each color depth represents one channel byte sequence. For 64-bit operating systems, eight-channel sampling is used, meaning network traffic is sampled eight times sequentially at intervals of 7. It can be understood that after obtaining the channel byte sequences using this sampling method, the channel byte sequences can be sampled according to a preset sliding window size to obtain the byte sequence to be detected.
[0056] Step S12: Count the number of different byte values in the byte sequence to be detected, so as to obtain the classified value corresponding to the byte sequence to be detected.
[0057] In this embodiment, after obtaining the byte sequence to be detected, the number of different byte values in the byte sequence to be detected can be further counted to obtain the classified value corresponding to the byte sequence to be detected. It can be understood that the first byte of the ROP Gadget address in the ROP chain is generally a few fixed values. Therefore, if a byte sequence contains only a few fixed values, the byte sequence may be the first byte sequence of the ROP chain or part of the ROP chain, and its classified value is relatively small.
[0058] Step S13: Use the preset ROP chain detection model to detect the byte sequences to be detected whose categorization value is less than the preset categorization threshold to obtain suspicious byte sequences.
[0059] In this embodiment, after obtaining the categorization value corresponding to the byte sequence to be detected, the preset ROP chain detection model can be used to detect byte sequences whose categorization value is less than the preset categorization threshold. This allows for the determination of a ROP chain by the preset ROP chain detection model. It is understood that the ROP chain detection model may also have some false alarms. In this application, byte sequences whose detection result is a ROP chain obtained by the preset ROP chain detection model are determined as suspicious byte sequences, so that these suspicious byte sequences can be further judged in the future.
[0060] Step S14: Filter the location coordinates corresponding to all the suspicious byte sequences to determine the final ROP chain location result.
[0061] In this embodiment of the application, after obtaining the suspicious byte sequence through the preset ROP chain detection model, the location coordinates of the suspicious byte sequence can be filtered to determine the final ROP chain location result. Specifically, since the ROP chain detection model may have certain false alarms, and the ROP chain is concentrated in a certain segment of network traffic, this application divides the corresponding suspicious location coordinates into regions after obtaining the suspicious byte sequence through the preset ROP chain detection model. The region containing the most suspicious location coordinates can be determined as the region where the ROP chain is distributed, which is the final ROP chain location result.
[0062] Therefore, this application can adopt different channel sampling methods according to different operating systems, and count the number of different byte values in the byte sequence to be detected after resampling through a sliding window, i.e., the generalization value; then, it uses a preset ROP chain detection model to detect the sequence to be detected whose generalization value is less than a preset generalization threshold to obtain suspicious byte sequences; then, it divides the position coordinates of the suspicious byte sequences, and determines the region containing the most suspicious position coordinates as the final ROP chain location result. In this way, by sampling, detecting with the ROP chain detection model, and then dividing the position coordinates, a more accurate ROP chain location result can be obtained.
[0063] See Figure 3 As shown, this embodiment of the invention discloses a method for locating network traffic ROP chains, including:
[0064] Step S21: Sample the network traffic to obtain several byte sequences to be detected.
[0065] Step S22: Count the number of different byte values in the byte sequence to be detected, so as to obtain the classified value corresponding to the byte sequence to be detected.
[0066] Step S23: Use One-Hot encoding to process the existing ROP sequence set and normal sequence set to obtain the ROP chain dataset and normal traffic dataset.
[0067] In this embodiment of the application, a ROP chain detection model needs to be prepared in advance. It is understood that, in specific embodiments, before processing the existing ROP sequence set and normal sequence set using One-Hot encoding to obtain the ROP chain dataset and normal traffic dataset, the process may further include: extracting the first byte of the existing ROP chain to obtain a first byte sequence array, and performing internal randomization expansion processing on several of the first byte sequence arrays to obtain an expanded sequence array; using the first preset number of bytes of a single expanded sequence array as a candidate sequence array; and performing deduplication processing on several candidate sequence arrays to obtain the existing ROP sequence set. Specifically, firstly, the first byte of the existing real ROP chain can be extracted to obtain a first byte sequence array; then, the obtained first byte sequence array is internally randomized to achieve sequence expansion to obtain an expanded sequence array; then, the first ten bytes of the expanded sequence array can be extracted as candidate sequence arrays for the ROP sequence set; finally, deduplication processing is performed on all candidate sequence arrays to retain the set of sequence arrays that constitute the ROP sequence set. Figure 4 The flowchart shown is for obtaining the sequence set.
[0068] Step S24: Use the ROP chain dataset and the normal traffic dataset to train the preset neural network to obtain the preset ROP chain detection model.
[0069] In this embodiment, after obtaining the ROP chain dataset and the normal traffic dataset, a preset neural network can be trained to obtain the preset ROP chain detection model. In a specific embodiment, the ROP chain dataset and the normal traffic dataset can be input into a deep learning model to train a binary classification deep learning model, thus obtaining the ROP chain detection model. It is understood that the ROP chain detection model can detect whether a fixed-length (i.e., a preset sliding window size, which can be W in this embodiment) byte sequence is a ROP chain. It should be noted that the preset neural network in this application includes, but is not limited to, convolutional neural networks (CNNs), recurrent neural networks (RNNs), or deep neural networks (DNNs); in this embodiment, a convolutional neural network (CNN) is used.
[0070] Step S25: Use the preset ROP chain detection model to detect the byte sequences to be detected whose categorization value is less than the preset categorization threshold to obtain suspicious byte sequences.
[0071] In this embodiment, byte sequences with categorization values less than a preset categorization threshold can be selected from the byte sequences to be detected. Then, the preset ROP chain detection model is used to detect these byte sequences, thus obtaining the suspicious byte sequences. It should be noted that after obtaining the suspicious byte sequences by detecting the byte sequences with categorization values less than the preset categorization threshold using the preset ROP chain detection model, the method may further include: recording the location coordinates of the suspicious byte sequences in the corresponding network traffic into a preset suspicious location list, so as to filter the location coordinates corresponding to all the suspicious byte sequences to determine the final ROP chain location result. Specifically, there may be false positives from the ROP chain detection model in the currently obtained suspicious byte sequences. In this embodiment, the location coordinates corresponding to the suspicious byte sequences can be recorded in the preset suspicious location list, so as to subsequently divide the location coordinates and determine the final ROP chain location result, such as... Figure 5 The flowchart shown is a process for detecting suspicious byte sequences and a list of suspicious locations.
[0072] Step S26: Filter the location coordinates corresponding to all the suspicious byte sequences to determine the final ROP chain location result.
[0073] In this embodiment, after obtaining the suspicious byte sequence and its corresponding location coordinates, the process of filtering the location coordinates corresponding to all the suspicious byte sequences to determine the final ROP chain location result may include: sorting the location coordinates corresponding to the suspicious byte sequences in order of size to obtain a sorted location list; determining the suspicious byte sequences corresponding to several location coordinates in the sorted location list whose difference between adjacent location coordinates is not greater than a preset sequence interval threshold as location areas; and determining the longest region among the several location areas as the final ROP chain location result. Specifically, firstly, all suspicious location coordinates are analyzed to determine the starting position of the ROP attack chain. The abnormal location list records all location coordinates output by the ROP chain detection model. The location coordinates included can be divided into two categories: one is the location coordinates of all the first bytes of the ROP attack chain in the traffic data packet, characterized by short distances between the preceding and following bytes; the second is the scattered coordinate points generated by false alarms, with random distribution. In a specific embodiment, the location coordinate division process based on the suspicious location list can be as follows: Figure 6As shown. For the list of suspicious locations, a list of suspicious location numbers is generated by sorting them in ascending order. First, the difference between the values before and after the specified values in each location is calculated sequentially. When the difference between the values before and after a location is greater than 20 (this value is an empirically defined value based on extensive network traffic analysis), two regions are generated at that location. This process is repeated until the end. When the difference between the values before and after the specified values in all suspicious location number lists has been calculated, the lengths of all generated regions are counted. The longest region is considered the ROP chain region, and its initial coordinates are taken as the initial position number of the ROP chain. For example... Figure 7 The diagram shown is a flowchart of a specific location coordinate division process.
[0074] For more detailed processing procedures regarding steps S21 and S22, please refer to the corresponding content disclosed in the foregoing embodiments, which will not be repeated here.
[0075] Therefore, in this embodiment, pre-processing existing ROP chain data and normal traffic data yields a sequence set for training the ROP chain detection model. Then, training a pre-defined neural network using this sequence set generates the ROP chain detection model. After detecting suspicious byte sequences using the ROP chain detection model, this application can further divide the suspicious byte sequences based on their corresponding location coordinates to determine the most concentrated region as the final ROP chain location result. This location coordinate division of the suspicious byte sequences obtained through the ROP chain detection model further avoids false alarms from the detection model affecting the final ROP chain location result, thus improving the accuracy of ROP chain location.
[0076] The following embodiments will be combined with, for example Figure 8 The flowchart shown provides a detailed description of the technical solution of this application, and may include:
[0077] In this embodiment, the sliding window size is 10. It is assumed that the steps in the above embodiment can yield a total of 4940 network traffic items to be located, which is also the sequence of words to be detected.
[0078] Accordingly, 494 real ROP chains were collected from the GitHub platform and the Exploit Database, and the public dataset USTC-TFC was used for normal traffic. Using these real ROP chains and normal traffic data, ROP chain datasets and normal traffic datasets were constructed. This resulted in a total of 30,000 data points in the ROP chain dataset and 50,000 data points in the normal traffic dataset. Using these datasets to train a deep learning model, a ROP chain detection model can be obtained. This embodiment uses a Convolutional Neural Network (CNN). Figure 9The model's structure is as follows: The input is a 10*255 two-dimensional matrix. In the first two-dimensional convolutional layer, the input is convolved with a 3*3 kernel (16 channels), generating 16 feature maps of length 8*253. Then, a 2*2 max-pooling layer generates 16 feature maps of length 4*126. In the second two-dimensional convolutional layer, a 3*3 kernel (32 channels) generates 32 feature maps of length 2*124. Then, a 2*2 max-pooling layer generates 32 feature maps of length 1*62. After these operations, the feature sequence is flattened and converted to 128 and 1 respectively using two fully connected layers. To prevent overfitting, Dropout regularization is used, with a learning rate of 1e-5 and a total of over 250,000 training parameters.
[0079] Furthermore, applying the aforementioned ROP chain detection model to detect the byte sequence to be detected yields suspicious byte sequences. The position coordinates in the suspicious position list can then be sorted from smallest to largest, and a position coordinate interval list can be further calculated. Each element in the position coordinate interval list is the value of the next item in the sorted suspicious position list minus the previous item. For example, if the sorted suspicious position list is [1,2,4,9,10,…], then the position coordinate interval list is [1,2,5,1,…]. Accordingly, position regions can be divided based on the position coordinate interval list. Specifically, assuming the value of the i-th element in the position coordinate interval list is v… i If v i If the value is greater than 20, then the i-th and i+1-th elements of the suspicious location list are separated to form a series of separated regions, each containing several location coordinates. Then, the number of location coordinates contained in each separated region can be calculated, and the separated region with the most location coordinates is determined. The minimum value of this separated region is the result of ROP chain location, representing the position of the ROP chain in network traffic.
[0080] This embodiment uses 4940 positioning test samples. The positioning effect is as follows: Figure 10As shown, the distance error represents the difference between the located coordinates and the actual location coordinates. There is an 81.9% probability that the positioning error can be controlled within 10 bytes, and a 92.7% probability that it can be controlled within 20 bytes. Test samples with distance errors exceeding 20 bytes account for 7.3% of the total test samples, with negative distances accounting for 6.4%, representing the vast majority. This phenomenon occurs because some ROP test samples have excessively long ROP chains, and there are a large number of padding bytes in the middle of the ROP chain. Therefore, the location algorithm outputs the position at the beginning of the latter part of the ROP chain, resulting in a large number of negative distance errors. 20 bytes is equivalent to the length of 5 gadgets; considering the overall ROP chain length, this distance error will not significantly interfere with the positioning effect. Compared to a network data packet with a total length of 1550 bytes, this application can effectively determine the area where the attack code is located, improving the efficiency of attack code analysis.
[0081] Therefore, this application first samples network traffic and filters out byte sequences with a small number of byte values (classification values) within a window through the steps in the above embodiments. Based on the characteristics of the ROP chain, the filtered byte sequences are either part of the ROP chain or a partial first byte sequence of the ROP chain; these sequences can be called anomalous byte sequences. However, relying solely on the classification values of anomalous byte sequences can lead to a high false positive rate. To reduce false positives, a ROP chain dataset and a normal traffic dataset can be pre-constructed. A deep learning model can be applied, and the training data can be input to obtain a ROP chain detection model. This model can detect whether a fixed-length byte sequence is part of the first byte of a ROP chain. All anomalous byte sequences are input into the ROP chain detection model, filtering out several suspicious byte sequences and recording their corresponding positions in the network traffic. Since the ROP chain detection model may also have some false positives, and the ROP chain is concentrated in a certain segment of the network traffic, the suspicious position coordinates can be divided into regions. The region containing the most suspicious position coordinates can be identified as the ROP chain distribution region. This can reduce the location error of the ROP chain in the network traffic.
[0082] Correspondingly, such as Figure 11 As shown, this application provides a network traffic ROP chain location device, comprising:
[0083] Traffic sampling module 11 is used to sample network traffic to obtain several byte sequences to be detected;
[0084] The categorization value statistics module 12 is used to count the number of different byte values in the byte sequence to be detected, so as to obtain the categorization value corresponding to the byte sequence to be detected;
[0085] Sequence detection module 13 is used to detect suspicious byte sequences by using a preset ROP chain detection model to detect byte sequences whose categorization value is less than a preset categorization threshold.
[0086] The location determination module 14 is used to filter the location coordinates corresponding to all the suspicious byte sequences to determine the final ROP chain location result.
[0087] Therefore, this application first filters out a portion of byte sequences by classifying the byte sequence values, thus obtaining byte sequences that may be ROP chains. Then, it further filters out suspicious byte sequences using a preset ROP chain detection model. Finally, it determines the ROP chain location result by dividing the suspicious location area. This multi-layer processing and location coordinate division method can filter out scattered coordinate points generated by false alarms of the ROP chain detection model, thereby improving the location accuracy of the ROP chain.
[0088] In one specific embodiment, the flow sampling module 11 may include:
[0089] The channel sampling submodule is used to sample network traffic according to a preset channel sampling method to obtain the channel byte sequence;
[0090] The sliding sampling unit is used to perform sliding sampling on the channel byte sequence based on a preset sliding window size to obtain the byte sequence to be detected, and to record the position information corresponding to the byte sequence to be detected.
[0091] In another specific embodiment, the channel sampling submodule may include:
[0092] A four-channel sampling unit is used to sample network traffic four times at intervals of 3 to obtain the channel byte sequence of the four channels;
[0093] An eight-channel sampling unit is used to sample network traffic eight times at intervals of seven to obtain the channel byte sequence of the eight channels.
[0094] In one specific embodiment, the sequence detection module 13 may further include:
[0095] The sequence set processing submodule is used to process the existing ROP sequence set and normal sequence set using One-Hot encoding to obtain the ROP chain dataset and normal traffic dataset.
[0096] The model training submodule is used to train a preset neural network using the ROP chain dataset and the normal traffic dataset to obtain the preset ROP chain detection model.
[0097] In another specific embodiment, the sequence set processing submodule may further include:
[0098] An array expansion unit is used to extract the first byte of an existing ROP chain to obtain a first byte sequence array, and to perform internal randomization expansion processing on several of the first byte sequence arrays to obtain an expanded sequence array;
[0099] A candidate array determination unit is used to select the first preset number of bytes of a single extended sequence array as a candidate sequence array;
[0100] The sequence set determination unit is used to perform deduplication processing on several candidate sequence arrays to obtain the existing ROP sequence set.
[0101] In one specific embodiment, the sequence detection module 13 may further include:
[0102] The location coordinate recording unit is used to record the location coordinates of the suspicious byte sequence in the corresponding network traffic into a preset suspicious location list, so as to filter the location coordinates corresponding to all the suspicious byte sequences to determine the final ROP chain location result.
[0103] In one specific embodiment, the positioning determination module 14 may include:
[0104] The position sorting unit is used to sort the position coordinates corresponding to the suspicious byte sequence in order of size to obtain a sorted position list;
[0105] The region division unit is used to determine the suspicious byte sequences corresponding to several location coordinates in the sorted location list whose difference between adjacent location coordinates is not greater than a preset sequence interval threshold as the location region.
[0106] The positioning result determination unit is used to determine the longest region among several positioning regions as the final ROP chain positioning result.
[0107] Furthermore, embodiments of this application also disclose an electronic device, Figure 12 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content of the diagram should not be construed as limiting the scope of this application.
[0108] Figure 12This is a schematic diagram of the structure of an electronic device 20 provided in an embodiment of this application. Specifically, the electronic device 20 may include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 stores a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the network traffic ROP chain location method disclosed in any of the foregoing embodiments. Alternatively, the electronic device 20 in this embodiment may specifically be a computer.
[0109] In this embodiment, the power supply 23 is used to provide operating voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and external devices, and the communication protocol it follows can be any communication protocol applicable to the technical solution of this application, and is not specifically limited here; the input / output interface 25 is used to acquire external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs, and is not specifically limited here.
[0110] In addition, the memory 22, as a carrier for resource storage, can be a read-only memory, random access memory, disk or optical disk, etc. The resources stored thereon can include operating system 221, computer program 222, etc., and the storage method can be temporary storage or permanent storage.
[0111] The operating system 221 is used to manage and control the various hardware devices on the electronic device 20 and the computer program 222, which may be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program capable of performing the network traffic ROP chain location method executed by the electronic device 20 as disclosed in any of the foregoing embodiments, the computer program 222 may further include a computer program capable of performing other specific tasks.
[0112] Furthermore, this application also discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, it implements the aforementioned network traffic ROP chain location method. Specific steps of this method can be found in the corresponding content disclosed in the foregoing embodiments, and will not be repeated here.
[0113] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section.
[0114] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0115] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly by hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.
[0116] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0117] The technical solutions provided in this application have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the methods and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A method for locating network traffic ROP chains, characterized in that, include: Several byte sequences to be detected are obtained by sampling network traffic; The number of different byte values in the byte sequence to be detected is counted to obtain the categorized value corresponding to the byte sequence to be detected; Suspicious byte sequences are obtained by using a preset ROP chain detection model to detect byte sequences whose categorization value is less than a preset categorization threshold; The location coordinates corresponding to all the suspicious byte sequences are filtered to determine the final ROP chain location result; The step of filtering the location coordinates corresponding to all the suspicious byte sequences to determine the final ROP chain location result includes: The position coordinates corresponding to the suspicious byte sequences are sorted in order of size to obtain a sorted position list; The suspicious byte sequences corresponding to several location coordinates in the sorted location list whose difference between adjacent location coordinates is not greater than a preset sequence interval threshold are identified as the location area. The longest region among the several positioning regions is determined as the final ROP chain positioning result.
2. The network traffic ROP chain location method according to claim 1, characterized in that, The sampling of network traffic yields several byte sequences to be detected, including: The network traffic is sampled according to a preset channel sampling method to obtain the channel byte sequence; The channel byte sequence is sampled using a sliding window based on a preset sliding window size to obtain the byte sequence to be detected, and the position information corresponding to the byte sequence to be detected is recorded.
3. The network traffic ROP chain location method according to claim 2, characterized in that, The step of sampling network traffic according to a preset channel sampling method to obtain a channel byte sequence includes: The network traffic is sampled four times at an interval of 3 to obtain the channel byte sequence of the four channels; Alternatively, network traffic can be sampled 8 times at intervals of 7 to obtain the channel byte sequence of the eight channels.
4. The network traffic ROP chain location method according to claim 1, characterized in that, Before using the preset ROP chain detection model to detect byte sequences whose categorization value is less than the preset categorization threshold, the method further includes: One-Hot encoding is used to process the existing ROP sequence set and the normal sequence set to obtain the ROP chain dataset and the normal traffic dataset; The preset ROP chain detection model is obtained by training a preset neural network using the ROP chain dataset and the normal traffic dataset.
5. The network traffic ROP chain location method according to claim 4, characterized in that, Before processing the existing ROP sequence set and normal sequence set using One-Hot encoding to obtain the ROP chain dataset and normal traffic dataset, the process also includes: Extract the first byte of the existing ROP chain to obtain a first byte sequence array, and perform internal randomization expansion processing on several of the first byte sequence arrays to obtain an expanded sequence array; The first preset number of bytes of a single expanded sequence array are used as candidate sequence arrays; The existing ROP sequence set is obtained by deduplicating several candidate sequence arrays.
6. The network traffic ROP chain location method according to claim 1, characterized in that, After obtaining suspicious byte sequences by detecting byte sequences whose categorization values are less than a preset categorization threshold using a preset ROP chain detection model, the method further includes: The location coordinates of the suspicious byte sequence in the corresponding network traffic are recorded in a preset suspicious location list so that the location coordinates corresponding to all the suspicious byte sequences can be filtered to determine the final ROP chain location result.
7. A network traffic ROP chain positioning device, characterized in that, include: The traffic sampling module is used to sample network traffic to obtain several byte sequences to be detected; The categorization value statistics module is used to count the number of different byte values in the byte sequence to be detected, so as to obtain the categorization value corresponding to the byte sequence to be detected; The sequence detection module is used to detect suspicious byte sequences by using a preset ROP chain detection model to detect byte sequences whose categorization value is less than a preset categorization threshold. The location determination module is used to filter the location coordinates corresponding to all the suspicious byte sequences to determine the final ROP chain location result; The positioning determination module includes: The position sorting unit is used to sort the position coordinates corresponding to the suspicious byte sequence in order of size to obtain a sorted position list; The region division unit is used to determine the suspicious byte sequences corresponding to several location coordinates in the sorted location list whose difference between adjacent location coordinates is not greater than a preset sequence interval threshold as the location region. The positioning result determination unit is used to determine the longest region among several positioning regions as the final ROP chain positioning result.
8. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor for executing the computer program to implement the network traffic ROP chain location method as described in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, Used to store a computer program, which, when executed by a processor, implements the network traffic ROP chain location method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
ROP traffic detection method, apparatus and device, and computer readable storage medium
CN115473826A
Attack code detection apparatus, attack code detection method, and attack code detection program
US20190384913A1
