A method and apparatus for detecting violations based on UDP protocol traffic characteristics

By combining multi-dimensional feature cross-verification of UDP traffic logs and DNS resolution logs, the problems of missed detection, high false alarm rate and latency in UDP violation detection are solved, and accurate identification and location of UDP violations are achieved, adapting to dynamic network environments.

CN122933287BActive Publication Date: 2026-11-17COLASOFT +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202611426142.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-09-15
Publication Date
2026-11-17
Estimated Expiration
2046-09-15

AI Technical Summary

Technical Problem

Existing technologies for detecting UDP protocol violations suffer from several problems, including missed detections, high false alarm rates, inability to accurately pinpoint the illegal access scenario, high detection latency, and difficulty in adapting to dynamically changing UDP violation traffic.

Method used

By acquiring UDP traffic logs and DNS resolution logs from the entire network collected by passive mirroring, and combining them with multi-dimensional features for joint cross-verification, including communication duration, load ratio, protocol type, port uniqueness, and correlation with DNS resolution logs, suspected illegal sessions are screened out and confirmed.

Benefits of technology

It achieves low false alarm and false negative rates for UDP violation detection, can accurately locate the specific business scenarios of illegal access, adapts to dynamic UDP violation traffic, and meets the needs of normalized real-time risk control detection across the entire network.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122933287B_ABST
    Figure CN122933287B_ABST
Patent Text Reader

Abstract

This invention discloses a method and apparatus for detecting violations based on UDP protocol traffic characteristics, belonging to the field of network security technology. The method includes: acquiring UDP traffic logs and DNS resolution logs collected by passive mirroring from the entire network; removing UDP communication sessions from the UDP traffic logs that satisfy any condition in a first set of conditions to obtain a first candidate session set; grouping and aggregating the sessions by client IP and server IP; retaining groups that simultaneously satisfy all conditions in a second set of conditions, and identifying the corresponding UDP communication sessions as suspected violations; associating the server IP addresses in the suspected violations with DNS resolution logs, aggregating to obtain the corresponding domain name information, and identifying the suspected violations corresponding to domain name records that do not contain preset DNS feature strings as confirmed violations; and outputting the violation record corresponding to the confirmed violation session. This invention reduces the false negative rate and false positive rate of violation detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of network security technology, and in particular relates to a method and apparatus for detecting violations based on UDP protocol traffic characteristics. Background Technology

[0002] Currently, the mainstream technical solutions for detecting and identifying network terminal violations in the industry mainly fall into three categories: feature-based matching detection, IP blacklist blocking, and full-traffic keyword retrieval. These solutions are primarily designed for conventional TCP protocol-type illegal access traffic, and their detection capabilities for UDP protocol violations are significantly insufficient, making them ill-suited for the diverse and covert UDP illegal access scenarios prevalent today.

[0003] Existing detection technologies mostly rely on pre-defined blacklists of illegal IP addresses and domain names, along with fixed TCP traffic characteristics, for matching and screening. By comparing the destination IP address, accessed domain name, and TCP handshake characteristics, they determine whether a terminal is engaging in illegal activity. While these technologies have some ability to identify common TCP protocol violations, they are less effective at detecting mainstream UDP protocol encrypted tunnel transmissions and tunnel-based illegal external connections. Specifically, they suffer from the following inherent limitations:

[0004] First, existing technologies rely solely on basic characteristics such as IP addresses and domain names for matching, which fails to capture the hidden behavioral patterns of UDP illegal traffic, resulting in a large number of hidden UDP illegal behaviors going undetected.

[0005] Second, UDP violations often employ custom private protocols and dynamic encrypted tunnel transmissions, lacking fixed feature fingerprints for static matching. Traditional static feature database matching methods are difficult to adapt to dynamically changing UDP violation traffic, and feature updates lag behind the iteration speed of violation tools, resulting in a continuous decrease in identification accuracy.

[0006] Third, existing technologies lack sophisticated screening rules for specific UDP violation behavior logic and lack effective means to distinguish between normal UDP service traffic and illegal UDP traffic. This makes it easy to misjudge legitimate UDP services such as games and videos as illegal behavior, resulting in a high false alarm rate.

[0007] Fourth, existing detection technologies can only identify the access behavior itself and cannot link it to DNS resolution logs to trace the server domain information of the access target. This makes it difficult to accurately locate the specific business scenario of the illegal access and cannot provide effective support for subsequent risk assessment and evidence collection.

[0008] Fifth, traditional traffic detection often adopts a serial processing mode that verifies each traffic item one by one, which cannot perform batch aggregation and group screening of massive UDP traffic data. In high-traffic network environments, the detection latency is high and the real-time performance is poor, making it difficult to meet the needs of routine network-wide risk control detection. Summary of the Invention

[0009] The purpose of this invention is to overcome the shortcomings of the prior art and provide a method and device for detecting violations based on UDP protocol traffic characteristics. By performing joint cross-verification based on multi-dimensional features specific to UDP violations, the false negative rate and false positive rate of violation detection are reduced.

[0010] This invention is achieved through the following technical solution:

[0011] The first aspect of this invention discloses a method for detecting violations based on UDP protocol traffic characteristics, comprising:

[0012] Obtain the UDP traffic logs and DNS resolution logs collected by the passive mirror. The UDP traffic logs include the start and end time of each UDP communication session, client IP address, server IP address, communication protocol, port information, number of uplink payload bytes, number of downlink payload bytes, number of uplink data packets, and number of times the client accesses the server. The DNS resolution logs include the mapping between domain names and server IP addresses.

[0013] The first candidate session set is obtained by removing UDP communication sessions that meet any of the conditions in the first condition set from the UDP traffic log. The first condition set includes: the communication duration determined according to the start and end time is less than or equal to a preset duration threshold, the ratio of the number of uplink payload bytes to the number of uplink data packets does not fall within a preset ratio range, and the client IP address does not belong to a domestic network node.

[0014] The UDP communication sessions in the first candidate session set are grouped and aggregated according to the client IP address and the server IP address to obtain at least one session group;

[0015] For each session group, retain the session groups that simultaneously meet all the conditions in the second condition set, and determine the UDP communication sessions corresponding to the retained session groups as suspected illegal sessions. The second condition set includes: the number of communication protocol types is less than or equal to a preset upper limit value for protocol types; the set of communication protocols includes a preset illegal protocol identifier and does not include a preset exclusion protocol identifier; the number of server port types extracted from the port information is equal to 1; the ratio of the downlink payload bytes to the sum of the uplink payload bytes and the downlink payload bytes falls within a preset ratio range; and the number of times the client accesses the server and meets the preset validity conditions is greater than or equal to a preset lower limit value for frequency.

[0016] Extract the server IP address from the suspected illegal session, query the DNS resolution log for domain name records that match the server IP address, aggregate the corresponding domain name information, remove the domain name records containing preset DNS feature strings from the domain name information, and determine the suspected illegal session corresponding to the remaining domain name records after removal as the confirmed illegal session;

[0017] Output the violation record corresponding to the confirmed violation session.

[0018] Furthermore, the UDP traffic log is a netlink_2.udp_flow_log_1s second-level UDP traffic log, and the DNS resolution log is a netlink_2.DnsLog domain name resolution log.

[0019] Furthermore, the preset duration threshold is 10 minutes, and the preset ratio range is [25, 30].

[0020] Furthermore, the upper limit of the preset protocol types is 2;

[0021] The preset violation protocol identifier is Protocol No. 4364;

[0022] The preset exclusion protocol is identified as protocol number 803;

[0023] The preset ratio range is [0.4, 0.6];

[0024] The preset frequency lower limit is 3 times;

[0025] The preset validity condition is that the UDP communication session corresponding to the number of times the client accesses the server belongs to the first candidate session set.

[0026] Furthermore, the preset DNS feature string is dns.

[0027] Furthermore, the first set of conditions also includes:

[0028] The value of the event mask field is not zero;

[0029] The value of the client's country identifier field is not a domestic identifier value.

[0030] Furthermore, the violation record includes the client IP address, the server IP address, a set of communication protocols, the target domain name accessed in the domain name information, and the start time in the earliest start and end time of the session group.

[0031] A second aspect of the present invention discloses a violation detection device based on UDP protocol traffic characteristics, comprising:

[0032] The data acquisition module is used to acquire the UDP traffic logs and DNS resolution logs collected by the passive mirror. The UDP traffic logs include the start and end time of each UDP communication session, the client IP address, the server IP address, the communication protocol, port information, the number of uplink payload bytes, the number of downlink payload bytes, the number of uplink data packets, and the number of times the client accesses the server. The DNS resolution logs include the mapping between domain names and server IP addresses.

[0033] The basic filtering module is used to remove UDP communication sessions that meet any of the conditions in the first condition set from the UDP traffic log to obtain a first candidate session set. The first condition set includes: the communication duration determined according to the start and end time is less than or equal to a preset duration threshold, the ratio of the number of uplink payload bytes to the number of uplink data packets does not fall within a preset ratio range, and the client IP address does not belong to a domestic network node.

[0034] The session grouping module is used to group and aggregate each UDP communication session in the first candidate session set according to the client IP address and the server IP address to obtain at least one session group.

[0035] A multi-dimensional verification module is used to retain session groups that simultaneously meet all conditions in the second condition set for each session group, and to identify the UDP communication session corresponding to the retained session group as a suspected violation session. The second condition set includes: the number of communication protocol types is less than or equal to a preset upper limit value for protocol types; the set of communication protocols includes a preset violation protocol identifier and does not include a preset exclusion protocol identifier; the number of server port types extracted from the port information is equal to 1; the ratio of the downlink payload bytes to the sum of the uplink payload bytes and the downlink payload bytes falls within a preset ratio range; and the number of client accesses to the server that meet the preset validity conditions is greater than or equal to a preset lower limit value for frequency.

[0036] The DNS tracing and matching module is used to extract the server IP address in the suspected illegal session, query the DNS resolution log for domain name records that match the server IP address, aggregate the corresponding domain name information, remove the domain name records containing preset DNS feature strings from the domain name information, and determine the suspected illegal session corresponding to the remaining domain name records after removal as the confirmed illegal session.

[0037] The result output module is used to output the violation record corresponding to the confirmed violation session.

[0038] Furthermore, the preset duration threshold is 10 minutes;

[0039] The preset ratio range is [25, 30];

[0040] The maximum number of preset protocol types is 2;

[0041] The preset violation protocol identifier is Protocol No. 4364;

[0042] The preset exclusion protocol is identified as protocol number 803;

[0043] The preset ratio range is [0.4, 0.6];

[0044] The preset frequency lower limit is 3 times;

[0045] The preset validity condition is: the UDP communication session corresponding to the number of times the client accesses the server belongs to the first candidate session set;

[0046] The preset DNS feature string is dns.

[0047] Furthermore, the first set of conditions also includes:

[0048] The value of the event mask field is not zero;

[0049] The value of the client's country identifier field is not a domestic identifier value.

[0050] Compared with the prior art, the present invention has the following advantages and beneficial effects:

[0051] (1) This invention abandons the traditional detection mode that relies solely on IP and domain name matching, and combines multi-dimensional features specific to UDP violations for joint cross-verification. In the basic screening, normal UDP traffic with short bursts of interaction is eliminated by communication duration conditions, and stable long-connection sessions with tunnel proxy characteristics are screened; the exclusive message payload features of encrypted UDP tunnels are matched by the ratio of uplink payload bytes to uplink data packets. In the multi-dimensional feature verification, the protocol stack flattening feature of the violation tunnel is identified by verifying the number of communication protocol types; precise filtering at the protocol level is achieved by verifying the exclusive protocol identifier and excluding protocol identifiers; the behavior pattern of fixed single-port communication of the violation tunnel is matched by verifying the uniqueness of the server port; the traffic characteristics of symmetrical uplink and downlink transmission of the violation tunnel are characterized by verifying the proportion of server load to total load; and accidental abnormal traffic is filtered by verifying the effective access frequency. The above dimensions characterize UDP violations from different angles, are independent of each other and mutually corroborative. Accidental matching of a single dimension will not lead to misjudgment, and can accurately distinguish between normal UDP business traffic and hidden UDP violation traffic, reducing the false negative rate and false positive rate of violation detection.

[0052] (2) This invention is specifically designed to detect UDP violations in encrypted tunnels. The features constructed, such as communication duration filtering, load to packet ratio filtering, port uniqueness verification, and load ratio verification, are all oriented towards the inherent behavioral patterns of UDP violation tunnels. Unlike the existing technology that relies on TCP handshake features and first packet load analysis, this invention can effectively identify UDP violation access that traditional TCP detection methods cannot capture.

[0053] (3) This invention uses SQL batch aggregation grouping operation to group and aggregate massive UDP traffic logs according to client IP address and server IP address, and performs multi-dimensional feature verification with session group as unit, replacing the traditional serial processing mode of verifying each traffic item one by one. It can achieve efficient batch screening in high-traffic network environment and meet the normalized real-time risk control detection needs of the whole network.

[0054] (4) Based on traffic behavior detection, this invention correlates and matches the server IP addresses in suspected illegal sessions identified by multi-dimensional feature verification with DNS resolution logs to aggregate the corresponding domain name information. Furthermore, by removing domain name records containing preset DNS feature strings, interference from DNS service infrastructure traffic is eliminated, thus achieving a complete closed loop from traffic behavior identification to domain name tracing and verification. Unlike existing technologies that can only determine the existence of abnormal access, this invention can accurately locate the specific service and business scenario of illegal access, supporting the tracing, evidence collection, and subsequent rectification and control of illegal behavior.

[0055] (5) The present invention is based on the UDP traffic logs and DNS resolution logs collected by passive mirroring to carry out data analysis. It does not need to send probe messages to the network, does not occupy network bandwidth, does not affect the normal operation of network services, and is suitable for various network scenarios with high requirements for network stability and security.

[0056] (6) The present invention uses explicit rules to implement all detection logic. The core screening parameters in the model, such as communication duration threshold, load ratio range, protocol identifier set, load ratio range and access frequency lower limit, can be dynamically adjusted according to the new UDP violation methods. There is no need to retrain the model. It can adapt to the continuously iterative network violation access methods and ensure the effectiveness of detection in the long term. Attached Figure Description

[0057] The accompanying drawings, which are included to provide a further understanding of embodiments of the invention and form part of this application, do not constitute a limitation thereof. In the drawings:

[0058] Figure 1 This is a flowchart of a violation detection method in this invention;

[0059] Figure 2This is a block diagram of one component of the violation detection device in this invention. Detailed Implementation

[0060] The technical solution of the present invention will be further described below with reference to the accompanying drawings and specific embodiments.

[0061] The accompanying drawings are for illustrative purposes only and are schematic diagrams, not actual pictures. They should not be construed as limiting the invention. To better illustrate the embodiments of the invention, some parts in the drawings may be omitted, enlarged, or reduced, and do not represent the actual product dimensions. It is understandable to those skilled in the art that some well-known structures and their descriptions may be omitted in the drawings.

[0062] In the accompanying drawings of the embodiments of the present invention, the same or similar reference numerals correspond to the same or similar components. In the description of the present invention, it should be understood that if terms such as "upper," "lower," "left," "right," "inner," and "outer" indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings, they are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, the terms used to describe positional relationships in the accompanying drawings are only for illustrative purposes and should not be construed as limiting the present invention. For those skilled in the art, the specific meaning of the above terms can be understood according to the specific circumstances.

[0063] In the description of this invention, unless otherwise explicitly specified and limited, the term "connection" or similar designation indicating a connection between components should be interpreted broadly. For example, it can refer to a fixed connection, a detachable connection, or an integral part; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium; it can refer to the internal communication between two components or the interaction between two components. Those skilled in the art can understand the specific meaning of the above terms in this invention based on the specific circumstances.

[0064] like Figures 1 to 2 As shown in the figure, this embodiment discloses a method and apparatus for detecting violations based on UDP protocol traffic characteristics.

[0065] The first aspect of this embodiment discloses a method for detecting violations based on UDP protocol traffic characteristics, such as... Figure 1 As shown, the violation detection method includes steps S100 to S600.

[0066] Step S100. Obtain the UDP traffic logs and DNS resolution logs collected by the passive mirror. The UDP traffic logs include the start and end time of each UDP communication session, client IP address, server IP address, communication protocol, port information, number of uplink payload bytes, number of downlink payload bytes, number of uplink data packets, and number of times the client accesses the server. The DNS resolution logs include the resolution correspondence between domain names and server IP addresses.

[0067] The traffic splitting device at the network egress mirrors and copies the entire network traffic to the packet capture engine. The packet capture engine then splits the mirrored traffic according to protocol type, extracts communication packets with a protocol field value of UDP, and aggregates them at the second-level granularity to generate UDP traffic logs. Simultaneously, DNS resolution logs are collected from the DNS recursive resolver or DNS traffic mirror at the network egress. The entire collection process is passive mirroring collection, without injecting any probe packets into the network.

[0068] The start and end times include the start timestamp (flow_start_time) and end timestamp (flow_end_time) of the UDP communication session, used to determine the communication duration. The port information includes the source port and destination port of the UDP communication session; the destination port will be extracted from the port information as the server port in subsequent steps. The uplink payload byte count refers to the total number of payload bytes transmitted from the client to the server, and the downlink payload byte count refers to the total number of payload bytes transmitted from the server to the client. The uplink data packet count refers to the number of data packets sent from the client to the server. The number of client accesses to the server refers to the number of independent UDP communication sessions initiated by the client to the server within the statistics window.

[0069] The DNS resolution log includes the resolution time, domain name, and answer IP address, where the answer IP address is the server IP address obtained from the domain name resolution.

[0070] In some implementations of this embodiment, the UDP traffic log is a netlink_2.udp_flow_log_1s second-level UDP traffic log, and the DNS resolution log is a netlink_2.DnsLog domain name resolution log.

[0071] netlink_2 serves as the data warehouse layer for the network traffic analysis platform. The udp_flow_log_1s table records traffic statistics for each UDP communication session with second-level precision, while the DnsLog table records the mapping between the domain name and the responding IP address for each DNS resolution request. This embodiment utilizes existing log tables from the existing data infrastructure, eliminating the need for additional dedicated data collection probes and reducing implementation costs.

[0072] Step S200. Remove UDP communication sessions that meet any of the conditions in the first condition set from the UDP traffic log to obtain a first candidate session set, wherein the first condition set includes: the communication duration determined according to the start and end time is less than or equal to a preset duration threshold, the ratio of the number of uplink payload bytes to the number of uplink data packets does not fall within a preset ratio range, and the client IP address does not belong to a domestic network node.

[0073] Normal UDP external network access traffic (such as DNS queries, NTP time synchronization, UDP communication in online games, and VoIP voice calls) exhibits statistical characteristics significantly different from those of UDP illegal tunnel traffic in terms of communication duration, payload distribution patterns, and access direction. To maintain the stability and transmission efficiency of proxy connections, UDP illegal tunnels typically exhibit characteristics such as long-term continuous connections and relatively uniform payload filling. This embodiment uses three basic filtering criteria—communication duration, payload distribution, and access direction—to quickly eliminate UDP traffic that does not meet the characteristics of UDP illegal behavior, significantly reducing the number of sessions that need to be processed in subsequent steps. Specifically, the communication duration criterion is used to eliminate short-connection UDP communication; the ratio of uplink payload bytes to uplink data packets is used to match the unique payload transmission characteristics of UDP illegal tunnels; and the client IP address criterion is used to lock out UDP communication from domestic terminals, retaining only UDP communication sessions where the client is located within China.

[0074] In some embodiments of this example, the preset duration threshold is 10 minutes, and the preset ratio range is [25, 30].

[0075] In some implementations of this embodiment, the first set of conditions further includes: the value of the event mask field is not zero; the value of the client country identifier field is not a domestic identifier value.

[0076] The event mask field is the status flag field in the UDP traffic log. A value of zero in the event mask field indicates that the communication session was a valid communication event that was completed normally. The client country identifier field is the country code obtained by querying the GeoIP database based on the client's IP address. A value of 'domestic' in the client country identifier field indicates that the client's IP address is located within China.

[0077] Step S300. Group and aggregate each UDP communication session in the first candidate session set according to the client IP address and the server IP address to obtain at least one session group.

[0078] There may be multiple UDP communication session records between the same client IP address and the same server IP address within the statistics window. Sessions belonging to the same client and server pair are grouped into a session group by grouping and aggregation. Each session group represents the set of all UDP communication activities between a client and server pair within the statistics window.

[0079] Step S400. For each session group, retain the session groups that simultaneously meet all the conditions in the second condition set, and determine the UDP communication sessions corresponding to the retained session groups as suspected illegal sessions. The second condition set includes: the number of communication protocol types is less than or equal to a preset upper limit value for protocol types; the set of communication protocols includes a preset illegal protocol identifier and does not include a preset exclusion protocol identifier; the number of server port types extracted from the port information is equal to 1; the ratio of the downlink payload bytes to the sum of the uplink payload bytes and the downlink payload bytes falls within a preset ratio range; and the number of client accesses to the server that meet the preset validity conditions is greater than or equal to a preset lower limit value for frequency.

[0080] This embodiment uses parallel cross-validation of five independent feature dimensions to evaluate each session group from multiple perspectives. Only when the conditions of all five dimensions are met simultaneously is the session group judged as a suspected violation session.

[0081] The criteria for the types and quantities of communication protocols are used to identify the protocol stack flattening characteristics of UDP illegal tunnels; the inclusion judgment of the communication protocol set is used to achieve precise filtering at the protocol level, where the preset illegal protocol identifier is the protocol number that has a mapping relationship with known UDP illegal tools, and the preset excluded protocol identifier is the protocol number associated with regular network services; the criteria for the types and quantities of server ports are used to match the fixed port transmission characteristics of UDP illegal tunnels; the load ratio condition is used to characterize the uplink and downlink symmetrical transmission characteristics of UDP illegal tunnels; and the access count condition is used to filter out occasional single or small number of abnormal communications.

[0082] The preset validity conditions limit the range of access counts to be included in the statistics. Only access counts in sessions that have passed the basic screening in step S200 are included in the valid access count.

[0083] In some implementations of this embodiment, the upper limit of the preset protocol type is 2; the preset violation protocol identifier is protocol number 4364; the preset exclusion protocol identifier is protocol number 803; the preset ratio range is [0.4, 0.6]; the preset frequency lower limit is 3 times; and the preset validity condition is: the UDP communication session corresponding to the number of times the client accesses the server belongs to the first candidate session set.

[0084] Step S500. Extract the server IP address from the suspected illegal session, query the DNS resolution log for domain name records that match the server IP address, aggregate the corresponding domain name information, remove the domain name records containing preset DNS feature strings from the domain name information, and determine the suspected illegal session corresponding to the remaining domain name records after removal as the confirmed illegal session.

[0085] This embodiment correlates and matches the server IP addresses in suspected illegal sessions identified through multi-dimensional feature verification in step S400 with DNS resolution logs. It queries the corresponding domain name records using the server IP address and aggregates these records by server IP address to obtain domain name information. Each domain name in the domain name information is then checked, and records containing preset DNS feature strings are removed to eliminate interference from DNS service infrastructure traffic.

[0086] In some embodiments of this example, the preset DNS feature string is "dns.", which means that domain name records that begin with "dns." are removed.

[0087] Step S600. Output the violation record corresponding to the confirmed violation session.

[0088] In some implementations of this embodiment, the violation record includes the client IP address, the server IP address, a set of communication protocols, the target domain name accessed in the domain name information, and the start time in the earliest start and end time of the session group.

[0089] The start time in the earliest start and end time within a session packet is the result of the aggregation function min(flow_start_time), representing the start time of the first UDP communication record within that session packet, which serves as the start time of the unauthorized access behavior.

[0090] In some implementations of this embodiment, violation records are displayed visually.

[0091] For example, the violation records can be displayed in tabular form through a visual interface. The visual interface marks the IP address of the violating client, the IP address of the overseas server, the set of communication protocols, and the target domain name accessed for each violation record, which facilitates security operation and maintenance personnel to quickly conduct risk verification, violation tracing, and blocking.

[0092] Based on the method of this embodiment, a complete and implementable core SQL algorithm model can be constructed to fully implement the above detection rules. The core algorithm statements are as follows:

[0093] SQL

[0094] with result_ as (

[0096] select min(flow_start_time) as start_time,client_ip,server_ip,groupUniqArray(protocol) as protocols from netlink_2.udp_flow_log_1s ufls

[0097] where flow_start_time >= toUnixTimestamp('2025-11-01 00:00:00')

[0098] and event_mask = 0

[0099] and flow_end_time - flow_start_time > 60*10

[0100] and client_payload_byte / client_packet >= 25

[0101] and client_payload_byte / client_packet <= 30

[0102] and client_country_id = 0

[0103] group by client_ip,server_ip

[0104] having uniq(protocol) <= 2

[0105] and not hasAny(groupUniqArray(protocol),

[803] )

[0106] and hasAny(groupUniqArray(protocol),

[4364] )

[0107] and uniq(server_port) = 1

[0108] and sum(server_payload_byte) / sum(total_payload_byte) > 0.4

[0109] and sum(server_payload_byte) / sum(total_payload_byte) < 0.6

[0110] and count() >= 3 )

[0112] select start_time,client_ip,server_ip,protocols,server_info from

[0113] result_ as a

[0114] left join (

[0116] select answerIp,groupUniqArray(5)(domain) as server_info from (

[0118] select answerIp,`domain` from netlink_2.DnsLog dl

[0119] where time >= toUnixTimestamp('2025-11-05 00:00:00')

[0120] and answerIp in (select server_ip from result_) )

[0122] group by answerIp

[0123] ) as b

[0124] on a.server_ip == b.answerIp

[0125] where not match(toString(server_info),'dns\.')。

[0126] The correspondence between the field names and their Chinese descriptions in the above SQL statement is as follows: `flow_start_time` is the start timestamp of the UDP communication session, `flow_end_time` is the end timestamp of the UDP communication session, `client_ip` is the client IP address, `server_ip` is the server IP address, `protocol` is the communication protocol, `event_mask` is the event mask field, `client_payload_byte` is the number of uplink payload bytes, `client_packet` is the number of uplink data packets, `client_country_id` is the client country identifier field, `server_port` is the server port, `server_payload_byte` is the number of downlink payload bytes, `total_payload_byte` is the sum of the uplink and downlink payload bytes, `answerIp` is the IP address for the resolved response, and `domain` is the domain name. The date string passed to the `toUnixTimestamp` function is an example value; it can be configured according to the actual time range being detected.

[0127] The second aspect of this embodiment discloses a violation detection device based on UDP protocol traffic characteristics, such as... Figure 2 As shown, the violation detection device includes a data acquisition module, a basic screening module, a session grouping module, a multi-dimensional verification module, a DNS tracing and matching module, and a result output module.

[0128] The data acquisition module is used to acquire the UDP traffic logs and DNS resolution logs collected by the passive mirror. The UDP traffic logs include the start and end time of each UDP communication session, the client IP address, the server IP address, the communication protocol, port information, the number of uplink payload bytes, the number of downlink payload bytes, the number of uplink data packets, and the number of times the client accesses the server. The DNS resolution logs include the mapping between domain names and server IP addresses.

[0129] The basic filtering module is used to remove UDP communication sessions that meet any of the conditions in the first condition set from the UDP traffic log to obtain a first candidate session set. The first condition set includes: the communication duration determined according to the start and end time is less than or equal to a preset duration threshold, the ratio of the number of uplink payload bytes to the number of uplink data packets does not fall within a preset ratio range, and the client IP address does not belong to a domestic network node.

[0130] In some implementations of this embodiment, the first set of conditions further includes: the value of the event mask field is not zero; the value of the client country identifier field is not a domestic identifier value.

[0131] The session grouping module is used to group and aggregate each UDP communication session in the first candidate session set according to the client IP address and the server IP address to obtain at least one session group.

[0132] The multi-dimensional verification module is used to retain session groups that simultaneously meet all conditions in the second condition set for each session group, and to identify the UDP communication session corresponding to the retained session group as a suspected violation session. The second condition set includes: the number of communication protocol types is less than or equal to a preset upper limit value for protocol types; the set of communication protocols includes a preset violation protocol identifier but does not include a preset exclusion protocol identifier; the number of server port types extracted from the port information is equal to 1; the ratio of the downlink payload bytes to the sum of the uplink payload bytes and the downlink payload bytes falls within a preset ratio range; and the number of client accesses to the server that meet the preset validity conditions is greater than or equal to a preset lower limit value for frequency.

[0133] The DNS source tracing and matching module is used to extract the server IP address in the suspected illegal session, query the DNS resolution log for domain name records that match the server IP address, aggregate the corresponding domain name information, remove the domain name records containing preset DNS feature strings from the domain name information, and determine the suspected illegal session corresponding to the remaining domain name records after removal as the confirmed illegal session.

[0134] The result output module is used to output the violation record corresponding to the confirmed violation session.

[0135] The violation record includes the client IP address, server IP address, a set of communication protocols, the target domain name accessed in the domain name information, and the start time in the earliest start and end time of the session group.

[0136] In some implementations of this embodiment, the preset duration threshold is 10 minutes; the preset ratio range is [25, 30]; the preset upper limit of protocol types is 2; the preset violation protocol identifier is protocol number 4364; the preset exclusion protocol identifier is protocol number 803; the preset matching range is [0.4, 0.6]; the preset lower limit of frequency is 3 times; the preset validity condition is: the UDP communication session corresponding to the number of times the client accesses the server belongs to the first candidate session set; and the preset DNS feature string is dns.

[0137] The specific embodiments described above further illustrate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above description is only a specific embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. A method for detecting violation of UDP protocol traffic characteristics, characterized in that, include: Obtain the UDP traffic logs and DNS resolution logs collected by the passive mirror. The UDP traffic logs include the start and end time of each UDP communication session, client IP address, server IP address, communication protocol, port information, number of uplink payload bytes, number of downlink payload bytes, number of uplink data packets, and number of times the client accesses the server. The DNS resolution logs include the mapping between domain names and server IP addresses. The first candidate session set is obtained by removing UDP communication sessions that meet any of the conditions in the first condition set from the UDP traffic log. The first condition set includes: the communication duration determined according to the start and end time is less than or equal to a preset duration threshold, the ratio of the number of uplink payload bytes to the number of uplink data packets does not fall within a preset ratio range, and the client IP address does not belong to a domestic network node. The UDP communication sessions in the first candidate session set are grouped and aggregated according to the client IP address and the server IP address to obtain at least one session group; For each session group, retain the session groups that simultaneously meet all the conditions in the second condition set, and determine the UDP communication sessions corresponding to the retained session groups as suspected illegal sessions. The second condition set includes: the number of communication protocol types is less than or equal to a preset upper limit value for protocol types; the set of communication protocols includes a preset illegal protocol identifier and does not include a preset exclusion protocol identifier; the number of server port types extracted from the port information is equal to 1; the ratio of the downlink payload bytes to the sum of the uplink payload bytes and the downlink payload bytes falls within a preset ratio range; and the number of times the client accesses the server and meets the preset validity conditions is greater than or equal to a preset lower limit value for frequency. Extract the server IP address from the suspected illegal session, query the DNS resolution log for domain name records that match the server IP address, aggregate the corresponding domain name information, remove the domain name records containing preset DNS feature strings from the domain name information, and determine the suspected illegal session corresponding to the remaining domain name records after removal as the confirmed illegal session; Output the violation record corresponding to the confirmed violation session. 2.The method of claim 1, wherein, The UDP traffic log is a 1-second UDP traffic log named netlink_2.udp_flow_log_1, and the DNS resolution log is a domain name resolution log named netlink_2.DnsLog. 3.The method of claim 1, wherein, The preset duration threshold is 10 minutes, and the preset ratio range is [25, 30].

4. The method of claim 1, wherein the method further comprises: The maximum number of preset protocol types is 2; The preset violation protocol identifier is Protocol No. 4364; The preset exclusion protocol is identified as protocol number 803; The preset ratio range is [0.4, 0.6]; The preset frequency lower limit is 3 times; The preset validity condition is that the UDP communication session corresponding to the number of times the client accesses the server belongs to the first candidate session set.

5. The method of claim 1, wherein the method further comprises: The preset DNS feature string is dns.

6. The method of claim 1, wherein the method further comprises: The first set of conditions also includes: The value of the event mask field is not zero; The value of the client's country identifier field is not a domestic identifier value.

7. The method of claim 1, wherein the method further comprises: The violation record includes the client IP address, server IP address, a set of communication protocols, the target domain name accessed in the domain name information, and the start time in the earliest start and end time of the session group.

8. An apparatus for detecting violation of traffic characteristics based on UDP protocol, characterized by comprising: include: The data acquisition module is used to acquire the UDP traffic logs and DNS resolution logs collected by the passive mirror. The UDP traffic logs include the start and end time of each UDP communication session, the client IP address, the server IP address, the communication protocol, port information, the number of uplink payload bytes, the number of downlink payload bytes, the number of uplink data packets, and the number of times the client accesses the server. The DNS resolution logs include the mapping between domain names and server IP addresses. The basic filtering module is used to remove UDP communication sessions that meet any of the conditions in the first condition set from the UDP traffic log to obtain a first candidate session set. The first condition set includes: the communication duration determined according to the start and end time is less than or equal to a preset duration threshold, the ratio of the number of uplink payload bytes to the number of uplink data packets does not fall within a preset ratio range, and the client IP address does not belong to a domestic network node. The session grouping module is used to group and aggregate each UDP communication session in the first candidate session set according to the client IP address and the server IP address to obtain at least one session group. A multi-dimensional verification module is used to retain session groups that simultaneously meet all conditions in the second condition set for each session group, and to identify the UDP communication session corresponding to the retained session group as a suspected violation session. The second condition set includes: the number of communication protocol types is less than or equal to a preset upper limit value for protocol types; the set of communication protocols includes a preset violation protocol identifier and does not include a preset exclusion protocol identifier; the number of server port types extracted from the port information is equal to 1; the ratio of the downlink payload bytes to the sum of the uplink payload bytes and the downlink payload bytes falls within a preset ratio range; and the number of client accesses to the server that meet the preset validity conditions is greater than or equal to a preset lower limit value for frequency. The DNS tracing and matching module is used to extract the server IP address in the suspected illegal session, query the DNS resolution log for domain name records that match the server IP address, aggregate the corresponding domain name information, remove the domain name records containing preset DNS feature strings from the domain name information, and determine the suspected illegal session corresponding to the remaining domain name records after removal as the confirmed illegal session. The result output module is used to output the violation record corresponding to the confirmed violation session.

9. The device for detecting violation of UDP protocol traffic characteristics according to claim 8, characterized in that, The preset duration threshold is 10 minutes; The preset ratio range is [25, 30]; The maximum number of preset protocol types is 2; The preset violation protocol identifier is Protocol No. 4364; The preset exclusion protocol is identified as protocol number 803; The preset ratio range is [0.4, 0.6]; The preset frequency lower limit is 3 times; The preset validity condition is: the UDP communication session corresponding to the number of times the client accesses the server belongs to the first candidate session set; The preset DNS feature string is dns.

10. The device for detecting violation of UDP protocol traffic characteristics according to claim 8, characterized in that, The first set of conditions also includes: The value of the event mask field is not zero; The value of the client's country identifier field is not a domestic identifier value.

Citation Information

Patent Citations

  • High-efficiency P2P application flow classification method and classification system

    CN105763479A

  • Controlled activation of performance monitoring component of network protocol

    US10855813B1