Method, device, electronic device and storage medium for determining border gateway protocol traffic
By receiving and verifying traffic data, it solves the problem of BGP protocol identification failure of traditional identification methods in the case of non-standard ports or packet loss, and achieves accurate identification of Border Gateway Protocol traffic.
Patent Information
- Application Number
- CN202410807240.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-21
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2044-06-21
AI Technical Summary
When existing technology identifies Border Gateway Protocol traffic, especially in the case of non-standard ports or packet loss, traditional identification methods based on port and deep packet inspection features cannot accurately identify the BGP protocol, resulting in identification failure.
By receiving traffic data, first match the first traffic data according to predetermined rules. If the match is not successful, continue to receive the second traffic data and detect whether packet loss occurs. If no packet loss occurs, formal verification and byte detection are performed to determine the traffic data. Whether it is BGP protocol.
It improves the ability to accurately identify Border Gateway Protocol traffic and can correctly identify the BGP protocol in the case of non-standard ports or packet loss. It is suitable for scenarios that require in-depth and accurate identification of incomplete traffic.
Smart Images

Figure CN118381670B
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a method, device, electronic device and storage medium for determining border gateway protocol traffic. Background Art
[0002] In an intrusion detection system, accurate identification of various protocols carried by network traffic is a necessary condition for accurate detection. For typical routing protocols such as Border Gateway Protocol (BGP), it has relatively typical port features and DPI (Deep Packet Inspection) features. When the network traffic quality is good, its port features and header DPI features can be used for accurate identification. However, once the port is a non-standard port or the traffic data packet in the Border Gateway Protocol traffic is missing, for example, the BGP protocol message is a common routing protocol used in TCP (Transmission Control Protocol) / IP networks. When the TCP protocol data packet carrying the BGP protocol message uses the non-standard port 179, the port feature is missing, and the conventional identification method based on port and DPI features cannot identify the BGP protocol; BGP data is not strictly encapsulated in a TCP packet according to a BGP packet, and the TCP flow has packet loss, resulting in the lack of DPI features. Traditional identification methods are almost unable to identify the protocol type. Summary of the invention
[0003] In view of this, the purpose of the present application is to propose a method, device, electronic device and storage medium for determining border gateway protocol traffic to overcome all or part of the deficiencies in the prior art.
[0004] Based on the above purpose, the present application provides a method for determining Border Gateway Protocol traffic, including: receiving first traffic data in traffic data, and matching the first traffic data according to a predetermined rule; in response to determining that the first traffic data is not matched successfully, continuing to receive second traffic data in the traffic data; detecting whether packet loss occurs in the second traffic data; in response to determining that no packet loss occurs in the second traffic data, performing formal verification on the second traffic data, and in response to determining that the second traffic data passes the formal verification, determining the traffic data as the Border Gateway Protocol traffic; in response to determining that packet loss occurs in the second traffic data, performing byte detection on the second traffic data, and in response to determining that the second traffic data passes the byte detection, determining the traffic data as the Border Gateway Protocol traffic.
[0005] Optionally, the second traffic data includes at least one traffic data packet, which records the data volume of the traffic data packet; detecting whether packet loss occurs in the second traffic data includes: detecting whether the actual data volume of the traffic data packet is equal to the data volume recorded in the traffic data packet; in response to determining that the actual data volume of each traffic data packet is equal to the data volume recorded therein, determining that packet loss does not occur in the second traffic data; in response to determining that the actual data volume of the traffic data packet is not equal to the data volume recorded therein, determining that packet loss occurs in the second traffic data.
[0006] Optionally, the second traffic data includes at least one traffic data packet, and the traffic data packet records the serial number of the traffic data packet; the formal verification of the second traffic data includes: based on the serial numbers of all traffic data packets, rearranging all traffic data packets in the second traffic data to obtain arranged traffic data; matching the arranged traffic data according to the predetermined rules, and in response to determining that the arranged traffic data matches successfully, verifying whether the number of predetermined fields in the arranged traffic data is greater than a predetermined value; in response to determining that the number of predetermined fields is greater than the predetermined value, determining that the second traffic data passes the formal verification.
[0007] Optionally, the second traffic data includes at least one traffic data packet, and the traffic data packet records the sequence number of the traffic data packet; the byte detection of the second traffic data includes: based on the sequence numbers of all traffic data packets, rearranging all traffic data packets in the second traffic data to obtain arranged traffic data; detecting whether the first field in the first traffic data packet in the arranged traffic data is a predetermined field; in response to determining that the first field in the first traffic data packet is not the predetermined field, performing field verification on the second field and the third field in the first traffic data packet; in response to determining that the length of the second field belongs to a predetermined length range and the third field belongs to a predetermined type, determining that the second field and the third field pass the field verification, and performing formal verification on the arranged traffic data; in response to determining that the arranged traffic data passes the formal verification, determining that the second traffic data passes the byte detection.
[0008] Optionally, it also includes: in response to determining that the length of the second field does not belong to the predetermined length range, and / or that the third field does not belong to the predetermined type, determining that the second field and the third field have not passed the field verification, and setting the detection point of the arranged traffic data in the first traffic data packet; performing multiple rounds of movement detection on the traffic data packets located after the detection point in the arranged traffic data, and for each round of movement detection: performing movement detection on a predetermined number of traffic data packets located after the detection point, if the predetermined number of traffic data packets fail the movement detection, moving the detection point to after the predetermined number of traffic data packets, and performing the next round Mobile detection; if the predetermined number of traffic data packets pass the mobile detection, end multiple rounds of mobile detection, and perform the field verification on the two fields after the predetermined field of the last traffic data packet in the predetermined number of traffic data packets; in response to determining that both of the two fields pass the field verification, perform formal verification on the arranged traffic data; in response to determining that the arranged traffic data passes the formal verification, determine that the second traffic data corresponding to the arranged traffic data passes the byte detection; if the number of traffic data packets after the detection point is less than the predetermined number, end multiple rounds of mobile detection, and determine that the second traffic data corresponding to the arranged traffic data does not pass the byte detection.
[0009] Optionally, performing movement detection on a predetermined number of traffic data packets located after the detection point includes: in response to determining that there are a predetermined number of consecutive traffic data packets that all include a predetermined field, determining that the predetermined number of traffic data packets located after the detection point pass the movement detection.
[0010] Optionally, matching the first traffic data according to a predetermined rule includes: parsing the first traffic data to obtain all fields corresponding to the first traffic data; and matching all fields with fields in the predetermined rule.
[0011] Optionally, the method further includes: in response to determining that the first traffic data matches successfully, determining that the first traffic data is the Border Gateway Protocol traffic.
[0012] Based on the same inventive concept, the present application also provides a device for determining Border Gateway Protocol traffic, including: a first receiving module, configured to receive first traffic data in traffic data, and match the first traffic data according to a predetermined rule; a second receiving module, configured to continue to receive second traffic data in the traffic data in response to determining that the first traffic data is not matched successfully; a packet loss detection module, configured to detect whether packet loss occurs in the second traffic data; a first determination module, configured to perform formal verification on the second traffic data in response to determining that no packet loss occurs in the second traffic data, and determine the traffic data as the Border Gateway Protocol traffic in response to determining that the second traffic data passes the formal verification; a second determination module, configured to perform byte detection on the second traffic data in response to determining that packet loss occurs in the second traffic data, and determine the traffic data as the Border Gateway Protocol traffic in response to determining that the second traffic data passes the byte detection.
[0013] Based on the same inventive concept, the present application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable by the processor, wherein the processor implements the method as described above when executing the computer program.
[0014] As can be seen from the above, the method, device, electronic device and storage medium for determining the border gateway protocol traffic provided by the present application include receiving the first traffic data in the traffic data, matching the first traffic data according to a predetermined rule, and improving the efficiency of determining the type of traffic data. In response to determining that the first traffic data is not matched successfully, continue to receive the second traffic data in the traffic data, so as to provide more traffic data for determining the type of traffic data. Detect whether the second traffic data has packet loss, so as to check the integrity of the second traffic data. In response to determining that the second traffic data has not been lost, formal verification is performed on the second traffic data, and in response to determining that the second traffic data passes the formal verification, the traffic data is determined to be the border gateway protocol traffic, so as to accurately determine the border gateway protocol traffic. In response to determining that the second traffic data has been lost, byte detection is performed on the second traffic data, and in response to determining that the second traffic data passes the byte detection, the traffic data is determined to be the border gateway protocol traffic, so as to accurately determine the border gateway protocol traffic. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] In order to more clearly illustrate the technical solutions in the present application or related technologies, the drawings required for use in the embodiments or related technical descriptions are briefly introduced below. Obviously, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0016] Figure 1 A schematic diagram of a flow chart of a method for determining border gateway protocol traffic according to an embodiment of the present application;
[0017] Figure 2 A schematic diagram of packet loss in border gateway protocol traffic according to an embodiment of the present application;
[0018] Figure 3 A characteristic schematic diagram of the first traffic data packet of the border gateway protocol traffic of an embodiment of the present application;
[0019] Figure 4 A schematic diagram of a flow chart of a method for determining border gateway protocol traffic according to another embodiment of the present application;
[0020] Figure 5 A schematic diagram of the structure of a device for determining border gateway protocol traffic according to an embodiment of the present application;
[0021] Figure 6 This is a schematic diagram of the hardware structure of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0022] In order to make the objectives, technical solutions and advantages of the present application more clearly understood, the present application is further described in detail below in combination with specific embodiments and with reference to the accompanying drawings.
[0023] It should be noted that, unless otherwise defined, the technical terms or scientific terms used in the embodiments of the present application should be the usual meanings understood by people with ordinary skills in the field to which the present application belongs. The "first", "second" and similar words used in the embodiments of the present application do not represent any order, quantity or importance, but are only used to distinguish different components. "Including" or "comprising" and similar words mean that the elements or objects appearing in front of the word cover the elements or objects listed after the word and their equivalents, without excluding other elements or objects. "Connect" or "connected" and similar words are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect. "Up", "down", "left", "right" and the like are only used to indicate relative positional relationships. When the absolute position of the described object changes, the relative positional relationship may also change accordingly.
[0024] As described in the background technology section, in an intrusion detection system, accurate identification of various protocols carried by network traffic is a necessary condition for accurate detection. For typical routing protocols such as BGP, it has relatively typical port features and DPI features. When the quality of network traffic is good, its port features and header DPI features can be used for accurate identification. However, once the port is non-standard or the data packet is missing, at this time, due to the lack of port features and DPI features, the traditional identification method is basically invalid, and the traditional method can hardly identify the protocol type. Exemplarily, when a non-standard port or BGP message is not strictly encapsulated in a TCP packet and packet loss occurs, the above-mentioned protocol identification method becomes invalid.
[0025] The specific failure situations are as follows: When the TCP protocol data packet carrying the BGP protocol message uses the non-standard port 179, the conventional identification method based on ports and DPI features cannot identify the BGP protocol; BGP data is not strictly encapsulated in a TCP packet according to one BGP packet, and there is packet loss in the TCP flow, and the conventional identification method based on ports and DPI features cannot identify the BGP protocol.
[0026] It should be noted that the Border Gateway Protocol (BGP) is an autonomous system routing protocol running on TCP. BGP is the only protocol used to handle networks as large as the Internet, and the only protocol that can properly handle multiple connections between unrelated routing domains. BGP is built on the experience of EGP. The main function of the BGP system is to exchange network reachability information with other BGP systems. Network reachability information includes information about listed autonomous systems (AS). This information effectively constructs a topological diagram of AS interconnection and thereby eliminates routing loops, while policy decisions can be implemented at the AS level.
[0027] In view of this, the present application embodiment proposes a method for determining border gateway protocol traffic, referring to Figure 1 , including the following steps:
[0028] Step 101: Receive first flow data in flow data, and match the first flow data according to a predetermined rule.
[0029] In this step, first flow data in the flow data is received, the data volume of the first flow data is relatively small, and the first flow data with a relatively small data volume is matched according to a predetermined rule to determine the flow type corresponding to the first flow data. The predetermined rule is a rule pre-set for identifying the type of flow data. By using the first flow data with a relatively small data volume to match according to the predetermined rule, the efficiency of determining the type of flow data is improved.
[0030] Step 102: In response to determining that the first traffic data is not successfully matched, continue to receive second traffic data in the traffic data.
[0031] In this step, if the first flow data is not matched successfully, it means that the type of the first flow data has not been determined. At this time, more flow data needs to be cached to determine the type of the flow data. Therefore, it is necessary to continue to receive the second flow data in the flow data, wherein the data volume of the second flow data is greater than the data volume of the first flow data, so as to provide more flow data for determining the type of the flow data.
[0032] Step 103: Detect whether packet loss occurs in the second traffic data.
[0033] In this step, it is detected whether the second flow data has packet loss, thereby achieving the purpose of checking the integrity of the second flow data. Figure 2 This is a schematic diagram of packet loss in the border gateway protocol traffic of an embodiment of the present application. Packet loss refers to the inability of one or more traffic data packets to reach the destination through the network. Packet loss may be caused by many factors, including signal attenuation caused by multipath fading in the network, or packet loss caused by channel blocking, damaged data packets being rejected, or defective network hardware and network driver failures.
[0034] Step 104, in response to determining that no packet loss occurs in the second traffic data, performing formal verification on the second traffic data, and in response to determining that the second traffic data passes the formal verification, determining the traffic data as the Border Gateway Protocol traffic.
[0035] In this step, when it is detected that there is no packet loss in the second traffic data, it means that the second traffic data has integrity. When the second traffic data has integrity, formal verification is used to verify the second traffic data. By means of formal verification, it is possible to determine whether the second traffic data satisfies a predetermined format. When the second traffic data satisfies the predetermined format, it means that the second traffic data has passed the formal verification. When the second traffic data passes the formal verification, the traffic data is determined to be Border Gateway Protocol traffic, thereby achieving the purpose of accurately determining the Border Gateway Protocol traffic. It should be noted that when the second traffic data fails to pass the formal verification, the traffic data is determined not to be Border Gateway Protocol traffic. The BGP protocol is a common routing protocol used in TCP / IP networks. According to RFC4271, the protocol is normally transmitted using the TCP protocol, with a typical port number of 179, and the first traffic data packet of the protocol has the following characteristics: Figure 3As shown in the figure, Marker: is 16 bytes with all 1s, that is, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF; Length: is the message length, generally 19-4096; Type: type, generally 1-6.
[0036] Step 105: In response to determining that packet loss occurs in the second traffic data, performing byte detection on the second traffic data; in response to determining that the second traffic data passes the byte detection, determining the traffic data as the Border Gateway Protocol traffic.
[0037] In this step, if packet loss is detected in the second traffic data, it means that the second traffic data is not complete. At this time, it is necessary to detect whether the second traffic data includes the predetermined bytes. If the second traffic data includes the predetermined bytes, it means that the second traffic data passes the byte detection. If the second traffic data passes the byte detection, the traffic data is determined to be Border Gateway Protocol traffic, thereby achieving the purpose of accurately determining Border Gateway Protocol traffic. It should be noted that if the second traffic data does not pass the byte detection, the traffic data is determined not to be Border Gateway Protocol traffic.
[0038] Through the above scheme, the first flow data in the flow data is received, and the first flow data is matched according to a predetermined rule, thereby improving the efficiency of determining the type of flow data. In response to determining that the first flow data is not matched successfully, the second flow data in the flow data continues to be received, so as to achieve the purpose of providing more flow data for determining the type of flow data. Whether the second flow data has packet loss is detected, so as to achieve the purpose of checking the integrity of the second flow data. In response to determining that the second flow data has not been lost, a formal verification is performed on the second flow data, and in response to determining that the second flow data passes the formal verification, the flow data is determined to be the Border Gateway Protocol flow, so as to achieve the purpose of accurately determining the Border Gateway Protocol flow. In response to determining that the second flow data has been lost, a byte detection is performed on the second flow data, and in response to determining that the second flow data passes the byte detection, the flow data is determined to be the Border Gateway Protocol flow, so as to achieve the purpose of accurately determining the Border Gateway Protocol flow.
[0039] In some embodiments, the second traffic data includes at least one traffic data packet, and the traffic data packet records the data volume of the traffic data packet; the detecting whether packet loss occurs in the second traffic data includes: detecting whether the actual data volume of the traffic data packet is equal to the data volume recorded in the traffic data packet; in response to determining that the actual data volume of each traffic data packet is equal to the data volume recorded therein, determining that packet loss does not occur in the second traffic data; in response to determining that the actual data volume of the traffic data packet is not equal to the data volume recorded therein, determining that packet loss occurs in the second traffic data.
[0040] In this embodiment, the second traffic data includes traffic data packets, each of which includes ACK (Acknowledge character) information, and the data volume of the traffic data packet is recorded in the ACK information. It is detected whether the actual data volume in the traffic data packet is equal to the data volume recorded in the traffic data packet. In the case where the actual data volume of each traffic packet is equal to the recorded data volume, it means that there is no packet loss in the second traffic data; in the case where the actual data volume of a traffic data packet is not equal to the recorded data volume, it means that there is packet loss in the second traffic data. By comparing the actual data volume of the traffic data packet with the recorded data volume, the purpose of accurately determining whether there is packet loss in the second traffic data is achieved.
[0041] It should be noted that in data communication, a transmission control character sent by the receiving station to the sending station indicates that the sent data has been confirmed to be received correctly. In the TCP / IP protocol, if the receiving party successfully receives the data, it will reply with an ACK data. Usually, the ACK signal has its own fixed format and length, and is replied by the receiving party to the sending party.
[0042] In some embodiments, the second traffic data includes at least one traffic data packet, and the traffic data packet records the serial number of the traffic data packet; the formal verification of the second traffic data includes: based on the serial numbers of all traffic data packets, rearranging all traffic data packets in the second traffic data to obtain arranged traffic data; matching the arranged traffic data according to the predetermined rules, and in response to determining that the arranged traffic data matches successfully, verifying whether the number of predetermined fields in the arranged traffic data is greater than a predetermined value; in response to determining that the number of predetermined fields is greater than the predetermined value, determining that the second traffic data passes the formal verification.
[0043] In this embodiment, when the traffic data packets in the second traffic data are sent in parallel, the transmission speed of the data traffic packets with relatively small data volume is relatively fast. Therefore, the transmission completion time of the data packets with different data volumes is not the same, and the data traffic packets are not received in the correct order. The traffic data packets record the sequence number of the traffic data packets. Based on the sequence numbers of all traffic data packets, all traffic data packets in the second traffic data are rearranged to obtain arranged traffic data. The traffic data packets in the arranged traffic data are sorted in the correct order. Since the data volume of the arranged traffic data is greater than the first traffic data, although the first traffic data corresponding to the arranged traffic data does not conform to the predetermined rules, when the data volume of the arranged traffic data is relatively large, there is a possibility that the arranged traffic data conforms to the predetermined rules. Therefore, the arranged traffic data is matched according to the predetermined rules. In the case where the arranged traffic data matches successfully, it is also necessary to verify whether the number of predetermined fields in the arranged traffic data is greater than the predetermined value, wherein the predetermined field is 0xFF. Exemplarily, after locating the 0xFF feature, the 2-byte LENGTH field after the 0xFF feature is taken; then after skipping the traffic data packet of the LENGTH field, it is detected whether the subsequent traffic data packet includes the 0xFF byte. If so, it is considered that the formal verification has passed. If the arranged traffic data fails to match successfully, it indicates that the arranged traffic data is not Border Gateway Protocol traffic. If the predetermined field is greater than the predetermined value, it is determined that the second traffic data passes the formal verification, which improves the accuracy of determining that the second traffic data passes the formal verification.
[0044] In some embodiments, the second traffic data includes at least one traffic data packet, and the traffic data packet records the sequence number of the traffic data packet; the byte detection of the second traffic data includes: based on the sequence numbers of all traffic data packets, rearranging all traffic data packets in the second traffic data to obtain arranged traffic data; detecting whether the first field in the first traffic data packet in the arranged traffic data is a predetermined field; in response to determining that the first field in the first traffic data packet is not the predetermined field, performing field verification on the second field and the third field in the first traffic data packet; in response to determining that the length of the second field belongs to a predetermined length range and the third field belongs to a predetermined type, determining that the second field and the third field pass the field verification, and performing formal verification on the arranged traffic data; in response to determining that the arranged traffic data passes the formal verification, determining that the second traffic data passes the byte detection.
[0045] In this embodiment, when the traffic data packets are sent in parallel, the transmission speed of the data traffic packets with relatively small data volume is relatively fast, so the data traffic packets are not received in the correct order. The traffic data packets record the sequence number of the traffic data packets. Based on the sequence numbers of all the traffic data packets, all the traffic data packets in the second traffic data are rearranged to obtain arranged traffic data. It is detected whether the first field in the first traffic data packet in the arranged traffic data is a predetermined field. When the first field in the first traffic data packet is not the predetermined field, it is indicated that the arranged traffic data is not a Border Gateway Protocol traffic. At this time, it is necessary to continue to verify the second field and the third field in the arranged traffic data. When the length of the second field belongs to the predetermined length range and the third field belongs to the predetermined type, it is determined that the second field and the third field pass the field verification. At this time, there is a possibility that the arranged traffic data is a Border Gateway Protocol traffic. In order to make the determination result more accurate, it is also necessary to perform formal verification on the arranged traffic data. When the arranged traffic data passes the formal verification, it is indicated that the second traffic data passes the byte detection, which improves the accuracy of determining that the second traffic data passes the byte detection.
[0046] In some embodiments, it also includes: in response to determining that the length of the second field does not belong to the predetermined length range, and / or that the third field does not belong to the predetermined type, determining that the second field and the third field do not pass the field verification, and setting the detection point of the arranged traffic data in the first traffic data packet; performing multiple rounds of movement detection on the traffic data packets located after the detection point in the arranged traffic data, for each round of movement detection: performing movement detection on a predetermined number of traffic data packets located after the detection point, if the predetermined number of traffic data packets do not pass the movement detection, moving the detection point to after the predetermined number of traffic data packets, and performing the next A round of movement detection; if the predetermined number of traffic data packets pass the movement detection, end multiple rounds of movement detection, and perform the field verification on the two fields after the predetermined field of the last traffic data packet in the predetermined number of traffic data packets; in response to determining that both of the two fields pass the field verification, perform formal verification on the arranged traffic data; in response to determining that the arranged traffic data passes the formal verification, determine that the second traffic data corresponding to the arranged traffic data passes the byte detection; if the number of traffic data packets after the detection point is less than the predetermined number, end multiple rounds of movement detection, and determine that the second traffic data corresponding to the arranged traffic data does not pass the byte detection.
[0047] In this embodiment, when the length of the second field does not belong to the predetermined length range, and / or the third field does not belong to the predetermined type, it means that the second field and the third field have not passed the field verification, indicating that there is a possibility that the arranged traffic data is not the border gateway protocol traffic. Exemplarily, the predetermined length is 19-4096, and the length of the second field does not belong to 19-4096; the predetermined type is 1-6, and the third field does not belong to 1-6, indicating that both the second field and the third field have not passed the field verification. At this time, it is necessary to perform mobile detection on all arranged traffic data. First, the detection point of the arranged traffic data is set in the first traffic data packet. It should be noted that in order to improve the detection efficiency, the detection point of the arranged traffic data can be set after the third field of the first traffic data packet, and multiple rounds of mobile detection are performed on the traffic data packets located after the detection point in the arranged traffic data. For each round of mobile detection: mobile detection is performed on a predetermined number of traffic data packets after the detection point. Through mobile detection, multiple fields in multiple traffic data packets in the arranged traffic data can be detected. In the case where a predetermined number of traffic data packets fail to pass the mobile detection, the detection point needs to be moved. Since the predetermined number of traffic data packets have already undergone mobile detection, the detection point needs to be moved to the predetermined number of traffic data packets and the next round of mobile detection needs to be performed. In the case where a predetermined number of traffic data packets pass the mobile detection, it means that multiple fields in the multiple traffic data packets required for mobile detection have been detected, and multiple rounds of mobile detection are terminated. In order to accurately determine whether the second traffic data passes the byte detection, it is also necessary to perform field verification on the two fields after the predetermined field of the last traffic data packet in the predetermined number of traffic data packets. In the case where both fields pass the field verification, it is also necessary to perform formal verification on the arranged traffic data. In the case where the arranged traffic data passes the formal verification, it means that the second traffic data corresponding to the arranged traffic data passes the byte detection. In the case where the number of traffic data packets after the detection point is less than the predetermined number, it means that multiple fields in the multiple traffic data packets required for mobile detection have not been detected, and multiple rounds of mobile detection are terminated, and it also means that the second traffic data corresponding to the arranged traffic data has not passed the byte detection. By performing mobile detection on the arranged traffic data, the purpose of accurately determining whether the second traffic data passes the byte detection is achieved.
[0048] In some embodiments, performing movement detection on a predetermined number of traffic data packets located after the detection point includes: in response to determining that there are a predetermined number of consecutive traffic data packets that all include a predetermined field, determining that the predetermined number of traffic data packets located after the detection point pass the movement detection.
[0049] In this embodiment, when there are a predetermined number of consecutive traffic data packets that include predetermined fields, it means that multiple fields in the multiple traffic data packets required for mobile detection have been detected, and it is determined that a predetermined number of traffic data packets located after the detection point have passed the mobile detection, thereby achieving the purpose of accurately determining whether the arranged traffic data has passed the mobile detection.
[0050] In some embodiments, matching the first traffic data according to a predetermined rule includes: parsing the first traffic data to obtain all fields corresponding to the first traffic data; and matching all fields with fields in the predetermined rule.
[0051] In this embodiment, the first flow data is parsed to obtain all fields corresponding to the first flow data. All fields reflect which fields the first flow data specifically includes, thereby achieving the purpose of splitting the first flow data. All fields are matched with fields in a predetermined rule. For example, the predetermined rule is a regular matching rule, and the regular matching rule is By matching all fields with the fields in the predetermined rule, the purpose of accurately determining the type of the first traffic data is achieved.
[0052] In some embodiments, it also includes: in response to determining that the first traffic data matches successfully, determining that the first traffic data is the Border Gateway Protocol traffic.
[0053] In this embodiment, when the first traffic data is matched successfully, it means that the first traffic data meets the predetermined rule, and it is efficiently determined that the first traffic data is Border Gateway Protocol traffic.
[0054] In another embodiment provided in the present application, Figure 4 As shown, Figure 4This is a flow chart of a method for determining border gateway protocol traffic according to another embodiment of the present application. Step 1: First, quickly identify the second traffic data according to the traditional method. Determine whether the second traffic data hits the BGP (Border Gateway Protocol, Border Gateway Protocol traffic) regular rule. If the second traffic data hits the BGP regular rule, go to step 7 to determine that the type of the second traffic data is border gateway protocol traffic. If the second traffic data does not hit the BGP regular rule, go to step 2. Step 2: Sort the TCP data packet cache. Step 3: Payload vulnerability distribution statistics to determine packet loss, determine whether the sorted second traffic data has packet loss, if packet loss occurs, go to step 4, if no packet loss occurs, go to step 5. Step 4: Perform traditional feature scanning on complete TCP data. Determine whether the sorted second traffic data hits the BGP regular rule. If the sorted second traffic data does not hit the BGP regular rule, go to step 7; if the sorted second traffic data hits the BGP regular rule, go to step 6. Step 5: Perform deep feature scanning on incomplete TCP data. Step 6: Formal verification. Step 7: Finally calibrate the identification results. This application can solve the problem of accurately identifying the BGP protocol in the case of TCP packet loss and non-standard ports. Compared with the traditional BGP protocol identification method, when the BGP features are partially destroyed, the BGP protocol can still be identified more accurately. It is suitable for scenarios that require deep and accurate identification of incomplete traffic.
[0055] It should be noted that the method of the embodiment of the present application can be performed by a single device, such as a computer or server. The method of this embodiment can also be applied to a distributed scenario and completed by multiple devices cooperating with each other. In the case of such a distributed scenario, one of the multiple devices can only perform one or more steps in the method of the embodiment of the present application, and the multiple devices will interact with each other to complete the described method.
[0056] It should be noted that the above describes some embodiments of the present application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the above embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0057] Based on the same inventive concept, corresponding to any of the above-mentioned embodiment methods, the present application also provides a device for determining border gateway protocol traffic.
[0058] refer to Figure 5 , the device for determining the border gateway protocol traffic comprises:
[0059] The first receiving module 10 is configured to receive first flow data in the flow data, and match the first flow data according to a predetermined rule.
[0060] The second receiving module 20 is configured to continue receiving second flow data in the flow data in response to determining that the first flow data is not successfully matched.
[0061] The packet loss detection module 30 is configured to detect whether packet loss occurs in the second traffic data.
[0062] The first determination module 40 is configured to, in response to determining that no packet loss occurs in the second traffic data, perform formal verification on the second traffic data, and in response to determining that the second traffic data passes the formal verification, determine the traffic data as the Border Gateway Protocol traffic.
[0063] The second determination module 50 is configured to, in response to determining that packet loss occurs in the second traffic data, perform byte detection on the second traffic data, and in response to determining that the second traffic data passes the byte detection, determine the traffic data as the Border Gateway Protocol traffic.
[0064] Through the above-mentioned device, the first flow data in the flow data is received, and the first flow data is matched according to a predetermined rule, thereby improving the efficiency of determining the type of flow data. In response to determining that the first flow data is not matched successfully, the second flow data in the flow data is continued to be received, so as to achieve the purpose of providing more flow data for determining the type of flow data. Whether the second flow data has packet loss is detected, so as to achieve the purpose of checking the integrity of the second flow data. In response to determining that the second flow data has not been lost, a formal verification is performed on the second flow data, and in response to determining that the second flow data passes the formal verification, the flow data is determined to be the Border Gateway Protocol flow, so as to achieve the purpose of accurately determining the Border Gateway Protocol flow. In response to determining that the second flow data has been lost, a byte detection is performed on the second flow data, and in response to determining that the second flow data passes the byte detection, the flow data is determined to be the Border Gateway Protocol flow, so as to achieve the purpose of accurately determining the Border Gateway Protocol flow.
[0065] In some embodiments, the packet loss detection module 30 is further configured such that the second traffic data includes at least one traffic data packet, and the traffic data packet records the data volume of the traffic data packet; detects whether the actual data volume of the traffic data packet is equal to the data volume recorded in the traffic data packet; determines that no packet loss occurs in the second traffic data in response to determining that the actual data volume of each traffic data packet is equal to the data volume recorded therein; determines that packet loss occurs in the second traffic data in response to determining that the actual data volume of the traffic data packet is not equal to the data volume recorded therein.
[0066] In some embodiments, the first determination module 40 is further configured that the second traffic data includes at least one traffic data packet, and the traffic data packet records the sequence number of the traffic data packet; based on the sequence numbers of all traffic data packets, all traffic data packets in the second traffic data are rearranged to obtain arranged traffic data; the arranged traffic data is matched according to the predetermined rule, and in response to determining that the arranged traffic data matches successfully, verifying whether the number of predetermined fields in the arranged traffic data is greater than a predetermined value; in response to determining that the number of predetermined fields is greater than the predetermined value, determining that the second traffic data passes the formal verification.
[0067] In some embodiments, the second determination module 50 is further configured such that the second traffic data includes at least one traffic data packet, and the traffic data packet records the sequence number of the traffic data packet; based on the sequence numbers of all traffic data packets, all traffic data packets in the second traffic data are rearranged to obtain arranged traffic data; whether the first field in the first traffic data packet in the arranged traffic data is a predetermined field is detected; in response to determining that the first field in the first traffic data packet is not the predetermined field, field verification is performed on the second field and the third field in the first traffic data packet; in response to determining that the length of the second field belongs to a predetermined length range and that the third field belongs to a predetermined type, determining that the second field and the third field pass the field verification, and performing formal verification on the arranged traffic data; in response to determining that the arranged traffic data passes the formal verification, determining that the second traffic data passes the byte detection.
[0068] In some embodiments, a movement detection module is further included, and the movement detection module is configured to, in response to determining that the length of the second field does not belong to the predetermined length range and / or that the third field does not belong to the predetermined type, determine that the second field and the third field have not passed the field verification, and set the detection point of the arranged traffic data in the first traffic data packet; perform multiple rounds of movement detection on the traffic data packets located after the detection point in the arranged traffic data, and for each round of movement detection: perform movement detection on a predetermined number of traffic data packets located after the detection point, and if the predetermined number of traffic data packets fail the movement detection, move the detection point to a predetermined number of traffic data packets. After the data packet, the next round of movement detection is performed; if the predetermined number of traffic data packets pass the movement detection, multiple rounds of movement detection are terminated, and the field verification is performed on the two fields after the predetermined field of the last traffic data packet in the predetermined number of traffic data packets; in response to determining that both of the two fields pass the field verification, a formal verification is performed on the arranged traffic data; in response to determining that the arranged traffic data passes the formal verification, it is determined that the second traffic data corresponding to the arranged traffic data passes the byte detection; if the number of traffic data packets after the detection point is less than the predetermined number, multiple rounds of movement detection are terminated, and it is determined that the second traffic data corresponding to the arranged traffic data does not pass the byte detection.
[0069] In some embodiments, the motion detection module is further configured to determine that a predetermined number of traffic data packets located after the detection point pass the motion detection in response to determining that there are a predetermined number of consecutive traffic data packets that include the predetermined field.
[0070] In some embodiments, the packet loss detection module 30 is further configured to parse the first traffic data to obtain all fields corresponding to the first traffic data; and match all fields with fields in the predetermined rule.
[0071] In some embodiments, a third determination module is further included, and the third determination module is configured to determine that the first traffic data is the border gateway protocol traffic in response to determining that the first traffic data matches successfully.
[0072] For the convenience of description, the above device is described in terms of functions divided into various modules. Of course, when implementing the present application, the functions of each module can be implemented in the same or multiple software and / or hardware.
[0073] The device of the above embodiment is used to implement the corresponding method for determining border gateway protocol traffic in any of the above embodiments, and has the beneficial effects of the corresponding method embodiment, which will not be repeated here.
[0074] Based on the same inventive concept, corresponding to any of the above-mentioned embodiments and methods, the present application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the method for determining border gateway protocol traffic as described in any of the above embodiments is implemented.
[0075] Figure 6 A more specific schematic diagram of the hardware structure of an electronic device provided in this embodiment is shown, and the device may include: a processor 1010, a memory 1020, an input / output interface 1030, a communication interface 1040, and a bus 1050. The processor 1010, the memory 1020, the input / output interface 1030, and the communication interface 1040 are connected to each other through the bus 1050 in the device.
[0076] The processor 1010 can be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this specification.
[0077] The memory 1020 may be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory), static storage device, dynamic storage device, etc. The memory 1020 may store an operating system and other application programs. When the technical solutions provided in the embodiments of this specification are implemented by software or firmware, the relevant program codes are stored in the memory 1020 and are called and executed by the processor 1010.
[0078] The input / output interface 1030 is used to connect the input / output module to realize information input and output. The input / output module can be configured in the device as a component (not shown in the figure), or it can be externally connected to the device to provide corresponding functions. The input device may include a keyboard, a mouse, a touch screen, a microphone, various sensors, etc., and the output device may include a display, a speaker, a vibrator, an indicator light, etc.
[0079] The communication interface 1040 is used to connect a communication module (not shown) to realize communication interaction between the device and other devices. The communication module can realize communication through wired means (such as USB, network cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.).
[0080] The bus 1050 includes a path that transmits information between the various components of the device (eg, the processor 1010 , the memory 1020 , the input / output interface 1030 , and the communication interface 1040 ).
[0081] It should be noted that, although the above device only shows the processor 1010, the memory 1020, the input / output interface 1030, the communication interface 1040 and the bus 1050, in the specific implementation process, the device may also include other components necessary for normal operation. In addition, it can be understood by those skilled in the art that the above device may also only include the components necessary for implementing the embodiments of the present specification, and does not necessarily include all the components shown in the figure.
[0082] The electronic device of the above embodiment is used to implement the corresponding method for determining border gateway protocol traffic in any of the above embodiments, and has the beneficial effects of the corresponding method embodiment, which will not be repeated here.
[0083] Based on the same inventive concept, corresponding to any of the above-mentioned embodiment methods, the present application also provides a non-transitory computer-readable storage medium, wherein the non-transitory computer-readable storage medium stores computer instructions, and the computer instructions are used to enable the computer to execute the method for determining border gateway protocol traffic as described in any of the above embodiments.
[0084] The computer-readable medium of this embodiment includes permanent and non-permanent, removable and non-removable media, and information storage can be implemented by any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, read-only compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device.
[0085] The computer instructions stored in the storage medium of the above embodiment are used to enable the computer to execute the method for determining the border gateway protocol traffic as described in any of the above embodiments, and have the beneficial effects of the corresponding method embodiments, which will not be repeated here.
[0086] Based on the same concept, corresponding to any of the above-mentioned embodiment methods, the present application also provides a computer program product, including computer program instructions. When the computer program instructions are executed on a computer, the computer executes the method for determining border gateway protocol traffic as described in any of the above embodiments, which has the beneficial effects of the corresponding method embodiments and will not be repeated here.
[0087] It is understandable that before using the technical solutions of each embodiment of the present disclosure, the type, scope of use, usage scenarios, etc. of the personal information involved will be informed to the user in an appropriate manner, and the user's authorization will be obtained.
[0088] For example, in response to receiving an active request from a user, a prompt message is sent to the user to clearly remind the user that the operation requested to be performed will require obtaining and using the user's personal information. Thus, the user can independently choose whether to provide personal information to software or hardware such as an electronic device, application, server, or storage medium that performs the operation of the technical solution of the present disclosure according to the prompt message.
[0089] As an optional but non-limiting implementation, in response to receiving the user's active request, the prompt information may be sent to the user in the form of a pop-up window, in which the prompt information may be presented in text form. In addition, the pop-up window may also carry a selection control for the user to choose "agree" or "disagree" to provide personal information to the electronic device.
[0090] It is understandable that the above notification and the process of obtaining user authorization are merely illustrative and do not constitute a limitation on the implementation of the present disclosure. Other methods that meet relevant laws and regulations may also be applied to the implementation of the present disclosure.
[0091] A person skilled in the art should understand that the discussion of any of the above embodiments is merely illustrative and is not intended to imply that the scope of the present application (including the claims) is limited to these examples. In line with the concept of the present application, the technical features in the above embodiments or different embodiments may be combined, the steps may be implemented in any order, and there are many other variations of the different aspects of the embodiments of the present application as described above, which are not provided in detail for the sake of simplicity.
[0092] In addition, to simplify the description and discussion, and in order not to make the embodiments of the present application difficult to understand, the known power / ground connections to the integrated circuit (IC) chip and other components may or may not be shown in the provided drawings. In addition, the device may be shown in the form of a block diagram to avoid making the embodiments of the present application difficult to understand, and this also takes into account the fact that the details of the implementation of these block diagram devices are highly dependent on the platform on which the embodiments of the present application are to be implemented (that is, these details should be fully within the scope of understanding of those skilled in the art). Where specific details (e.g., circuits) are set forth to describe exemplary embodiments of the present application, it is obvious to those skilled in the art that the embodiments of the present application can be implemented without these specific details or with changes in these specific details. Therefore, these descriptions should be considered illustrative rather than restrictive.
[0093] Although the present application has been described in conjunction with specific embodiments of the present application, many alternatives, modifications and variations of these embodiments will be apparent to those skilled in the art from the foregoing description. For example, other memory architectures (e.g., dynamic RAM (DRAM)) may use the discussed embodiments.
[0094] The embodiments of the present application are intended to cover all such substitutions, modifications and variations that fall within the broad scope of the appended claims. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the embodiments of the present application should be included in the scope of protection of the present application.
Claims
1. A method for determining border gateway protocol traffic, It is characterized in that include: Receiving first flow data in the flow data, and matching the first flow data according to a predetermined rule; In response to determining that the first flow data is not successfully matched, continue to receive second flow data in the flow data; Detecting whether packet loss occurs in the second traffic data; In response to determining that no packet loss occurs in the second traffic data, performing formal verification on the second traffic data, and in response to determining that the second traffic data passes the formal verification, determining the traffic data as the border gateway protocol traffic; The second flow data includes at least one flow data packet, and the flow data packet records the sequence number of the flow data packet; The formal verification of the second flow data includes: based on the sequence numbers of all flow data packets, rearranging all flow data packets in the second flow data to obtain arranged flow data; matching the arranged flow data according to the predetermined rule, and in response to determining that the arranged flow data matches successfully, verifying whether the number of predetermined fields in the arranged flow data is greater than a predetermined value; in response to determining that the number of predetermined fields is greater than the predetermined value, determining that the second flow data passes the formal verification; In response to determining that packet loss occurs in the second traffic data, performing byte detection on the second traffic data, and in response to determining that the second traffic data passes the byte detection, determining the traffic data as the border gateway protocol traffic; The byte detection of the second traffic data includes: based on the sequence numbers of all traffic data packets, rearranging all traffic data packets in the second traffic data to obtain arranged traffic data; detecting whether the first field in the first traffic data packet in the arranged traffic data is a predetermined field; in response to determining that the first field in the first traffic data packet is not the predetermined field, performing field verification on the second field and the third field in the first traffic data packet; in response to determining that the length of the second field belongs to a predetermined length range and the third field belongs to a predetermined type, determining that the second field and the third field pass the field verification, and performing formal verification on the arranged traffic data; in response to determining that the arranged traffic data passes the formal verification, determining that the second traffic data passes the byte detection.
2. The method according to claim 1, It is characterized in that The second flow data includes at least one flow data packet, and the flow data packet records the data volume of the flow data packet; The detecting whether packet loss occurs in the second flow data includes: Detecting whether the actual data volume of the traffic data packet is equal to the data volume recorded in the traffic data packet; In response to determining that the actual data volume of each traffic data packet is equal to the recorded data volume thereof, determining that no packet loss occurs in the second traffic data; In response to determining that the actual data volume of the traffic data packet is not equal to the recorded data volume thereof, it is determined that packet loss occurs in the second traffic data packet.
3. The method according to claim 1, It is characterized in that Also includes: In response to determining that the length of the second field does not belong to the predetermined length range, and / or the third field does not belong to the predetermined type, determining that the second field and the third field do not pass the field verification, and setting the detection point of the arranged traffic data in the first traffic data packet; Perform multiple rounds of movement detection on the traffic data packets located after the detection point in the arranged traffic data, and for each round of movement detection: Performing movement detection on a predetermined number of traffic data packets after the detection point, and if the predetermined number of traffic data packets fail the movement detection, moving the detection point to after the predetermined number of traffic data packets, and performing the next round of movement detection; If the predetermined number of traffic data packets pass the movement detection, the multiple rounds of movement detection are terminated, and the field verification is performed on two fields after the predetermined field of the last traffic data packet in the predetermined number of traffic data packets; In response to determining that both of the two fields pass the field verification, performing a formal verification on the arranged traffic data; in response to determining that the arranged traffic data passes the formal verification, determining that second traffic data corresponding to the arranged traffic data passes the byte detection; If the number of traffic data packets after the detection point is less than the predetermined number, the multiple rounds of movement detection are terminated to determine that the second traffic data corresponding to the arranged traffic data fails to pass the byte detection.
4. The method according to claim 3, It is characterized in that Performing mobile detection on a predetermined number of traffic data packets located after the detection point includes: In response to determining that there are a predetermined number of consecutive traffic data packets that all include the predetermined field, it is determined that a predetermined number of traffic data packets located after the detection point pass the movement detection.
5. The method according to claim 1, It is characterized in that The matching the first flow data according to a predetermined rule includes: Parsing the first flow data to obtain all fields corresponding to the first flow data; All fields are matched with the fields in the predetermined rule.
6. The method according to claim 1, It is characterized in that Also includes: In response to determining that the first traffic data matches successfully, the first traffic data is determined to be the Border Gateway Protocol traffic.
7. A device for determining border gateway protocol traffic, It is characterized in that include: A first receiving module is configured to receive first flow data in the flow data, and match the first flow data according to a predetermined rule; A second receiving module is configured to, in response to determining that the first flow data is not successfully matched, continue to receive second flow data in the flow data; a packet loss detection module, configured to detect whether packet loss occurs in the second flow data; A first determination module is configured to, in response to determining that no packet loss occurs in the second traffic data, perform formal verification on the second traffic data, and in response to determining that the second traffic data passes the formal verification, determine the traffic data as the border gateway protocol traffic; The first determining module is further configured that the second flow data includes at least one flow data packet, and the flow data packet records the sequence number of the flow data packet; Based on the sequence numbers of all the traffic data packets, all the traffic data packets in the second traffic data are rearranged to obtain arranged traffic data; matching the arranged flow data according to the predetermined rule, and in response to determining that the arranged flow data is matched successfully, verifying whether the number of predetermined fields in the arranged flow data is greater than a predetermined value; in response to determining that the number of predetermined fields is greater than the predetermined value, determining that the second flow data passes the formal verification; a second determination module configured to, in response to determining that packet loss occurs in the second traffic data, perform byte detection on the second traffic data, and in response to determining that the second traffic data passes the byte detection, determine the traffic data as the border gateway protocol traffic; The second determination module is further configured to perform byte detection on the second traffic data, including: rearranging all traffic data packets in the second traffic data based on sequence numbers of all traffic data packets to obtain arranged traffic data; Detect whether the first field in the first traffic data packet in the arranged traffic data is a predetermined field; in response to determining that the first field in the first traffic data packet is not the predetermined field, perform field verification on the second field and the third field in the first traffic data packet; in response to determining that the length of the second field belongs to a predetermined length range and the third field belongs to a predetermined type, determine that the second field and the third field pass the field verification, and perform formal verification on the arranged traffic data; in response to determining that the arranged traffic data passes the formal verification, determine that the second traffic data passes the byte detection.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, It is characterized in that When the processor executes the program, the method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Coordinated monitoring method for preventing BGP routing hijacking
CN102394794A
HTTP traffic feature recognition and extraction method based on machine learning
CN110891030A
IP (Internet Protocol) address routing accessibility identification method based on BGP (Border Gateway Protocol) prefix tree
CN115242716A
BGP (Border Gateway Protocol) routing data monitoring method, BGP routing data monitoring device and electronic equipment
CN116318800A
Monitoring service availability using distributed BGP routing feeds
US9729414B1
