DNS server intelligent protection system

By using a DNS server intelligent protection system, which dynamically adjusts the protection threshold and hash bit width, the system solves the problems of hardware resource congestion and statistical data distortion in DNS protection systems under abnormal traffic, and achieves stable protection and rapid response in high-concurrency environments.

CN123184876APending Publication Date: 2026-11-27ERANET INT LTD GUANGZHOU BRANCH
View PDF 0 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

When faced with abnormal traffic, existing DNS protection systems suffer from fixed defense strategies that lead to the loss of legitimate requests, hardware resource congestion, and distortion of front-end statistical data, while the underlying hardware is unable to dynamically adjust resource allocation.

Method used

A DNS server intelligent protection system is adopted. The control module calculates the global anomaly index and bit width reduction. Combined with the resolution pre-detection module, sampling control module and comprehensive anomaly calculation module, the protection threshold and hash bit width are dynamically adjusted to ensure that the cardinality estimation structure has an untrunculated sample source. The floating-point operation is transferred to the control plane for offline processing through the table lookup execution module.

Benefits of technology

Under high-concurrency attacks, the protection threshold and hash bit width are dynamically adjusted to reduce hardware processing bottlenecks, ensure that statistical data accurately reflects the intensity of network traffic attacks, and improve line-speed processing capabilities and the stability of defense strategies.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123184876A_ABST
    Figure CN123184876A_ABST
Patent Text Reader

Abstract

The application relates to the technical field of network security, and discloses a DNS server intelligent protection system, which comprises a control module, an analysis pre-checking module, a sampling control module, a comprehensive abnormality calculation module and a table lookup execution module. The control module calculates a global dynamic protection threshold and a bit width reduction amount; the analysis pre-checking module extracts a statistical domain name key and calculates a false positive rate; the sampling control module performs hash sampling judgment and dynamically adjusts the addressing bit width of a radix estimation structure according to the bit width reduction amount; the comprehensive abnormality calculation module generates a final comprehensive abnormality in combination with an unobserved request amount compensation value; and the table lookup execution module performs fixed-point quantization splicing on the above parameters to generate an address index of a lookup table, directly reads a corresponding discarding probability, and performs discarding judgment on a message. The application realizes dynamic linkage adjustment of a defense strategy and hardware resources, corrects a statistical distortion problem caused by a message discarding action, and relieves hardware processing congestion in a high-concurrency scene.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of network security technology, specifically to an intelligent protection system for DNS servers. Background Technology

[0002] The Domain Name System (DNS) is the infrastructure of the Internet. With the increasing scale of network traffic, DNS servers often face high-concurrency surges of abnormal traffic. Existing DNS protection mechanisms mostly employ static rate limiting or fixed threshold filtering schemes. When abnormal traffic increases, fixed rate limiting strategies cannot accurately distinguish between normal and malicious requests, easily leading to the dropping of legitimate users' resolution requests. To improve identification accuracy, some systems have introduced defense mechanisms based on full packet state tracking and precise matching. However, in high-concurrency request scenarios, maintaining the full packet state consumes a large amount of the underlying hardware's static random access memory (SRAM), causing memory access bandwidth bottlenecks, data plane processing congestion, and difficulty meeting the line-speed forwarding requirements of network devices.

[0003] Furthermore, conventional dynamic defense systems disrupt the integrity of front-end data plane traffic statistics after executing packet dropping actions. Subsequent cardinality estimation and anomaly calculations suffer from statistical bias due to missing sample sources, causing the system-generated defense strategies to deviate from the true traffic situation.

[0004] Meanwhile, the cardinality estimation structure and lookup table parameters in existing hardware protection devices are mostly statically configured. When faced with environments where traffic volume and attack characteristics change, they cannot dynamically adjust the addressing bit width and resource allocation of the underlying hardware. Furthermore, performing complex floating-point probability calculations directly on the data plane will further increase the system's processing latency. Summary of the Invention

[0005] To address the shortcomings of existing technologies, this invention provides an intelligent DNS server protection system, which solves the problems of existing DNS protection systems when facing abnormal traffic, such as the loss of legitimate requests due to fixed defense strategies, hardware resource congestion caused by precise matching, distortion of front-end statistical data caused by protection actions, and the inability of underlying hardware to dynamically adjust resource allocation.

[0006] To achieve the above objectives, the present invention provides the following technical solution: a DNS server intelligent protection system, comprising: The control module is used to acquire status statistics information and identify abnormal statistical domain name keys, update the global abnormality index based on the local comprehensive abnormality of the abnormal statistical domain name keys, and calculate the global dynamic protection threshold and bit width reduction amount based on the global abnormality index and send them to the data plane. The DNS pre-detection module receives DNS request messages, extracts statistical domain name keys, outputs resolution validity flags and domain name structure anomaly flags, and determines the sampling matching probability of the second-level exact match table based on the hit status of the first-level Bloom filter, and calculates the false positive rate based on the matching results of the second-level exact match table. The sampling control module is used to perform deterministic hash sampling judgment on DNS request packets based on the measured suppression probability. For DNS request packets that meet the sampling conditions, the addressing bit width of the probability cardinality estimation structure is adjusted according to the bit width reduction amount to generate the register bucket index. The sampling records are written into the cardinality estimation structure of normal structure samples or the cardinality estimation structure of abnormal structure samples according to the domain name structure anomaly marker. The comprehensive anomaly calculation module is used to merge the cardinality estimation structures of normal samples and abnormal samples to obtain an independent cardinality when the measurement time window expires; and to generate the final comprehensive anomaly based on the independent cardinality, request volume statistics, unobserved request volume compensation values, and the resolution failure ratio in the backend DNS resolution response. The lookup execution module is used to generate the address index of the static random access memory lookup table based on the false positive rate, the global dynamic protection threshold, and the final comprehensive anomaly degree. It reads the corresponding packet drop probability based on the address index to perform packet drop determination on the DNS request packet, and updates the measurement suppression probability for the next measurement period based on the packet drop probability of the current measurement period.

[0007] Furthermore, the control module extracts the abnormal traffic feature vectors corresponding to the abnormal statistical domain name keys and calculates the abnormal feature similarity between different abnormal statistical domain name keys. Based on the abnormal feature similarity and the corresponding local comprehensive anomaly degree, the global anomaly degree index is updated. When the global anomaly degree index exceeds the system's preset global normal baseline, the control module reduces the system's preset static baseline threshold by multiplying the difference between the two by a preset threshold adjustment coefficient to obtain the global dynamic protection threshold. The control module then rounds down the product of the above difference and a preset bit-width reduction coefficient to obtain the bit-width reduction amount, limiting the bit-width reduction to a range that ensures the dynamic addressing bit-width of the probability base estimation structure is not lower than the hardware's preset minimum addressing bit-width. This mechanism increases the packet drop probability by lowering the threshold when the global anomaly degree increases and actively reduces the hash bit-width to reduce the lookup load on the underlying hardware.

[0008] Furthermore, the parsing pre-detection module statistically analyzes the hit rate of the first-level Bloom filter corresponding to each statistical domain name key within the current measurement period. Based on the first-level Bloom filter hit rate, it performs linear interpolation between the upper and lower limits of a preset measurement time window to calculate the dynamic measurement time window for the corresponding statistical domain name key. When a DNS request packet hits the first-level Bloom filter, and the domain name structure anomaly marker indicates structural anomaly, the corresponding confidence penalty value is increased. Based on the confidence penalty value, the sampling matching probability of the second-level exact match table, limited to the maximum sampling matching probability, is calculated in a forward direction. This method can dynamically adjust the statistical period based on traffic characteristics and limit the query load of abnormal traffic on the second-level exact match hardware structure.

[0009] Furthermore, the sampling control module extracts the addressing field from the structure update hash value generated by the deterministic hash sampling decision, and performs a logical right shift operation on the addressing field according to the bit width reduction. It then obtains the dynamic addressing bit width by subtracting the bit width reduction from the baseline addressing bit width, generates a bitmask with the lower bits continuously set to 1 based on the dynamic addressing bit width, and performs a bitwise AND operation between the logically right-shifted addressing field and the bitmask to generate a register bucket index. The sampling control module generates sampling records before the table lookup execution module performs the final packet discard decision, and these generated sampling records are retained independently of the subsequent packet discard results. This processing flow decouples the sampling decision from the packet discarding action, ensuring that the underlying cardinality estimation process has a complete sample source.

[0010] Furthermore, the comprehensive anomaly calculation module reads the packet drop probability and subsequent observations within the historical measurement period. These observations are either the request quantity observed on the release side or the observations on the backend response side. Using a sliding window compensation accumulator, based on the values ​​of the observations within each historical measurement period, and combined with the ratio of the packet drop probability to the release probability corresponding to the same historical measurement period, a weighted sum is performed to obtain the unobserved request quantity compensation value used to compensate for the number of dropped packets. This calculation logic corrects the statistical base deviation caused by the frontend protection executing drop actions.

[0011] Furthermore, the comprehensive anomaly calculation module performs sampling compensation on the independent cardinality based on the actual measurement sampling rate, obtaining the independent cardinality of structurally normal and structurally abnormal entities respectively. The module calculates the cardinality anomaly ratio based on the structurally abnormal and structurally normal independent cardinality, and calculates the request volume anomaly ratio based on the compensation values ​​for structurally abnormal request volume, structurally normal request volume, and unobserved request volume. Following a preset weighted fusion rule, the module performs weighted fusion of the cardinality anomaly ratio and the request volume anomaly ratio to generate the front-end comprehensive anomaly score, and then further weights and fuses the front-end comprehensive anomaly score with the resolution failure ratio extracted from the back-end DNS resolution response to generate the final comprehensive anomaly score.

[0012] Furthermore, the lookup execution module calculates the dynamic penalty coefficient based on the false positive rate. It maps the false positive rate, final comprehensive anomaly score, and global dynamic protection threshold to unsigned integer ranges according to their corresponding field widths to complete fixed-point quantization. Following the field concatenation order determined by the lookup table version, it concatenates the high and low bits of each fixed-point quantized field to generate the address index of the static random access memory lookup table. The entries in the static random access memory lookup table are pre-calculated by the control plane through discrete combinations of the three parameters, based on the drop probability mapping rules, and written in unsigned fixed-point form. This design transfers floating-point operations to the control plane for offline execution, allowing the data plane to determine the drop probability solely through fixed-point concatenation lookup, thus improving the execution efficiency of the hardware pipeline.

[0013] Furthermore, the table lookup execution module calculates the average packet drop probability based on the packet drop probability corresponding to each DNS request packet in the current measurement period; it calculates the difference between the average packet drop probability and the measurement suppression probability of the current measurement period, multiplies the difference by the smooth update step size, and adds it to the measurement suppression probability of the current measurement period to perform a first-order smooth update. The update result is clamped and restricted between the preset lower bound and the preset upper bound of the measurement suppression probability, and used as the measurement suppression probability for the next measurement period.

[0014] Furthermore, the DNS pre-detection module and the sampling control module are equipped with an abnormal sampling key rollback mechanism. When the received DNS request message cannot extract the normalized fully qualified domain name, the DNS pre-detection module sets the resolution validity flag to 0; the sampling control module concatenates the original byte sequence of the problem area of ​​the DNS request message, the query type field, the source address field, and the resolution anomaly type identifier in the order of the fields to generate an abnormal sampling key, directly uses the abnormal sampling key to perform deterministic hash sampling judgment and writes it into the structural anomaly sample cardinality estimation structure to prevent malformed request messages from bypassing the system's regular resolution statistics.

[0015] Furthermore, each processing module in the data plane is equipped with a double-buffered configuration area consisting of a first configuration area and a second configuration area. During the current measurement cycle, one configuration area in the double-buffered configuration area stores parameters including the global dynamic protection threshold and bit width reduction, while the other configuration area is used to receive parameter configuration messages for the next measurement cycle. After the current measurement cycle ends, each processing module atomically switches the current configuration area to the other configuration area that has been written, based on the parameter version number and the effective cycle identifier, thereby achieving non-blocking updates of protection parameters across cycles.

[0016] This invention provides an intelligent protection system for DNS servers. It has the following beneficial effects: 1. This invention uses a control module to calculate the global dynamic protection threshold and bit width reduction in real time based on the global anomaly index. The sampling and control module then uses this reduction to perform logical right shift and masking operations on the addressing field, dynamically adjusting the addressing bit width of the cardinality estimation structure. This allows for proactively lowering the protection threshold to enhance interception when the global anomaly situation worsens. Simultaneously, it reduces the hash index bit width, lowering the bandwidth consumption of the underlying static random access memory and memory access, thus alleviating hardware processing bottlenecks under high-concurrency attacks.

[0017] 2. This invention ensures that the cardinality estimation has an untrunculated original sample source by making the sampling record generation process of the sampling control module independent of the discard determination of the table lookup execution module; at the same time, it introduces a compensation value for unobserved requests based on a sliding window in the comprehensive anomaly calculation module, and performs a weighted summation of the observations by combining the ratio of historical discard probability to allow probability, thereby correcting the statistical cardinality distortion caused by front-end packet discarding actions, so that the generated comprehensive anomaly can truly reflect the actual attack intensity of network traffic.

[0018] 3. This invention uses a lookup execution module to perform fixed-point quantization of the false positive rate, final comprehensive anomaly degree, and global dynamic protection threshold, and generates an address index by concatenating fields. It directly reads the drop probability entries pre-calculated and issued by the control plane, which can transfer complex floating-point operations to the control plane for offline processing, shorten the lookup latency of the data plane and improve the line-speed processing capability. In addition, by performing a first-order smooth update and clamping restriction based on the difference on the measurement suppression probability of the next cycle, it can prevent the defense suppression parameters from fluctuating drastically between multiple measurement cycles. Attached Figure Description

[0019] Figure 1 This is a schematic diagram of the system architecture of the present invention; Figure 2 This is a schematic diagram of the method flow of the present invention; Figure 3 This is a schematic diagram of the global scheduling and parameter generation principle of the control plane in this invention; Figure 4 This is a flowchart of the message pre-inspection and multi-mode verification process of the present invention; Figure 5 This is a schematic diagram of the hardware adaptive sampling and probability structure update principle of the present invention; Figure 6 This is a flowchart of the discreteness calculation and situation closed-loop feedback of the present invention; Figure 7 This is a schematic diagram illustrating the decoupling mapping and nanosecond-level execution principle of the present invention. Figure 8 This is a comparison chart of the attack strength and legitimate traffic pass rate of different schemes in this invention; Figure 9This is a schematic diagram illustrating the evolution of the system dynamic response and threshold reflexive control of the present invention. Detailed Implementation

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

[0021] Reference Figure 1 This invention provides an intelligent protection system for DNS servers, which includes a control module, a resolution pre-detection module, a sampling and control module, a comprehensive anomaly calculation module, and a lookup execution module.

[0022] The statistical domain key referred to in this specification is a domain identifier extracted from fully qualified domains according to the domain merging rules and used for merging and statistically analyzing DNS requests within the same domain range. The domain merging rules remain unchanged within the same measurement period.

[0023] The control module is used to acquire the status statistics information reported by local forwarding nodes within the global scheduling cycle, identify abnormal statistical domain name keys, extract the abnormal traffic feature vectors corresponding to the abnormal statistical domain name keys, and calculate the abnormal feature similarity between different abnormal statistical domain name keys; update the global abnormality index based on the abnormal feature similarity and the corresponding local comprehensive abnormality, and calculate the global dynamic protection threshold and bit width reduction based on the updated global abnormality index; and send the global dynamic protection threshold, bit width reduction, parameter version number, and effective period identifier to the data plane.

[0024] The DNS pre-detection module receives DNS request messages, parses and normalizes the fully qualified domain names in the DNS request messages, extracts statistical domain name keys according to the domain name merging rules, and outputs resolution validity flags and domain name structure anomaly flags respectively. It is also used to determine the sampling matching probability of the second-level exact match table based on the hit status of the first-level Bloom filter and the confidence penalty value corresponding to the statistical domain name keys, and calculate the false positive rate based on the number of misses in the second-level exact match table and the number of hits in the sampled first-level Bloom filter.

[0025] The sampling control module is used to determine the actual measurement sampling rate based on the measurement suppression probability, and to perform deterministic hash sampling judgment on DNS request messages with generated sampling keys and corresponding measurement time windows in a valid state; for DNS request messages that meet the sampling conditions, the hash value used for probabilistic cardinality estimation structure addressing is logically right-shifted and bitmasked according to the bit width reduction amount to generate a register bucket index; according to the domain name structure anomaly marker, the sampling records are written into the cardinality estimation structure of normal structure samples or the cardinality estimation structure of abnormal structure samples respectively, and the corresponding sampling request counter is updated.

[0026] When a DNS request message cannot extract a canonical fully qualified domain name, the sampling key is generated from the original byte sequence of the DNS problem zone, the query type field, the source address field, and the resolution exception type identifier.

[0027] The integrated anomaly calculation module is used to merge the structural normal sample base estimation structure and the structural anomaly sample base estimation structure with the same parameter version number, time window salt value and dynamic addressing bit width when the measurement time window expires. Based on the merged base estimation structure, the original estimated base number of structural normal and the original estimated base number of structural anomaly are obtained respectively. Sampling compensation is performed in combination with the actual measurement sampling rate to obtain the independent base number of structural normal and the independent base number of structural anomaly.

[0028] The comprehensive anomaly calculation module is also used to calculate the number of normal and abnormal requests based on the count of normal and abnormal sampling requests, combined with the actual measurement sampling rate; to calculate the compensation value for unobserved requests based on the packet drop probability and the observations after the drop action within the historical measurement period using a sliding window compensation accumulator; to calculate the resolution failure ratio by counting the total number of responses and the preset number of failed responses in the backend DNS resolution responses; and to generate the final comprehensive anomaly score according to the preset weighted fusion rules based on the independent cardinality of normal and abnormal requests, the number of normal and abnormal requests, the compensation value for unobserved requests, and the resolution failure ratio.

[0029] Among them, the structurally normal independent cardinality and the structurally abnormal independent cardinality are used to characterize the quantity dimension of independent fully qualified domain names or abnormal sampled keys; the structurally normal request volume and the structurally abnormal request volume are used to characterize the request volume dimension of DNS request messages.

[0030] The lookup execution module is used to perform fixed-point quantization of the false positive rate, global dynamic protection threshold, and final comprehensive anomaly degree, and generate the address index of the static random access memory lookup table according to the preset field width and splicing order. Based on the address index, the corresponding packet drop probability is read, and a random number is compared with the fixed-point threshold corresponding to the packet drop probability to determine whether to drop the current DNS request packet or continue to forward the current DNS request packet to the backend DNS server.

[0031] The table lookup execution module is also used to perform a first-order smooth update of the measurement suppression probability for the next measurement period based on the message drop probability and measurement suppression probability of the current measurement period, and to limit the update result to between the preset lower bound and the preset upper bound of the measurement suppression probability.

[0032] The entries in the static random access memory lookup table are pre-calculated by the control plane according to the preset discard probability mapping rules for different combinations of quantized false positive rate, final comprehensive anomaly degree and global dynamic protection threshold, and written into the static random access memory in the form of fixed-point numbers.

[0033] Reference Figure 2 This invention provides a method for intelligent protection of DNS servers, which includes the following steps: Step S10: Obtain the status statistics information reported by each local forwarding node within the global scheduling cycle, identify the abnormal statistical domain name key and extract the corresponding abnormal traffic feature vector; calculate the abnormal feature similarity between different abnormal statistical domain name keys based on the abnormal traffic feature vector, and update the global abnormality index based on the abnormal feature similarity and the corresponding local comprehensive abnormality; calculate the global dynamic protection threshold and bit width reduction amount based on the updated global abnormality index, and send the global dynamic protection threshold, bit width reduction amount, parameter version number and effective period identifier to the data plane.

[0034] Step S20: Receive DNS request messages, perform protocol parsing and domain name normalization on the DNS request messages, extract fully qualified domain names, and extract statistical domain name keys according to preset domain name merging rules; generate resolution validity flags and domain name structure anomaly flags based on the protocol parsing results and preset domain name structure rules; determine the sampling matching probability of the secondary exact match table based on the hit status of the primary Bloom filter and the corresponding confidence penalty value; perform secondary exact matching on DNS request messages that meet the sampling matching conditions, and calculate the false positive rate based on the number of misses in the secondary exact match table and the number of hits in the sampled primary Bloom filter.

[0035] Step S30: Before executing the final message discard decision, for DNS request messages with generated sampling keys and corresponding measurement time windows in a valid state, calculate the actual measurement sampling rate based on the measurement suppression probability and perform deterministic hash sampling decision; for DNS request messages that meet the sampling conditions, perform logical right shift and bitmask truncation on the addressing hash value of the probability cardinality estimation structure based on the bit width reduction amount to generate a register bucket index; based on the domain name structure anomaly marker, write the sampling records into the normal structure sample cardinality estimation structure or the abnormal structure sample cardinality estimation structure respectively, and update the corresponding sampling request counter.

[0036] The process of generating sampling records in step S30 is performed before the final packet discard decision and is independent of the subsequent packet discard results; therefore, the generated sampling records are not changed regardless of whether the current DNS request packet is discarded or forwarded in subsequent steps.

[0037] Step S40: After the measurement time window expires, merge the structural normal sample base estimation structure and the structural abnormal sample base estimation structure, which have the same parameter version number, time window salt value and dynamic addressing bit width. Based on the merged base estimation structure, obtain the original estimated base number of structural normal and the original estimated base number of structural abnormal, and perform sampling compensation in combination with the actual measurement sampling rate to obtain the independent base number of structural normal and the independent base number of structural abnormal.

[0038] Based on the count values ​​of normal and abnormal sampling requests, and combined with the actual measurement sampling rate, the number of normal and abnormal requests are calculated respectively. Based on the packet drop probability and observations following drop actions within the historical measurement period, the compensation value for unobserved requests is calculated using a sliding window compensation accumulator. Backend DNS resolution responses are collected, the total number of responses and the number of failed responses are counted, and the resolution failure ratio is calculated. According to the weighted fusion rules, the independent cardinality of normal requests, the independent cardinality of abnormal requests, the number of normal requests, the number of abnormal requests, the compensation value for unobserved requests, and the resolution failure ratio are processed to generate the final comprehensive anomaly score.

[0039] Among them, the independent cardinality of normal structure and the independent cardinality of abnormal structure are estimated by the corresponding probability cardinality estimation structure, and the request quantity of normal structure and the request quantity of abnormal structure are obtained by the corresponding sampling request counter after sampling rate compensation.

[0040] Step S50: Quantize the false positive rate, global dynamic protection threshold, and final comprehensive anomaly degree at fixed points, and generate the address index of the static random access memory lookup table according to the preset field width and splicing order; read the corresponding packet drop probability according to the address index, generate a comparison threshold with the same fixed-point number range as the packet drop probability, and compare the comparison threshold with the random number corresponding to the current DNS request packet; discard the current DNS request packet according to the comparison result, or continue to forward the current DNS request packet to the backend DNS server.

[0041] Based on the message drop probability and measurement suppression probability of the current measurement period, the measurement suppression probability of the next measurement period is updated using a first-order smoothing method, and the update result is restricted to the lower bound of the measurement suppression probability and the upper bound of the preset measurement suppression probability.

[0042] To further clarify the implementation of each technical aspect of the present invention, the following will provide a detailed description of the implementation of each functional module involved above and its internal processing flow.

[0043] Reference Figure 3 The control module executes step S10, which is used to summarize the status statistics of each local forwarding node, generate global control parameters based on the consistency of abnormal traffic characteristics between different nodes, and send the global control parameters to the data plane.

[0044] In this embodiment, the control module completes the status summary, abnormal feature similarity calculation, global anomaly index update, and global control parameter generation according to steps S101 to S104.

[0045] Step S101: The control module obtains the status statistics information generated by each local forwarding node in the previous complete measurement cycle, and identifies the abnormal statistical domain name keys that are active and whose local comprehensive anomaly degree reaches the local anomaly degree threshold.

[0046] Local comprehensive anomaly score refers to the final comprehensive anomaly score calculated by a local forwarding node for a statistical domain name key within a complete measurement period, or the value obtained by normalizing the final comprehensive anomaly score. The value of the local comprehensive anomaly score ranges from 0 to 1.

[0047] "Active state" refers to a statistical domain name key reaching a preset minimum number of valid queries within a complete measurement period. In this embodiment, the preset minimum number of queries is 100 to 1000. The number of valid queries includes the number of DNS requests that successfully retrieved the statistical domain name key and entered the statistical process. DNS requests that could not retrieve the statistical domain name key are excluded.

[0048] For the identified abnormal statistical domain keys, the control module extracts the corresponding abnormal traffic feature vector. The abnormal traffic feature vector includes at least the distribution ratio of DNS query types within the feature statistics time window, the domain tag length range characteristics, and the proportion of queries with no response.

[0049] Among them, the DNS query type distribution ratio is used to represent the proportion of the number of requests of different query types in the total number of valid queries; the domain name tag length range feature is used to represent the number or proportion of domain name tag lengths falling into each length range; and the query no response ratio is used to represent the proportion of queries that did not receive the corresponding DNS response within the response waiting time to the total number of valid queries.

[0050] The feature statistics time window can be the same as the measurement period. The specific time window length, domain name tag length range, and DNS query type set are determined by the system initialization parameters and remain unchanged within the same global scheduling period.

[0051] Step S102: The control module calculates the anomaly feature similarity between different anomaly statistical domain name keys. .

[0052] The control module performs normalization and fixed-point quantization on the distribution ratio of DNS query types, the domain name tag length range characteristics, and the query non-response ratio, so that the abnormal traffic feature vectors generated by different local forwarding nodes have the same dimension, field order, and quantization format.

[0053] The control module inputs the quantized abnormal traffic feature vector into the feature fingerprint generation unit to generate a fixed-length abnormal feature fingerprint. The feature fingerprint generation unit uses either the Locality Sensitive Hashing (LSH) method or the Sim Hash method. The fingerprint generation method used is determined by the system initialization configuration and remains unchanged within the same global scheduling cycle.

[0054] For abnormal statistical domain name keys originating from different local forwarding nodes, the control module calculates the Hamming distance between the corresponding abnormal feature fingerprints, and subtracts the ratio of the Hamming distance to the total number of bits in the abnormal feature fingerprint to determine the abnormal feature similarity between the two abnormal statistical domain name keys.

[0055] When there are at least two comparable abnormal statistical domain name keys within a global scheduling cycle, the control module performs similarity statistics on comparable sample pairs composed of abnormal statistical domain name keys from different local forwarding nodes.

[0056] The control module performs an arithmetic mean of the anomaly similarity of each comparable sample pair, and then performs a weighted average based on the effective sampling amount of each comparable sample pair. The result is determined as the anomaly similarity for that global scheduling cycle. When there are fewer than two comparable anomaly statistics domain keys, the control module will calculate the anomaly feature similarity. Set to zero.

[0057] The control module stores anomaly fingerprints, local forwarding node identifiers, statistical domain name key hash identifiers, and effective sampling quantities in a fixed-length feature record table. The statistical domain name key hash identifier is used to distinguish different statistical domain name keys.

[0058] The fingerprint bit length, feature quantization bit width, and hash seed used by the Locality Sensitive Hash (LSH) method or the Sim Hash method are determined by the system initialization parameters and remain unchanged within the same global scheduling cycle.

[0059] Step S103, the control module determines the similarity of abnormal features. Determine whether to perform a weighted aggregation of the local comprehensive anomaly scores for each abnormal statistical domain key, and update the global anomaly index. .

[0060] The control module will use anomaly feature similarity Similarity threshold with preset features Compare features. Feature similarity threshold. The value range is from 0.6 to 0.8.

[0061] when At that time, the control module sorts the abnormal statistical domain names in the previous complete measurement cycle according to the local comprehensive anomaly degree from high to low, and selects the ones ranked first. Abnormal statistics of domain name keys.

[0062] When the number of abnormal statistical domain keys that meet the criteria is less than At that time, the control module selects all abnormal statistics domain names that meet the conditions. A positive integer pre-configured by the system, with a value between 10 and 50.

[0063] The control module normalizes the effective sampling quantity corresponding to each abnormal statistical domain name key into a weighting coefficient, and performs a weighted average of the local comprehensive anomaly degree corresponding to the selected abnormal statistical domain name key based on the weighting coefficient.

[0064] The control module limits the obtained weighted average value to the range of 0 to 1, and determines the limited result as the global anomaly index to be used in the next global scheduling cycle. .

[0065] When the same statistical domain name key has statistical records in multiple local forwarding nodes, the control module first performs weighted merging of the local comprehensive anomaly degree of the statistical domain name key in different local forwarding nodes according to the effective sampling amount corresponding to each statistical record; the merged statistical domain name key then participates in the top K sorting to avoid the same statistical domain name key being weighted repeatedly because it appears in multiple local forwarding nodes.

[0066] when At that time, the control module will use the global anomaly index for the next global scheduling cycle. Set as the system's default global normal baseline .

[0067] Therefore, when the abnormal traffic characteristics of different local forwarding nodes lack consistency, the higher global anomaly index formed in the previous global scheduling cycle is not used, thereby reducing the impact of short-term traffic fluctuations of a single local forwarding node on global control parameters.

[0068] Step S104, the control module adjusts the global anomaly index according to the updated global anomaly index. Calculate the global dynamic protection threshold and bit width reduction And then send the global control parameters down to the data plane.

[0069] The control module calculates the global dynamic protection threshold according to the following formula. : ; In the formula, The static baseline threshold preset by the system is set to 0.75 to 0.85 in this embodiment; This is the threshold adjustment coefficient, ranging from 0 to 1, used to determine the extent to which the global dynamic protection threshold decreases as the global anomaly index exceeds the global normal baseline; The system's preset global normal baseline has a value ranging from 0.20 to 0.35.

[0070] When the global anomaly index Not exceeding the global normal baseline At that time, the global dynamic protection threshold Maintain as static baseline threshold .

[0071] When the global anomaly index Exceeding the global normal baseline At that time, the control module lowers the global dynamic protection threshold based on the difference between the two. .

[0072] Global dynamic protection threshold Addresses used for generating subsequent static random access memory lookup tables. Reduces the global dynamic protection threshold. This can increase the difference between the final comprehensive anomaly score and the threshold, so that the same final comprehensive anomaly score corresponds to a higher probability of packet loss in subsequent table lookup processes.

[0073] Global dynamic protection threshold It does not directly change the sampling matching probability of the second-level exact matching table.

[0074] The control module calculates the bit width reduction using the following formula. : ; In the formula, This is the bit width reduction factor, ranging from 4.0 to 8.0; [Signature] This indicates rounding down, used to reduce the bit width by an amount. The value is an integer so that the data plane can adjust the addressing bit width of the probability cardinality estimation structure through shift and bitmasking operations.

[0075] The control module will set a global dynamic protection threshold. Limit to a preset minimum protection threshold With static baseline threshold Between, and reduce the bit width by a certain amount. Limited to 0 to between.

[0076] in, The baseline addressing bit width for the probability base estimation structure; This represents the minimum addressing bit width allowed by the hardware, ranging from 8 to 12. After clipping, the dynamic addressing bit width used in the data plane is no less than... Preset minimum protection threshold The value ranges from 0.45 to 0.60.

[0077] When the global anomaly index When the bit width is increased, the bit width is reduced. The corresponding increase. The data plane is reduced according to the bit width. Reduce the number of hash bits involved in register bucket addressing, thereby reducing the number of addressable register buckets in the current measurement period.

[0078] Bit-width reduction changes the effective addressing range of the probability cardinality estimation structure, but does not change the processing flow of performing one register read and one conditional write for a single sampled message.

[0079] The control module will set a global dynamic protection threshold. Bit width reduction The parameter version number, effective period identifier, time window salt value, and lookup table version information are encapsulated into a parameter configuration message and asynchronously sent to each processing module in the data plane via the control bus or external management link.

[0080] Each processing module is configured with a double-buffered configuration area consisting of a first configuration area and a second configuration area. The parameters stored in one configuration area are used in the current measurement cycle, while the other configuration area is used to receive parameter configuration messages for the next measurement cycle.

[0081] After the current measurement cycle ends, each processing module atomically switches the current configuration area to another configuration area that has been written, based on the parameter version number and the effective period identifier, so that the global dynamic protection threshold used within the same measurement cycle is maintained. Bit width reduction The time window salt value and lookup table version should be kept consistent.

[0082] Reference Figure 4 The DNS pre-detection module executes step S20, which is used to perform protocol parsing and domain name structure checks on the received DNS request messages, and to perform hierarchical matching through a first-level Bloom filter and a second-level exact match table.

[0083] In this embodiment, the parsing pre-detection module completes DNS request message parsing, measurement time window determination, first-level Bloom filter query, second-level exact match sampling, and false positive rate statistics in sequence according to steps S201 to S205.

[0084] Step S201: The DNS request module receives the DNS request message input from the front-end network, parses the header, problem area, and domain name compression pointer of the DNS request message, and generates a resolution validity flag based on the resolution result. .

[0085] When the DNS request message's domain name compression pointer does not have a cycle or out-of-bounds error, the problem zone can be completely resolved, and the tag length and total domain name length comply with the DNS protocol, the resolution pre-check module will mark the resolution validity. Set to 1.

[0086] The DNS pre-check module performs normalization on the obtained query domain names. Normalization includes: converting English letters to uppercase and lowercase, removing the root tag from the end of the domain name, converting internationalized domain names to ASCII-compatible A-label format, and verifying the length of each domain tag and the total domain name length. After normalization, the resulting complete query domain name is determined as the fully qualified domain name.

[0087] The DNS pre-detection module extracts statistical domain keys from fully qualified domains according to the domain merging rules. The statistical domain keys can be registrable domains or authoritative zone names corresponding to fully qualified domains. The specific merging method is determined by the system initialization configuration and remains unchanged within the measurement period corresponding to the same parameter version.

[0088] When the domain name compression pointer forms a cycle, the domain name compression pointer goes out of bounds, the tag length exceeds the protocol limit, the total domain name length exceeds the protocol limit, or the problem area cannot be completely resolved, the resolution pre-check module will mark the resolution validity. Set to 0 and mark DNS request messages as resolution error messages.

[0089] For parsing validity tags For DNS request messages with a value of 0, the resolution preflight module does not perform a first-level Bloom filter query for the fully qualified domain name. Instead, it concatenates the original byte sequence of the DNS problem zone, the query type field, the source address field, and the resolution anomaly type identifier in the order of the fields to generate an anomaly sampling key.

[0090] The abnormal sampling key is sent to the sampling control module to perform subsequent deterministic hash sampling and structural anomaly sample cardinality estimation structure updates.

[0091] For parsing validity tags For DNS request messages with a value of 1, the DNS pre-check module performs a structure check on the fully qualified domain name according to the domain name structure rules and generates a domain name structure anomaly flag. .

[0092] Domain name structure rules should include at least the allowed range of domain name tag levels, the character length range of individual domain name tags, and mask matching rules for allowed character sets. The parsing pre-check module can perform structure checks through regular expression matching units or hardware character rule matching units.

[0093] When the fully qualified domain name's tag level, tag length, and character composition all conform to the domain name structure rules, the DNS pre-check module will mark the domain name structure as abnormal. Set to 0.

[0094] When the fully qualified domain name's tag level exceeds the allowed range, the length of a single tag exceeds the allowed range, or the tag contains characters that do not conform to the allowed character set rules, the DNS pre-check module will mark the domain name structure as abnormal. Set to 1.

[0095] Domain structure anomaly marker It is used to indicate whether a fully qualified domain name conforms to normal structural characteristics, but is not used to indicate whether the fully qualified domain name conforms to the DNS protocol.

[0096] Step S202: The pre-detection module analyzes the hit rate of the first-level Bloom filter corresponding to each statistical domain name key within the current measurement period. And based on the hit rate of the first-level Bloom filter Determine the dynamic measurement time window for the corresponding statistical domain name key. .

[0097] Level 1 Bloom filter hit rate The value is determined based on the number of times the first-level Bloom filter hits the corresponding statistical domain name key and the total number of queries of the first-level Bloom filter within the current measurement period, and its range is [0, 1].

[0098] Analysis of the pre-detection module combined with the first-stage Bloom filter hit rate Calculate the dynamic measurement time window according to the following formula. : ; In the formula, and These are the upper and lower limits of the system-preset measurement time window, respectively. In this embodiment, Set to 5000 milliseconds. Set to 500 milliseconds; The value range is [0, 1].

[0099] When the hit rate of the first-level Bloom filter corresponding to the statistical domain key is... When the temperature rises, the dynamic measurement time window The time window is extended accordingly, allowing the system to retain more sampling records within that measurement time window for subsequent independent base and request statistics.

[0100] When the first-stage Bloom filter hit rate When decreasing, dynamic measurement time window The corresponding periodicity is shortened, allowing the periodic statistics corresponding to the statistical domain name key to be completed earlier, and enabling the relevant counting resources to enter the next measurement cycle.

[0101] Step S203, for parsing validity tags For DNS request messages with a value of 1, the resolution preflight module inputs the normalized fully qualified domain name into the first-level Bloom filter for querying.

[0102] The first-level Bloom filter stores the probability representation of the set of trusted fully qualified domain names under the current parameter version; the second-level exact match table stores the exact key-value items corresponding to the set of trusted fully qualified domain names, and is used to sample and verify the partial hit results of the first-level Bloom filter.

[0103] The trusted fully qualified domain name set is generated from one or more of the following: historical successful resolution records, administrator-preset whitelists, successful resolution records returned by the backend DNS server, and the low-risk domain name set determined in the previous measurement period.

[0104] The first-level Bloom filter and the second-level exact match table are generated based on the same set of trusted fully qualified domain names, and are synchronously updated, aged, and double-buffered switched according to the parameter version or measurement cycle, so that the data sets corresponding to the two-level matching structures remain consistent within the same measurement cycle.

[0105] When the fully qualified domain name fails to hit the first-level Bloom filter, the DNS pre-detection module records the first-level Bloom filter failure status and sends the DNS request message to the sampling control module and the subsequent processing module.

[0106] When a fully qualified domain name hits the first-level Bloom filter, the DNS pre-detection module reads the corresponding statistical domain name key or the credibility penalty value corresponding to the statistical domain name key hash bucket. And mark it according to the abnormal domain name structure. Update credibility penalty value .

[0107] when At that time, the pre-detection module adds a confidence penalty value. Credibility penalty value It uses an unsigned integer register for storage, with an initial value of 0, and its increment process uses saturation addition.

[0108] When credibility penalty value Reaching the preset limit At that time, credibility penalty value Keep as It will no longer increase.

[0109] The value is determined by the bit width of the confidence penalty register, ranging from 255 to 65535. When using an 8-bit unsigned register... The value is 255; when a 16-bit unsigned register is used, The value is 65535.

[0110] when At that time, the parsing pre-detection module does not increase the confidence penalty value. The system retains its current value and updates the periodic decay rule. The specific update method is determined by the system initialization parameters and remains unchanged within the same parameter version.

[0111] Step S204: For DNS request packets that hit the first-level Bloom filter, the resolution preflight module determines the reliability penalty value. Calculate the sampling matching probability of the second-order exact matching table. .

[0112] The parsing pre-detection module calculates the sampling matching probability of the secondary exact matching table according to the following formula. : ; In the formula, The maximum sampling matching probability preset by the system, with a value ranging from 0.1 to 0.3, is used to limit the number of queries entering the secondary exact match table per unit time. The penalty smoothing coefficient is a constant greater than zero, ranging from 50 to 200.

[0113] With credibility penalty value Increase the sampling matching probability of the second-level exact matching table. Increase accordingly, and upon reaching It remains unchanged afterward.

[0114] Therefore, while limiting the query load of the secondary exact match table, the probability of structurally abnormal messages receiving exact match verification is increased.

[0115] The parsing pre-detection module generates pseudo-random numbers ranging from 0 to 1, and then matches these pseudo-random numbers with the sampling probability of the secondary exact matching table. Compare them.

[0116] When the pseudo-random number is less than At this time, the DNS preflight module sends the current DNS request message to the secondary exact match table for exact key-value matching.

[0117] When the pseudo-random number is greater than or equal to At this time, the DNS pre-detection module does not perform the second-level exact match and sends the DNS request message along with the first-level Bloom filter hit status to the subsequent processing module.

[0118] Step S205: For DNS request packets sampled and sent to the secondary exact match table, the resolution pre-detection module updates the confidence penalty value based on the query results of the secondary exact match table. and false positive rate And determine the matching status of the output to the subsequent processing module.

[0119] When a match is found in the second-level exact match table, it indicates that the current fully qualified domain name belongs to the set of trusted fully qualified domain names stored in the second-level exact match table.

[0120] The DNS preflight module marks the DNS request message as a second-order exact match and sends the message to the subsequent processing module.

[0121] A successful second-level exact match does not mean that the current DNS request packet has been finally allowed. The DNS request packet is still subject to final discard determination by the table lookup execution module based on the packet discard probability.

[0122] After a match is found in the second-level exact match table, the parsing preflight module reduces the corresponding confidence penalty value. Credibility penalty value The reduction process sets a lower limit to zero. When the calculated result after reduction is less than 0, a confidence penalty value is applied. Set to 0 to prevent underflow and wrapback of unsigned integers.

[0123] When the second-level exact match table is not hit, it indicates that the first-level Bloom filter did not receive confirmation of the exact key value item in this hit.

[0124] The parsing pre-detection module records one false positive event from the first-level Bloom filter and accumulates the number of misses in the second-level exact match table.

[0125] The analytical pre-detection module updates the false positive rate based on the number of misses in the secondary exact match table within the current measurement period and the number of hits in the primary Bloom filter sampled into the secondary exact match table. .

[0126] False positive rate It can be maintained according to the statistical domain name key, or, if hardware resources are insufficient to maintain it according to the statistical domain name key hash bucket, it can be maintained according to the statistical domain name key hash bucket. The statistical granularity used is determined by the system initialization parameters and remains unchanged within the same parameter version.

[0127] When the number of hits by the primary Bloom filter in the secondary exact match table sampled during the current measurement period is zero, the analytical pre-detection module retains the false positive rate from the previous measurement period. When there is no statistical value from the previous measurement period, the initial value of the false positive rate is used.

[0128] In one implementation, the parsing pre-detection module uses the ratio of the number of misses in the secondary exact match table to the number of hits in the primary Bloom filter sampled into the secondary exact match table as the false positive rate. The sampled estimate.

[0129] When it is necessary to obtain the overall false positive rate of the first-level Bloom filter, the parsing pre-detection module can determine the sampling matching probability of each sampled message. The statistical results are sampled and probability compensated, and the compensated statistical results are used as the overall false positive rate of the first-level Bloom filter.

[0130] The DNS preflight module marks DNS request packets that do not match the secondary exact match table as having failed or being suspected of being abnormal, and records the DNS request packets and their corresponding false positive rates. Send to the sampling control module and the table lookup execution module.

[0131] The first-level Bloom filter uses a hash function to map fully qualified domain names to bit arrays; the second-level exact match table stores the complete fully qualified domain name or its collision-free exact identifier, and can be implemented using a static random access memory hash table, content-addressable memory, or other hardware structures capable of performing exact key-value matching.

[0132] Reference Figure 5 The sampling control module executes step S30, which is used to select DNS request messages participating in the statistics based on the measured suppression probability without changing the physical storage capacity of the probability base estimation structure, and adjust the effective addressing bit width of the probability base estimation structure through shift and bit mask operations.

[0133] In this embodiment, the sampling control module completes the deterministic hash sampling determination, register bucket index generation, and probability cardinality estimation structure update in sequence according to steps S301 to S303.

[0134] Step S301: The sampling control module, for DNS request messages that meet the sampling entry conditions, determines the suppression probability based on the measured suppression probability. Perform deterministic hash sampling and determination.

[0135] The preset sampling entry conditions include at least the following: the measurement time window corresponding to the current DNS request message is in a valid state, the parameter version currently used is consistent with the parameter version of the measurement time window, and a sampling key corresponding to the DNS request message has been generated.

[0136] For parsing validity tags For DNS request messages with a value of 1, the sampling key uses the normalized fully qualified domain name; for resolution validity tags... For DNS request messages with a value of 0, the sampling key is the abnormal sampling key generated in step S201.

[0137] The sampling control module obtains the measurement suppression probability updated via feedback from the previous measurement cycle. And calculate the actual measurement sampling rate for the current measurement period. .

[0138] The sampling control module concatenates the sampling key corresponding to the current DNS request message with the salt value field of the time window used in the current measurement time window, and inputs the concatenation result into the sampling hash unit to generate a sampling hash value normalized to the interval of 0 to 1. .

[0139] In one implementation, the sampled hash value is used for deterministic hash sampling determination. The structure update hash value, generated by the first hash seed and used for subsequent register bucket addressing and leading zero detection, is generated by the second hash seed.

[0140] In another implementation, the sample hash value The structure update hash value is generated from non-overlapping bit fields in the same hash operation result. When using either of the above methods, the hash bit fields used for sampling determination do not overlap with the hash bit fields used for register bucket addressing and leading zero detection, so as to reduce the impact of sampling determination on the distribution of probability cardinality estimation results.

[0141] The specific hash generation method used is determined by the system initialization parameters and remains unchanged within the measurement period corresponding to the same parameter version.

[0142] The sampling control module will sample hash values Compare with the actual measured sampling rate Sr.

[0143] when When the current DNS request message meets the sampling conditions, it is determined that the DNS request message enters the probability cardinality estimation structure update step; when At that time, the probability cardinality estimation structure update will not be performed on the current DNS request message.

[0144] The salt value of the time window remains unchanged within the corresponding measurement time window and is updated when the measurement time window switches. The salt value of the time window can be maintained separately according to the statistical domain key, or it can be maintained uniformly according to the global measurement cycle. The specific maintenance method is determined by the system initialization parameters.

[0145] When the time window salt value is maintained according to the statistical domain name key, its update cycle is the same as the dynamic measurement time window of the corresponding statistical domain name key. To maintain consistency; when the time window salt value is maintained uniformly according to the global measurement cycle, each local processing unit within the same global measurement cycle uses the same time window salt value.

[0146] Therefore, when the sampling key, time window salt value, and parameter version are all the same, DNS request messages corresponding to the same sampling key will generate the same sampling hash value. And obtain consistent sampling judgment results.

[0147] Deterministic hash sampling is completed before the lookup execution module performs the final packet discard decision. The sampled records already generated are not changed even if the current DNS request packet is discarded or forwarded in subsequent steps.

[0148] Step S302: For DNS request packets that meet the sampling conditions, the sampling control module reduces the bit width by... Generate register bucket indexes for the probability cardinality estimation structure.

[0149] The sampling control module receives the bit width reduction amount sent by the control module. In terms of bit width reduction When the value is 0, the sampling control module uses a reference addressing bit width. Generate register bucket index.

[0150] When bit width reduction When the value is greater than 0, the sampling control module adjusts the sampling width based on the reduction amount. Calculate the dynamic addressing bit width The calculation formula is: ; In the formula, The minimum addressing bit width preset for the system is 8 to 12. The baseline addressing bit width for the probability base estimation structure; This refers to the bit width reduction amount issued by the control module.

[0151] By setting This makes the dynamic addressing bit width The number of addressable register buckets should not be lower than the minimum allowed by the hardware to avoid distortion of the base estimation results due to insufficient number of addressable register buckets.

[0152] The probability cardinality estimation structure is implemented using a fixed-capacity register array. Adjusting the dynamic addressing bit width does not involve dynamic memory allocation or reallocation of the register array; instead, it modifies the number of hash bits involved in addressing within the current measurement cycle through shift logic and bitmasking logic in the data plane.

[0153] Specifically, the sampling control module extracts the addressing field from the structure update hash value and performs a logical right shift operation on the addressing field, with the logical right shift bits being [number missing]. .

[0154] Subsequently, the sampling control module adjusts the dynamic addressing bit width. Generate low A bitmask with consecutive 1 bits is used, and the address field after logical right shift is bitwise ANDed with the bitmask.

[0155] Low bitwise AND operation yields low The bit binary value is used as the register bucket index corresponding to the current DNS request message.

[0156] The addressing field used for register bucket index generation and the rank field used for leading zero detection are different bit segments in the structure update hash value. The bit width reduction operation only applies to the addressing field and does not change the bit width or content of the rank field.

[0157] Dynamic addressing bit width The corresponding number of addressable register buckets is less than or equal to the base addressing bit width. The corresponding number of addressable register buckets. Register buckets not covered by the current register bucket index are not included in the cardinality estimation for the current parameter version during this measurement period.

[0158] In step S303, the sampling control module updates the corresponding probability base estimation structure and sampling request counter based on the register bucket index and domain name structure anomaly marker.

[0159] In this embodiment, the probability cardinality estimation structure is implemented using a HyperLogLog type register array, and is divided into a cardinality estimation structure for structurally normal samples and a cardinality estimation structure for structurally abnormal samples. Each of the two cardinality estimation structures has its own independent register array and sampling request counter.

[0160] For parsing validity tags Marked as 1 and with an abnormal domain structure For DNS request messages with a value of 0, the sampling control module selects a normal sample base estimation structure.

[0161] For parsing validity tags DNS request messages with a value of 0, or resolution validity tags Marked as 1 and with an abnormal domain structure For DNS request messages with a value of 1, the sampling and control module selects the structurally abnormal sample cardinality estimation structure.

[0162] The sampling control module uses the register bucket index generated in step S302 to locate the corresponding register bucket in the selected probability base estimation structure.

[0163] Meanwhile, the sampling control module extracts the rank field that did not participate in register bucket addressing from the structure update hash value, and inputs the rank field into the leading zero detection unit to obtain the number of consecutive zeros in the rank field starting from the start bit, which is used as the leading zero length value corresponding to the current sampling key.

[0164] The sampling control module reads the current register value from the register bucket and compares the leading zero length value with the current register value.

[0165] When the current zero-leading length value is greater than the current register value, the sampling control module outputs a write enable signal and writes the leading zero-leading length value into the corresponding register bucket; when the current zero-leading length value is less than or equal to the current register value, the current register value in the register bucket remains unchanged.

[0166] Regardless of whether the length of the leading zero is greater than the current register value, as long as the current DNS request message meets the sampling conditions specified in step S301, the sampling control module will perform an incremental update on the corresponding sampling request counter.

[0167] The normal sample sampling request counter is used to accumulate the number of sampling requests for normal samples, while the abnormal sample sampling request counter is used to accumulate the number of sampling requests for abnormal samples.

[0168] The sampling control module also associates and records the parameter version number, time window salt value, and dynamic addressing bit width Pdyn corresponding to the current probability base estimation structure with the register array.

[0169] After the measurement time window expires, only the parameter version number, time window salt value, and dynamic addressing bit width are allowed. All have the same probability base estimation structure to participate in the merging.

[0170] The leading zero detection unit can be implemented using a priority encoder or hierarchical combinational logic; the probability cardinality estimation structure can be implemented using static random access memory, register file, or a fixed-capacity storage array composed of both.

[0171] Reference Figure 6 The comprehensive anomaly calculation module executes step S40, which is used to summarize the probability base estimation structure and sampling request counter after the measurement time window expires, and combine the observations after the packet was dropped and the backend DNS resolution response to generate the final comprehensive anomaly.

[0172] In this embodiment, the comprehensive anomaly calculation module completes independent cardinality estimation and sampling compensation, request volume statistics and unobserved request volume compensation, as well as backend parsing failure ratio statistics and final comprehensive anomaly calculation in sequence according to steps S401 to S403.

[0173] Step S401, within the dynamic measurement time window Upon expiration, the comprehensive anomaly calculation module reads the estimated structure based on the cardinality of normal samples and the estimated structure based on the cardinality of anomaly samples, and calculates the independent cardinality of normal samples and the independent cardinality of anomaly samples respectively.

[0174] Before performing the merge, the comprehensive anomaly calculation module checks the parameter version number, time window salt value, and dynamic addressing bit width corresponding to each probability base estimation structure. The corresponding register array is allowed to participate in merging only when all three parameters mentioned above are the same.

[0175] For multiple register arrays that meet the merging criteria, the comprehensive anomaly calculation module compares them bucket by bucket according to the register bucket index and uses the maximum register value in the same register bucket as the merged register value.

[0176] The cardinality estimation structures for normal samples and those for abnormal samples are merged separately, and their register values ​​are not mixed.

[0177] The comprehensive anomaly calculation module reads the values ​​of each register bucket in the merged structural normal sample cardinality estimation structure and structural anomaly sample cardinality estimation structure, and calculates the values ​​based on the current dynamic addressing bit width. The corresponding effective register bucket number and cardinality estimation parameters were obtained by harmonic averaging to obtain the original estimated cardinality for a normal structure. and the original estimation base of structural anomalies .

[0178] Among them, the dynamic addressing bit width When changes occur, the comprehensive anomaly calculation module selects the estimation coefficients and correction parameters corresponding to the current number of valid register buckets to avoid introducing additional deviations by using the same estimation parameters for different numbers of register buckets.

[0179] Since the sampling key written to the probability cardinality estimation structure has already undergone deterministic hash sampling in step S301, the structure normally maintains the original estimated cardinality. and the original estimation base of structural anomalies These represent the actual measurement sampling rates. The number of independent sampling keys is estimated.

[0180] The comprehensive anomaly calculation module performs sampling rate compensation according to the following formula to obtain the structural normal independent cardinality. and structural anomaly independent cardinality : ; ; In the formula, The constant for preventing the denominator from becoming zero is 1 × 10⁻⁶. -6 ; This represents the actual measurement sampling rate for the current measurement period.

[0181] Normal independent cardinality Used to represent the estimated number of independent fully qualified domain names corresponding to structurally normal samples; independent cardinality of structurally abnormal samples. Used to represent the estimated number of independent fully qualified domain names or anomaly sampling keys corresponding to structural anomaly samples.

[0182] The sampling control module has already marked the parsing validity during the writing phase. and domain name structure anomaly marker The sampling records are written into either the cardinality estimation structure for structurally normal samples or the cardinality estimation structure for structurally abnormal samples. Therefore, the comprehensive anomaly calculation module does not proportionally split the overall cardinality after merging.

[0183] In step S402, the comprehensive anomaly calculation module reads the structural normal sample sampling request counter and the structural abnormal sample sampling request counter, and calculates the request quantity statistics and the unobserved request quantity compensation value through the sliding window compensation accumulator.

[0184] The count value of the sample sampling request counter for structurally normal samples is denoted as: The count value of the structural anomaly sample sampling request counter is denoted as The comprehensive anomaly calculation module calculates the anomaly rate based on the actual measurement sampling rate of the current measurement period. ,right and Sampling rate compensation was performed separately to obtain the normal structural request quantity. and structural anomaly request volume .

[0185] in, and A dimension used to characterize the number of requests in a DNS request message; and This dimension represents the number of unique fully qualified domain names or anomaly sampling keys. The request volume and the unique cardinality are used separately in subsequent proportional calculations and are not directly added together.

[0186] When the table lookup execution module has discarded some DNS request packets, it only counts the number of requests on the allowing side or the number of backend responses after the discarding action, so that the request scale in the current measurement period is lower than the actual received request scale.

[0187] To compensate for the number of requests that were not observed after a drop action, the comprehensive anomaly calculation module reads the packet drop probability within the historical measurement period. and corresponding post-disposal observations And calculate the compensation value for unobserved requests. .

[0188] Post-disposal observations Use the release-side observation request quantity corresponding to the structural anomaly sample. Alternatively, a back-end response side-view measurement corresponding to the structural anomaly sample can be used. .

[0189] The specific type of observation used is determined by the system initialization configuration and remains consistent across all historical measurement periods corresponding to the same parameter version.

[0190] or Unified as observations after discarding Unobserved Request Compensation Value The calculation formula is: ; Among them, step S301 generates the structurally normal independent cardinality Cleg and the structurally abnormal independent cardinality before the final message discard determination. Do not use Compensation will be provided again.

[0191] In the formula, The number of historical measurement periods included in the sliding window, which ranges from 5 to 10; This is the measurement cycle index within the sliding window; The denominator is a constant that prevents it from becoming zero; For the corresponding statistical domain key or statistical domain key hash bucket in the th... Average message drop probability over a historical measurement period.

[0192] and Both use the same statistical granularity. When hardware resources allow for maintenance of each statistical domain name key, both are recorded according to the statistical domain name key; when hardware resources are insufficient, both are recorded according to the statistical domain name key hash bucket.

[0193] Average packet drop probability The result can be calculated by recording the number of discard decisions and the total number of decisions using a saturation counter, or it can be recorded using a fixed-point moving average register. The recording method used is determined by the system initialization parameters.

[0194] The comprehensive anomaly calculation module calculates the structural anomaly independent cardinality. , structurally normal independent cardinality and smoothing factor Calculate the base abnormality ratio : ; The comprehensive anomaly calculation module calculates the number of structural anomaly requests. Normal request volume Unobserved Request Compensation Value and smoothing factor Calculate the abnormal proportion of request volume : ; The comprehensive anomaly calculation module calculates anomalies according to preset fusion weights. Regarding the abnormal proportion of the base figure and the proportion of abnormal request volume Perform weighted fusion to generate a comprehensive anomaly score for the front end. : ; In the formula, and All are smoothing constants greater than zero, with values ​​ranging from 100 to 500; The fusion weighting coefficient has a value range of 0 to 1.

[0195] By calculating the abnormal proportion of the base number and the abnormal proportion of the request volume separately, and then performing weighted fusion, we can avoid directly adding the number of independent domain names to the number of message requests, and retain the numerical meaning of the two different statistical dimensions.

[0196] Step S403: The comprehensive anomaly calculation module calculates the proportion of failed responses in the backend DNS resolution responses and compares the proportion of failed responses with the comprehensive anomaly of the frontend. Perform weighted fusion to generate the final comprehensive anomaly score. .

[0197] The comprehensive anomaly calculation module extracts the query domain name within the problem zone from the DNS response message returned by the backend DNS server, and obtains the corresponding statistical domain name key according to the domain name normalization rules and domain name merging rules adopted in step S201.

[0198] The comprehensive anomaly calculation module uses a fixed-capacity counter array addressed by a statistical domain name key hash index. Each counter item in the array includes at least a total response counter and a failed response counter, used to accumulate the total number of responses. and number of failed responses .

[0199] The failure response is determined by a preset set of failure response states. This set may include one or more of the following: server failure, query rejected, requested domain name not found, no valid resource record of a preset type in the response, or other failure states configured by the system. The set of failure response states used is determined by system initialization parameters and remains unchanged within the measurement period corresponding to the same parameter version.

[0200] When a DNS response fails and meets any of the criteria in the set of response states, the comprehensive anomaly calculation module simultaneously increments the total response count in the corresponding counter. and number of failed responses When a DNS response does not meet the failure criteria, only the total number of responses is increased. .

[0201] Both the total response counter and the failure response counter use saturation counting. When the count value reaches the maximum value that the corresponding counter bit width can represent, it remains at that maximum value and stops increasing to avoid overflow and wrapback of the unsigned counter.

[0202] At the end of the current measurement period, the comprehensive anomaly calculation module calculates the total number of responses. and number of failed responses Calculate the parsing failure rate The formula is: ; In the formula, The constant for preventing the denominator from becoming zero is 1 × 10⁻⁶. -6 .

[0203] When the total number of responses When the value is zero, the resolution failure rate from the previous measurement cycle can be retained. The specific processing method is determined by the system initialization parameters.

[0204] The comprehensive anomaly calculation module will calculate the comprehensive anomaly from the front end. The ratio of parsing failures Perform weighted fusion to generate the final comprehensive anomaly score. The calculation formula is: ; In the formula, This is the weighting coefficient for the overall anomaly score of the front end, with a value ranging from 0 to 1; The weights are used to analyze the failure rate.

[0205] Final overall anomaly The value of is restricted to the range of 0 to 1, and is used as one of the input parameters for the lookup execution module to generate the static random access memory lookup table address index.

[0206] Reference Figure 7 The lookup execution module executes step S50, which is used to generate the address index of the static random access memory lookup table based on the false positive rate, the final comprehensive anomaly degree and the global dynamic protection threshold, read the corresponding packet drop probability, and perform packet processing and measurement suppression probability update based on the packet drop probability.

[0207] In this embodiment, the control plane pre-calculates the packet drop probability corresponding to different combinations of quantized inputs and writes the calculation results into a static random access memory lookup table. The data plane obtains the packet drop probability by looking up the table, eliminating the need to perform floating-point exponentiation online during packet forwarding.

[0208] The lookup execution module completes the lookup table address generation, packet drop probability reading, packet drop determination, and measurement suppression probability update for the next measurement cycle in sequence according to steps S501 to S503.

[0209] Step S501, the table lookup module performs the lookup based on the false positive rate. Calculate the dynamic penalty coefficient And based on the quantified false positive rate Final overall anomaly and global dynamic protection threshold Generate the address index of the static random access memory lookup table.

[0210] The lookup execution module obtains the false positive rate output by the parsing pre-detection module. The dynamic penalty coefficient is calculated according to the following formula. : ; In the formula, The system's preset base penalty coefficient ranges from 1.5 to 3.0. The penalty adjustment coefficient, ranging from 1 to 5, is used to determine the false positive rate. Dynamic penalty coefficient The extent of the impact.

[0211] With the false positive rate Increase the dynamic penalty coefficient. The corresponding increase. Dynamic penalty coefficient. Used to adjust the final synthesis anomaly degree when generating a static random access memory lookup table in the control plane. Exceeding the global dynamic protection threshold The increase in the probability of subsequent message dropping.

[0212] During system initialization or lookup table version update, the control plane iterates through the quantized false positive rate. Final overall anomaly and global dynamic protection threshold The discrete value combinations are used to calculate the packet drop probability corresponding to each discrete value combination according to the preset drop probability mapping rule. .

[0213] The preset discard probability mapping rule must satisfy at least the following relationship: when the final comprehensive anomaly degree Not exceeding the global dynamic protection threshold At that time, the probability of message dropping It falls within the preset base probability range, which ranges from 0 to 0.05; when the final comprehensive anomaly degree... Exceeding the global dynamic protection threshold At that time, the probability of message dropping The false positive rate increases as the difference between the two values ​​increases; when the difference is the same, the false positive rate... Or the dynamic penalty coefficient determined by it The larger the value, the higher the probability of message dropping. The higher.

[0214] The control plane will calculate the packet drop probability. Convert to unsigned fixed-point numbers, and construct an array of packet drop probability entries in ascending order of lookup table addresses. Output the bit width and the random number used in step S502. They have the same bit width.

[0215] In one implementation, the input fields of the static random access memory lookup table include a false positive rate quantization field, a final comprehensive anomaly quantization field, and a global dynamic protection threshold quantization field.

[0216] In another implementation, the control plane first sets the false positive rate. Mapped to dynamic penalty coefficient The penalty level field, the final comprehensive anomaly quantification field, and the global dynamic protection threshold quantification field are then used together as the address field of the lookup table. The specific configuration of the address field is determined by the lookup table version.

[0217] For example, when the final comprehensive anomaly degree and global dynamic protection threshold Quantified into 8 digits respectively, false positive rate Or due to the false positive rate When the penalty level obtained from the mapping is quantized to 4 bits, the three types of quantization fields are concatenated to form a 20-bit lookup table address.

[0218] The control plane generates a corresponding array of packet drop probability entries according to the 20-bit address space and loads it into the static random access memory of the data plane via the external management bus or the control bus.

[0219] When the static random access memory (SRAM) capacity is insufficient to store all entries corresponding to all input combinations, the control plane can reduce the false positive rate quantization bit width, or reduce the false positive rate... The penalty levels are pre-mapped to a small number of penalty levels, and then the penalty levels are used in address concatenation.

[0220] The lookup table execution module performs checks on the false positive rate. Final overall anomaly and global dynamic protection threshold Perform amplitude limiting and fixed-point quantization.

[0221] For input variables with values ​​ranging from 0 to 1, the fixed-point quantization unit maps the input variables to the range of unsigned integers that the corresponding field bit width can represent, and performs upper limit truncation on results that exceed the maximum quantization value.

[0222] The lookup execution module concatenates the quantized input fields in high-low byte order to generate the static random access memory lookup table address. .

[0223] The field concatenation order, the bit width of each field, and the maximum quantization value are determined by the current lookup table version and remain unchanged within the same measurement period.

[0224] The table lookup execution module will look up the table address. Input the address port of the static random access memory and read the corresponding packet drop probability. .

[0225] In implementations of static random access memory that meet the single-clock-cycle read timing requirements, the packet drop probability... It can be output to the subsequent comparison unit after a memory read operation.

[0226] The control plane loads the newly generated lookup table into a non-currently used storage area and associates the lookup table version with the parameter version number and the effective period identifier.

[0227] After the current measurement period ends, the data plane switches to a new lookup table to ensure that the field bit width, quantization rules, field concatenation order, and lookup table content used within the same measurement period remain consistent.

[0228] Step S502, the table lookup execution module performs a lookup based on the read packet drop probability. The current DNS request message is discarded.

[0229] The table lookup execution module generates fixed-width unsigned pseudo-random integers using a linear feedback shift register. The table lookup execution module will determine the packet drop probability output from the static random access memory. Convert to pseudo-random integers Discard comparison thresholds with the same bit width and the same range of integer values.

[0230] When the probability of message dropping Already in accordance with When the same bit width is stored in the lookup table, the lookup execution module directly uses the fixed-point number as the discard comparison threshold.

[0231] When the two bit widths are different, the table lookup execution module performs the lookup according to the fixed-point scaling rule. Perform bit-width alignment to obtain the discard comparison threshold.

[0232] The table lookup execution module will use pseudo-random integers. Compare the input unsigned integers with the threshold for discarding.

[0233] when When the threshold for discarding is less than or equal to the threshold for discarding, the comparator outputs a discard determination signal, the lookup execution module marks the current DNS request packet as discarded, and terminates the subsequent forwarding of the DNS request packet in the forwarding pipeline.

[0234] when When the threshold for discarding comparisons is exceeded, the comparator outputs a signal to continue forwarding, and the lookup execution module continues to forward the current DNS request message to the backend DNS server.

[0235] The packet drop determination performed in step S502 does not revoke the sampling record already generated in step S301. Regardless of whether the current DNS request packet is dropped or continues to be forwarded, the register state and sampling request count value already written into the probability base estimation structure are retained.

[0236] In step S503, the table lookup execution module performs a first-order smooth update and upper and lower limit clamping on the measurement suppression probability of the next measurement period based on the message drop probability and measurement suppression probability of the current measurement period.

[0237] In this embodiment, the method used to update the measurement suppression probability is... The average packet drop probability is calculated using the current statistical domain name key or the statistical domain name key hash bucket within the current measurement period. The average packet drop probability is obtained by accumulating or averaging the packet drop probabilities corresponding to each DNS request packet within the current measurement period.

[0238] Measuring the probability of inhibition Used to determine whether DNS request packets are included in the measurement sampling, and the probability of packet drop. These two methods are used to determine whether a DNS request message should continue to be forwarded; they operate at different processing stages. Measuring the probability of suppression. Not directly equivalent to the probability of packet loss .

[0239] The lookup table module calculates the measurement suppression probability for the next measurement cycle using the following formula. : ; In the formula, This represents the measurement suppression probability for the current measurement period. To smoothly update the step size, the value ranges from 0 to 1, and is used to adjust the rate at which the measurement suppression probability changes to the current average packet drop probability; For upper and lower limit clamping functions, when Time output ,when Time output ,when Output when it is between the two .

[0240] To measure the lower bound of the suppression probability, the value is taken as 0 to 0.2; To measure the upper bound of the suppression probability, a value of 0.8 to 0.9 is used.

[0241] By setting an upper bound for the measurement suppression probability Even if the average message drop probability of the current measurement period Approaching its upper limit, the actual measurement sampling rate for the next measurement cycle Still not lower than .

[0242] The minimum measurement sampling rate is only used to ensure that the data plane continues to generate a certain number of measurement samples, and does not mean that the same proportion of DNS request messages will necessarily be forwarded to the backend DNS server.

[0243] The sampling record is still generated before the final message discard decision, and the sampled DNS request message can be discarded in step S502.

[0244] By setting upper and lower limits for the measurement suppression probability and using first-order smooth updates, abrupt changes in the sampling rate between adjacent measurement periods can be reduced, and measurement samples for subsequent comprehensive anomaly calculations can be retained even with a high message drop probability.

[0245] To enable those skilled in the art to more clearly understand the purpose, technical solution, and advantages of this invention, the present invention will be further described in detail below with reference to specific application embodiments, real experimental test data, and corresponding drawings. It should be noted that the embodiments described herein are only for explaining the present invention and are not intended to limit the scope of protection of the present invention.

[0246] The scenario is set as follows: a local forwarding node at the front end of a large data center is being attacked by a DNS droplet attack targeting example.com, i.e., a random subdomain attack.

[0247] Normal and legitimate traffic: 1000 QPS.

[0248] Malicious attack traffic: 5000 QPS, constructing random, extremely long subdomains, such as x8f9q.example.com.

[0249] Currently in the first Each measurement cycle, hardware reference addressing bit width It is 14, providing 16384 register buckets.

[0250] Similarity and Global Anomaly Score: Nodes A and B simultaneously report anomalies. The Hamming distance between the anomaly fingerprints of the two nodes is 8, with a total of 64 bits. The anomaly feature similarity is calculated. It is 0.875. The value is set to 0.7. Since 0.875 ≥ 0.7, aggregation is performed. The local comprehensive anomalies of nodes A and B are 0.8 and 0.9 respectively. The global anomaly index is obtained by weighting the values ​​by the sample size. .

[0251] Dynamic protection threshold calculation: assuming a static baseline Global normal baseline adjustment coefficient It is 0.5.

[0252] ; Bit width reduction calculation: Set the reduction coefficient .

[0253] ; Control plane will and Send it to the data plane.

[0254] Adaptive measurement time window: A large number of random subdomains failed to hit the first-level Bloom filter, causing the hit rate to drop to .

[0255] ms; The statistical settlement cycle for this domain name has been accelerated to 1.85 seconds, speeding up the defense response.

[0256] Penalty and Sampling: For a record that hits L1 but carries an anomalous character, i.e. The penalty value for the message is accumulated to... Second-order sampling probability, let... : ; Only about 9.9% of suspicious packets were sent to the exact match table, saving SRAM lookup bandwidth. The false positive rate for this period was subsequently analyzed. .

[0257] Address width adjustment: according to the issued... Dynamic addressing bit width The data plane hash value is shifted 3 bits to the right, the mask is truncated to 11 bits, and the number of register buckets involved in addressing is reduced sharply from 16384 to 2048, which meets the coarse-grained sampling requirements during the defense period and frees up memory bandwidth.

[0258] The message is sampled using hashing; let the current actual sampling rate be... The normal and abnormal HLL structures are updated separately. After a 1.85s time window, the hardware automatically merges the calculations. Independent base estimation: Assume normal structural estimate Abnormal estimated value After sampling compensation, independent cardinality , .

[0259] Unobserved Request Compensation: Set the evaluation value for the under-counting caused by historical discard actions. After request count compensation , .

[0260] Front-end overall anomaly level: ; ; Weighted ,in ; Final anomaly rate: The percentage of parsing failures received from the backend. The backend DNS was also impacted to some extent. Integrating frontend metrics, namely... : ; Fixed-point table lookup: Perform 8-bit and 4-bit fixed-point quantization and concatenate them to generate a 20-bit static memory address.

[0261] The SRAM outputs the packet drop probability corresponding to this address within one clock cycle. That is, 82%. Because 0.793 is greater than the dynamic threshold of 0.495, the data plane generates random numbers for comparison, ruthlessly discarding 82% of the abnormal characteristic messages.

[0262] Suppression probability reflexivity: current Smooth step size .

[0263] ; The measurement suppression probability for the next cycle is automatically increased to 24.4%, further reducing the hardware statistical load under adverse conditions.

[0264] To verify the effectiveness of the proposed solution under extreme network attack environments and its advantages in hardware resource scheduling, a high-performance network traffic simulation platform supporting 100Gbps was used for stress testing. The experimental background was extracted from real data center backbone DNS traffic, with the baseline of legitimate requests remaining stable at 50,000 QPS. At the 10th second of the simulation, a DNS droplet attack based on a botnet was injected into the system, and the attack traffic surged from 0 to a peak of 500,000 QPS in a very short time.

[0265] Comparison group settings: Option A, Traditional Threshold Rate Limiting: Rate limiting based on source IP and domain name using a fixed-rate token bucket. Option B, Standard Bloom + Standard HLL Defense: Provides probabilistic defense but lacks dynamic bit width reduction and secondary precise sampling verification. Option C, This Invention: Features nanosecond-level SRAM table lookup, secondary matching sampling adjustment, and dynamic hash bit width truncation.

[0266] The test results are as follows: according to Figure 8 As the attack intensity increased, the pass rate of control group 1 dropped to 21.4% at its peak, indicating that traditional fixed rate limiting would cause serious false positives for legitimate requests. Control group 2 performed steadily in the early stages, but showed a significant step drop when the attack traffic reached 200kQPS, specifically in the 88.5% range. This was because full hash matching caused the hardware SRAM and memory bandwidth to be fully utilized, leading to system congestion and random packet loss at the tail. In contrast, the pass rate curve of the experimental group remained close to the 100% baseline throughout, and even at the extreme point of 500,000 QPS, it still maintained a high level of 98.2%. This demonstrates that the dynamic bit width reduction and two-level sampling mechanism of this invention reduce unnecessary hardware lookup load, enabling the system to maintain high-precision line-rate access even under overload conditions.

[0267] according to Figure 9It can be seen that before the attack injection at the 10th second, the system's global anomaly index and final comprehensive anomaly degree are both at a low level of around 0.2, and the dynamic protection threshold is stable at a relaxed state of 0.80. After the attack injection at the 10th second, it climbs to a high level of around 0.8 within a delay of less than 2 seconds. Due to the suppression of the high anomaly degree, the curve representing the dynamic protection threshold on the right shows a reverse step-like downward movement, converging and locking at the baseline of 0.495. This further confirms that the present invention can instantly complete the dynamic reflexive and adaptive closed loop of the defense strategy according to the degree of situational deterioration without human intervention.

[0268] While specific embodiments of the present invention have been described above, those skilled in the art should understand that these specific embodiments are merely illustrative. Those skilled in the art can omit, substitute, and modify the details of the above methods and systems in various ways without departing from the principles and essence of the present invention. For example, combining the above method steps to perform substantially the same function and achieve substantially the same result using substantially the same method falls within the scope of the present invention.

Claims

1. A DNS server intelligent protection system, characterized in that, include: The control module is used to acquire status statistics information and identify abnormal statistical domain name keys, update the global abnormality index based on the local comprehensive abnormality of the abnormal statistical domain name keys, and calculate the global dynamic protection threshold and bit width reduction amount based on the global abnormality index and send them to the data plane. The DNS pre-detection module is used to receive DNS request messages, extract statistical domain name keys, and output resolution validity flags and domain name structure anomaly flags. The sampling matching probability of the second-level exact match table is determined based on the hit status of the first-level Bloom filter, and the false positive rate is calculated based on the matching results of the second-level exact match table. The sampling control module is used to perform deterministic hash sampling judgment on the DNS request message according to the measured suppression probability. For the DNS request message that meets the sampling conditions, the addressing bit width of the probability cardinality estimation structure is adjusted according to the bit width reduction amount to generate a register bucket index, and the sampling records are written into the normal sample cardinality estimation structure or the abnormal sample cardinality estimation structure according to the domain name structure anomaly mark. The comprehensive anomaly calculation module is used to merge the cardinality estimation structure of the normal sample and the cardinality estimation structure of the abnormal sample to obtain an independent cardinality when the measurement time window expires; and to generate the final comprehensive anomaly based on the independent cardinality, the request volume statistics, the unobserved request volume compensation value, and the resolution failure ratio in the backend DNS resolution response. The lookup execution module is used to generate an address index of a static random access memory lookup table based on the false positive rate, the global dynamic protection threshold, and the final comprehensive anomaly degree; read the corresponding packet drop probability based on the address index to perform packet drop determination on the DNS request packet; and update the measurement suppression probability for the next measurement period based on the packet drop probability of the current measurement period.

2. The intelligent protection system for DNS servers according to claim 1, characterized in that, The specific processing involved in calculating the global dynamic protection threshold and bit width reduction by the control module includes: Extract the abnormal traffic feature vector corresponding to the abnormal statistics domain key and calculate the abnormal feature similarity between different abnormal statistics domain keys. Update the global anomaly index based on the abnormal feature similarity and the corresponding local comprehensive anomaly. When the global anomaly index exceeds the system's preset global normal baseline, the system's preset static baseline threshold is reduced by multiplying the difference between the two by a preset threshold adjustment coefficient to obtain the global dynamic protection threshold. The bit width reduction is obtained by rounding down the product of the difference and the preset bit width reduction coefficient, and the bit width reduction is limited to a range that ensures the dynamic addressing bit width of the probability base estimation structure is not lower than the minimum addressing bit width preset by the hardware.

3. The intelligent protection system for DNS servers according to claim 1, characterized in that, The specific processing of the parsing pre-detection module includes: The hit rate of the first-level Bloom filter corresponding to each statistical domain name key within the current measurement period is statistically analyzed. Based on the hit rate of the first-level Bloom filter, linear interpolation is performed between the upper and lower limits of the preset measurement time window to calculate the dynamic measurement time window of the corresponding statistical domain name key as the measurement time window. When a DNS request message hits the first-level Bloom filter and the domain name structure anomaly flag indicates a structure anomaly, the corresponding credibility penalty value is increased, and the sampling matching probability of the second-level exact matching table, which is limited to the maximum sampling matching probability, is calculated in a forward direction based on the credibility penalty value.

4. The intelligent protection system for DNS servers according to claim 1, characterized in that, The specific processing of generating the register bucket index and writing the sampling record by the sampling control module includes: Extract the addressing field from the structure update hash value generated by the deterministic hash sampling decision, and perform a logical right shift operation on the addressing field according to the bit width reduction amount; The dynamic addressing bit width is obtained by subtracting the bit width reduction from the base addressing bit width. A bitmask with the low bits continuously set to 1 is generated based on the dynamic addressing bit width. The addressing field after logical right shift is bitwise ANDed with the bitmask to generate the register bucket index. The sampling control module generates the sampling record before the table lookup execution module performs the final message discard determination, and the generated sampling record is retained independently of the subsequent message discard results.

5. The intelligent protection system for DNS servers according to claim 1, characterized in that, The specific processing of the comprehensive anomaly calculation module for calculating the compensation value for unobserved requests includes: Read the packet drop probability and the observations after the drop action within the historical measurement period. The observations are either the observation request quantity on the release side or the observations on the backend response side. By using a sliding window compensation accumulator, the values ​​of the observed quantities within each historical measurement period are combined with the weighted summation of the ratio of the packet drop probability to the release probability corresponding to the same historical measurement period to obtain the unobserved request quantity compensation value used to compensate for the number of dropped packets. The release probability is 1 minus the corresponding packet drop probability.

6. The intelligent protection system for DNS servers according to claim 1, characterized in that, The specific processing steps for generating the final comprehensive anomaly score by the comprehensive anomaly score calculation module include: By combining the actual measurement sampling rate, the independent basis is sampled and compensated to obtain the independent basis of the structure with normal structure and the independent basis of the structure with abnormal structure, respectively. The request volume statistics include the number of requests with abnormal structure and the number of requests with normal structure. The anomalous proportion of the cardinality is calculated based on the independent cardinality of the structural anomalies and the independent cardinality of the structural normalities; Calculate the abnormal request ratio based on the abnormal request volume, the normal request volume, and the compensation value for the unobserved request volume; According to the preset weighted fusion rules, the abnormal proportion of the base number and the abnormal proportion of the request volume are weighted and fused to generate the comprehensive anomaly score of the front end. The comprehensive anomaly score of the front end is then weighted and fused again with the resolution failure proportion extracted from the backend DNS resolution response to generate the final comprehensive anomaly score.

7. The intelligent protection system for DNS servers according to claim 1, characterized in that, The specific processing of address index generation and retrieval by the table lookup execution module includes: Calculate the dynamic penalty coefficient based on the false positive rate; The false positive rate, the final comprehensive anomaly degree, and the global dynamic protection threshold are mapped to the range of unsigned integers according to the corresponding field bit width to complete fixed-point quantization. Then, according to the field concatenation order determined by the lookup table version, the high and low bits of each field after fixed-point quantization are concatenated to generate the address index of the static random access memory lookup table. The entries in the static random access memory lookup table are pre-calculated based on the discrete combinations of the false positive rate, the final comprehensive anomaly degree, and the global dynamic protection threshold by the control plane, according to the discard probability mapping rule, and written down in the form of unsigned fixed-point numbers.

8. The intelligent protection system for DNS servers according to claim 1, characterized in that, The specific processing of updating the measurement suppression probability by the table lookup execution module includes: The average packet drop probability is calculated based on the packet drop probability corresponding to each DNS request packet within the current measurement period. The difference between the average packet drop probability and the measurement suppression probability of the current measurement period is calculated. The difference is multiplied by the smooth update step size and then added to the measurement suppression probability of the current measurement period to perform a first-order smooth update. The update result is clamped and restricted between a preset lower bound and a preset upper bound of the measurement suppression probability, and used as the measurement suppression probability of the next measurement period.

9. The intelligent protection system for DNS servers according to claim 1, characterized in that, The parsing pre-detection module and sampling control module also include an abnormal sampling key rollback mechanism: When the received DNS request message cannot extract the canonical fully qualified domain name, the resolution pre-detection module sets the resolution validity flag to 0; The sampling control module concatenates the original byte sequence of the problem area of ​​the DNS request message, the query type field, the source address field, and the resolution anomaly type identifier in the order of the fields to generate an anomaly sampling key. It then directly uses the anomaly sampling key to perform the deterministic hash sampling judgment and writes it into the structural anomaly sample cardinality estimation structure.

10. The intelligent protection system for DNS servers according to claim 1, characterized in that, Each processing module in the data plane is equipped with a double-buffered configuration area consisting of a first configuration area and a second configuration area. In the current measurement cycle, one configuration area of ​​the double-buffered configuration area is used to store parameters including the global dynamic protection threshold and the bit width reduction amount, while the other configuration area is used to receive the parameter configuration message for the next measurement cycle. After the current measurement cycle ends, each processing module atomically switches the current configuration area to another configuration area that has been written, based on the parameter version number and the effective period identifier.