A Website Fingerprint Adaptive Defense Strategy Switching Method Based on Attack Feedback
By adopting an adaptive defense strategy switching method based on attack feedback, the defense strategy is dynamically adjusted to adapt to the attacker's changes. This solves the problems of static strategies being vulnerable to attacks, random switching lacking feedback, and fixed rotation being difficult to balance in terms of overhead in existing technologies, and achieves a more efficient website fingerprinting defense effect.
Patent Information
- Application Number
- CN202611032116.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-13
- Publication Date
- 2026-11-10
AI Technical Summary
Existing website fingerprinting defense technologies suffer from several problems: static strategies are easily adapted to by attackers over a long period of time; random switching lacks feedback basis; fixed rotation makes it difficult to balance defense effectiveness and communication overhead; and the attacker adaptation process is not adequately modeled.
An adaptive defense strategy switching method based on attack feedback is adopted. Through traffic alignment coding, defense strategy pool construction, attack feedback detection, vulnerability fusion scoring, trend-aware switching judgment, and overhead constraint selection, the defense strategy is dynamically adjusted to cope with the attacker's adaptation process.
It improves the accuracy and timeliness of defense status perception, enhances the stability and resilience of website fingerprint defense in continuous attack scenarios, and achieves a balance between security, availability, and resource consumption.
Smart Images

Figure FT_1 
Figure FT_2 
Figure FT_3
Abstract
Description
Technical Field
[0001] This invention relates to a method for switching adaptive defense strategies based on website fingerprints of attack feedback, belonging to the field of network security technology. Background Technology
[0002] With the widespread use of HTTPS, Tor, VPN, proxy gateways, and private browsing technologies, network communication content is typically encrypted during transmission, making it difficult for attackers to directly read the content of web pages visited by users. However, the website access process still exposes side-channel characteristics at the encrypted traffic level, such as packet direction, packet length, packet arrival time, burst structure, and session duration. Website fingerprinting attacks exploit these side-channel characteristics to infer the types of websites visited by users. Attackers do not need to crack encryption algorithms or obtain plaintext content; they can train classification models solely based on the statistical patterns and temporal sequences of encrypted traffic, thus posing a threat to user privacy.
[0003] Existing website fingerprinting attack models have evolved from traditional machine learning methods to deep learning methods. For example, Deep Fingerprinting models based on convolutional neural networks, Var-CNN models based on variant convolutional structures, lightweight temporal classification models, and multi-model ensemble attackers can all learn stable website access patterns from encrypted packet sequences. Against this backdrop, website fingerprinting defense technologies typically alter traffic patterns through methods such as packet padding, packet delay, burst perturbations, fixed-rate transmission, or random padding, making it difficult for attack models to identify the original website fingerprint.
[0004] However, existing website fingerprinting defenses still have the following shortcomings: First, static defense strategies are easily adapted over the long term. A single defense strategy may reduce attack accuracy in the short term, but attackers can continuously collect traffic samples processed by that strategy and retrain the attack model. As the attack model gradually learns new traffic patterns under that strategy, the defense effectiveness will decline over time.
[0005] Second, random switching strategies lack attack feedback. Some methods increase uncertainty by randomly selecting different defense strategies, but random switching cannot determine whether the current strategy has failed or whether the attack risk is increasing. This can easily lead to problems such as ineffective switching, frequent switching, or the use of high-overhead strategies in low-risk situations.
[0006] Third, rotation strategies lack overhead constraints. While fixed rotation can avoid the long-term use of a single strategy, its switching order is unrelated to actual attack risks, bandwidth consumption, latency costs, and the strategy's historical performance. In actual deployments, excessive bandwidth consumption and long access latency can negatively impact user experience and reduce the availability of the defense system.
[0007] Fourth, existing methods often lack modeling of the attacker's adaptation process. Real attackers do not remain in the initial attack model state but continuously update the model using new samples. If defense assessments only consider the accuracy of a single attack before and after defense, without considering the change in accuracy as the attack model adapts, the effectiveness of the defense is easily overestimated.
[0008] Therefore, there is a need for an adaptive website fingerprinting defense strategy switching method that can combine attack feedback, long-term trends, overhead constraints, and attacker adaptation processes, so that the defense system can dynamically select strategies based on the current risk, rather than fixed, random, or blindly rotating strategies. Summary of the Invention
[0009] To address the technical problems existing in the prior art, this invention provides a website fingerprint adaptive defense strategy switching method based on attack feedback. This method can solve problems such as static strategies being easily adapted to by attackers over a long period of time, random switching lacking feedback basis, fixed rotation failing to balance defense effectiveness and communication overhead, and the attacker adaptation process not being fully modeled in existing website fingerprint defense technologies.
[0010] To achieve the above objectives, the technical solution adopted by this invention is a method for switching adaptive defense strategies based on website fingerprints according to attack feedback, comprising the following steps: S1. Traffic Alignment Encoding: Obtain encrypted traffic samples from website access, extract data packet direction, arrival time, packet length, and burst structure features, and after symbol encoding, time smoothing, and burst fragment fusion, uniformly convert them into fixed-length multi-channel traffic time series tensors. S2. Defense Strategy Pool Construction and State Initialization: Construct a candidate strategy pool containing at least two website fingerprinting defense algorithms, and establish a strategy state record for each defense strategy, including historical vulnerability, bandwidth overhead, latency overhead, cumulative number of uses, number of consecutive use rounds, and cooldown flag. S3, Execution of defense strategy: Read the defense strategy selected in the current round, perform defense transformation on the traffic time series tensor obtained in step 1, obtain the traffic sample after defense, and calculate the bandwidth overhead and latency overhead introduced by the current defense strategy. S4. Attack Feedback Detection: Input the post-defense traffic sample into the attack probe model to obtain the website category prediction probability, prediction tag, attack accuracy, attack confidence and attack loss, forming the attack feedback information for the current round. S5. Vulnerability Fusion Score: The attacker adaptation gain is calculated based on the difference in attack accuracy before and after attack probe adaptation training. The attack confidence is corrected by combining prediction entropy. The attack accuracy, corrected confidence, attacker adaptation gain, and loss change are fused to obtain the basic vulnerability. The bandwidth / budget overrun penalty is superimposed to obtain the overhead-aware vulnerability score. S6. Trend Awareness Switching Determination: Construct a multi-round vulnerability sliding risk window, calculate the risk trend slope and exponentially smoothed risk value; when any of the following conditions are met, such as vulnerability threshold exceeding the limit, risk continuing to rise, strategy continuous use exceeding the limit, or emergency risk triggering, it is determined that the defense strategy needs to be switched and the reason for the switch is recorded. S7. Overhead Constraint Strategy Selection: When a switchover is triggered, a set of effective candidates is first obtained by filtering based on bandwidth, hard upper limit of latency, and cooling mark; based on historical risk, normalized bandwidth and latency overhead, strategy diversity benefits, and reuse penalty, the comprehensive score of each candidate strategy is calculated, and the strategy with the minimum score is selected as the next round of defense strategy; if there are no effective candidates, the constraints are relaxed in stages and a downgraded strategy is executed. S8. Attacker Adaptation Training and State Consolidation: Construct a training set by fusing current defense samples, historical replay samples, and baseline clean samples, and add parameter drift constraints to train attack probes; set different training rounds to distinguish between policy switching and non-switching scenarios; save the complete attack and defense state record of this round, and update the state vectors of all policies in the candidate policy pool to complete the closed loop of this round and enter the next iteration.
[0011] Preferably, step S1, when performing traffic alignment encoding, includes the following steps: S11. Direction symbol encoding: Data packets from the client to the server are encoded as 1, and data packets from the server to the client are encoded as -1, thus obtaining the direction sequence; S12, Time Smoothing Coding: Calculates the time interval between adjacent data packets, using... Smoothly eliminate extreme time delay interference, among which, Represents the natural logarithm function. This is used to prevent negative values caused by abnormal timestamps from being included in logarithmic calculations. This represents the smoothed time interval characteristics; S13. Enhance the burst structure of consecutive same-direction packets, merge consecutive same-direction data packets into burst fragments, and record the number of burst fragments, the number of data packets, the total number of bytes in the data packets, the duration of the burst fragments, and the direction of the burst fragments; S14. Fixed-length multi-channel tensor output: The direction sequence, time interval sequence and burst structure features are concatenated into channels to form a multi-channel flow representation. If the sequence length is too long, truncation / pooling is used for dimensionality reduction. If the sequence length is too short, zero-value padding is used. The final output is a real tensor with size c×L, where c is the number of channels and L is the uniform sequence length.
[0012] Preferably, in step S2, the candidate defense strategy pool includes at least two of the following: Glue, WTF-PAD, Front, RandomPadding, Constant Rate, and PEZD; each defense strategy corresponds to an independent defense transformation function. This allows defense strategies to be dynamically selected based on attack feedback; Where X represents the traffic to be processed. Adjustable parameters for the defense strategy include the number of padding packets, padding probability, delay range, burst disturbance ratio, fixed transmission rate, or window length. Policy state updates are based on historical feedback and include the following: S21. Historical vulnerability updates are performed using an exponential moving average method: ,in, For the updated historical average vulnerability, The historical average vulnerability before the update, This represents the update coefficient. Score the vulnerability of the current round; S22. Historical cost update, historical average bandwidth cost update adopts: , Historical average latency overhead is updated using: , in, and These are the updated historical bandwidth overhead and historical latency overhead, respectively. and These are the historical overhead records before the update. For bandwidth overhead, For latency overhead; S23. Exposure and Cooling Status Update: When the policy vulnerability, overhead, or number of consecutive use rounds exceed the corresponding cooling threshold, the cooling status is marked and automatically removed when the cooling period expires.
[0013] Preferably, the attack probe feedback calculation in step S4 includes, S41, Website Category Probability Prediction Input the attack probe model and get ,in, Let i be the class prediction probability vector for the i-th sample in the r-th round. For the attack probe model, For normalized exponential functions, This represents the flow characteristics of the i-th sample in the r-th round after it has undergone defense. S42. The formula for generating predicted labels is: , To select the category index with the highest probability in the website category dimension, The website category predicted by the attack probe for the i-th defended sample; S43, Attack accuracy calculation formula ,in Let r be the accuracy of the attack in round r. For indicator functions; S44. Calculation of attack confidence and attack loss: First, calculate the confidence level. Then calculate the attack damage: ,in, For attack confidence, For the damage caused by the attack, The predicted probability corresponding to the true category; S45. Multi-attack probe integrated feedback: If multiple attack probe models are used, then the calculation is as follows: Where h is the h-th attack probe model, Integrate weights for it, and .
[0014] Preferably, the attack feedback-driven vulnerability fusion score in step S5 includes: S51. Attacker adaptation gain calculation, first calculate: , in, To adapt the attack probe to the attack accuracy level before training, To adapt the attack probe to the attack accuracy after training. This represents the accuracy gain that the attacker gains after continuing to learn under the current defense strategy; S52. Confidence entropy correction, calculation of prediction entropy: , Average prediction entropy: And obtain the corrected confidence level: , Where C represents the total number of website categories; S53. Basic vulnerability scoring, constructing the vulnerability scoring calculation formula: , Among them, alpha, beta, eta, and kappa are non-negative weights. As a result of the losses from the previous attack, This represents the losses from the current round of attacks; S54. Overhead-aware vulnerability score, calculating deployment cost: , in, For bandwidth budget, For delay budget, and Weighting for penalties for exceeding spending limits.
[0015] Preferably, the trend perception switching determination method in step S6 is as follows: S61. Take the most recent k rounds of vulnerability scores to form a risk window. Where k represents the length of the sliding window, This represents the risk trajectory of the current strategy or strategy sequence in recent offensive and defensive interactions. S62. Calculate the window risk trend slope using the least squares method. , >0 indicates that the risk is continuing to rise; S63. Exponential smoothing auxiliary judgment, calculation of smoothing exponent: ,in, For the risk of the r-th round of exponential moving average, For smoothing coefficients; S64. Switching trigger conditions include: when the following conditions are met... ,or and ,or ,or The switching is triggered when any of the following conditions are met: Here, m represents the standard vulnerability threshold, 'm' represents the active switching trend boundary, and 'delta' represents the threshold buffer zone. Q represents the number of consecutive rounds the current strategy can be used, and Q represents the maximum number of consecutive rounds. Emergency threshold; S65, Switch reason output. If by If triggered, the output threshold will trigger; if triggered by and If triggered, the output trend will be triggered; if triggered by If triggered, the output will continuously use the trigger; if by If triggered, output "Emergency Trigger" and switch the cause. It is written into the historical status record for subsequent auditing and parameter tuning.
[0016] Preferably, in step S7, the next round strategy selection under overhead constraints: when the output triggers a switching signal, the next round strategy is selected from the candidate defense strategy pool, including the following steps: S71. Hard-overhead filtering: constructing an effective candidate strategy set. and and ,in, The expected bandwidth cost of candidate strategy d is... The expected latency cost of candidate strategy d is... Hard bandwidth limit As a hard limit on latency, This refers to the cooling state of strategy d; S72. Calculate the normalization cost: ,in To normalize the expense items, The maximum expected bandwidth overhead in the candidate policy pool. The maximum expected latency cost in the candidate policy pool. and The relative weights of bandwidth and latency; S73, Calculate the benefits of strategy diversity: ,in, The number of times candidate strategy d has been used in the most recent rounds; S74. Calculate the switching penalty: , Where P(d) is the switching penalty term, To continue using the penalty or reward coefficient of the current strategy, The penalty coefficient for recently reused strategies; RecentStrategies is the set of recently used strategies. S75. Overall Score Calculation and Strategy Selection: Calculate the overall score. , Where R(d) is the historical risk estimation term, , , and For weighting coefficients; select As the next round of defense strategy.
[0017] Preferably, in step S7, when there are no valid candidate strategies that satisfy the hard overhead constraint, a downgrade selection mechanism is executed: S76. Constraint conflict detection, if If the value is empty, the current round is determined to be in a constraint conflict state, and the conflict type is recorded; the conflict type includes at least one of bandwidth constraint conflict, delay constraint conflict and policy cooling conflict.
[0018] S77. Gradually relax constraints, first relax hard delay constraints. But maintain a hard bandwidth constraint If no strategy is available, the strategy with the lowest cost overrun is allowed to be selected, but the state of this round is marked as a degraded running state.
[0019] S78. Calculate the selection of degradation strategy: , in, and For hard constraint conflict penalty weights, Will As the next round of defense strategy, conflict constraint information will be written into the historical state record.
[0020] Preferably, step 8, which involves attacker adaptation training, state recording, and closed-loop solidification, includes the following steps: S81. Constructing the training set: ,in, This is the sample after the current round of defense. This is a sample for replaying historical defenses. For undefended or baseline samples; S82. Construct training objectives: Where CE is the cross-entropy loss and rho is the parameter drift constraint coefficient. These are the probe parameters from the previous attack. It is an L2 norm; S83. When no strategy switch occurs in the current round, use fewer training rounds. Perform fine-tuning with the same strategy; when a strategy switch occurs in the current round, use a larger number of training rounds. Retraining after switching, where Greater than ; S84. Save historical status records: , Where r is the round number, As the current strategy, For attack accuracy, For attack confidence, To adapt to gain, Vulnerability scoring, For bandwidth overhead, For latency overhead, The trend slope To decide whether to switch, For the next round of strategy, Reason for switching; S85, according to Update the state vector in the candidate policy pool The historical state records are used for subsequent vulnerability scoring, trend judgment, strategy selection, experiment reproduction, and deployment auditing, thus forming a closed loop of attack feedback, strategy selection, attacker adaptation, and state updates.
[0021] Preferably, the overall closed-loop optimization objective of this method is: , in, The defense scheduling strategy is jointly formed by trend-aware switching judgment and cost-constrained strategy selection, where R is the total number of attack and defense interaction rounds. For the vulnerability score in round r, For the bandwidth overhead of the r-th round, For the delay overhead of the r-th round, This is an indicator that takes a value of 1 when a policy switch occurs and a value of 0 otherwise. , and These represent the weights of bandwidth overhead, latency overhead, and switching cost, respectively.
[0022] Compared with the prior art, the present invention has the following technical effects: 1) This invention introduces an attack probe model to continuously evaluate post-defense traffic, obtaining feedback information such as website category prediction probability, attack accuracy, attack confidence, and attack loss, which are further integrated to form a vulnerability score. Compared to traditional static website fingerprinting defense methods, this invention no longer relies solely on preset rules or fixed defense parameters, but can dynamically perceive whether the defense strategy is at risk of failure based on the attacker's ability to identify the current defense strategy, thereby improving the accuracy and timeliness of defense status perception.
[0023] 2) This invention combines risk-triggered, trend-triggered, and proactive triggering to construct a strategy switching determination mechanism for multi-round attack and defense processes. When the current vulnerability score exceeds a threshold, the system can trigger risk switching in a timely manner; when the multi-round score shows a continuous upward trend, the system can identify signs of attacker adaptation in advance; when a certain defense strategy is used continuously for too long, the system can proactively switch strategies to avoid long-term fixed traffic distribution. Therefore, this invention can achieve proactive perturbation while passively responding to risks, improving the stability and adaptability of website fingerprint defense in continuous attack scenarios.
[0024] 3) This invention introduces an overhead constraint and budget-aware strategy selection mechanism. It comprehensively considers historical risk, bandwidth overhead, latency overhead, strategy diversity benefits, and handover penalties from the candidate defense strategy pool, selecting the defense strategy that satisfies the overhead constraint and has the lowest overall score as the next round strategy. This mechanism avoids the problem of excessive communication overhead caused by solely pursuing security, and also reduces system oscillations caused by frequent handovers. It achieves a more reasonable balance between security, availability, and resource consumption in the defense system, thereby improving the engineering applicability of this invention in practical anonymous communication traffic protection scenarios. Attached Figure Description
[0025] Figure 1 This is the overall flowchart of the present invention.
[0026] Figure 2 This is a flowchart of the trend-aware switching determination process of the present invention.
[0027] Figure 3 This is a flowchart illustrating the overhead constraint strategy selection process of the present invention.
[0028] Figure 4 This is a multi-round visualization diagram of the present invention. Detailed Implementation
[0029] To make the technical problems to be solved, the technical solutions, and the beneficial effects of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present invention and are not intended to limit the present invention.
[0030] like Figures 1 to 4 As shown, a website fingerprint adaptive defense strategy switching method based on attack feedback includes eight steps: traffic alignment encoding, candidate defense strategy pool construction, initial defense strategy execution, attack feedback detection, vulnerability fusion scoring, trend-aware switching determination, cost-constrained strategy selection, attacker adaptation training, and historical state solidification output. These steps are described in detail below: I. Flow Alignment Coding Multi-channel aligned encoding and availability enhancement for encrypted traffic from website access: The sequence of raw encrypted traffic packets for the i-th website access session is denoted as... ,in, , Total number of access session samples; For the first Number of data packets in each access session; , For the first In the first access session The length of each data packet; , For the first In the first access session The transmission direction of each data packet; , For the first In the first access session The arrival time of each data packet. To ensure that different access sessions can enter a unified attack feedback detection model and defense strategy scheduling model, this step includes the following steps: S11, based on symbolic encoding of communication direction, addresses the characteristic of website fingerprinting attacks that primarily classify uplink and downlink packet sequence patterns. First, it preserves the transmission direction of each data packet instead of its plaintext content; when... , When indicating the direction from the client to the server, the direction is encoded as... , ;when , When indicating the direction from server to client, the direction is encoded as... , This yields the direction sequence. ; in, , Used to characterize the The directional attribute of each data packet in bidirectional communication takes values of 1 and -1, corresponding to outbound and inbound directions, respectively. This processing does not involve plaintext access and can retain directional characteristics commonly used in website fingerprint attacks under encrypted traffic environments. in, , This is used to characterize the directional attribute of the t-th data packet in bidirectional communication, with values of 1 and -1 corresponding to outbound and inbound directions, respectively. This processing does not involve plaintext access and can retain directional features commonly used in website fingerprint attacks under encrypted traffic environments.
[0031] S12, based on time-smoothing coding of arrival intervals, then calculates the arrival time interval between adjacent data packets. , , , ,in , Indicates the first The data packet and the first The time difference between the arrival of each data packet; Considering the jitter and abnormally long latency in real network environments, a smoothing approach is adopted for the time interval: ,in Represents the natural logarithm function. This is used to prevent negative values caused by abnormal timestamps from being included in logarithmic calculations. , This represents the smoothed time interval feature. This process can reduce the impact of extreme time delays on the model input, making the time features more stable.
[0032] S13, based on the burst structure enhancement of consecutive in-direction packets, further merge consecutive in-direction data packets into burst fragments: ; in For the first Number of burst segments in each access session; each burst segment , , This indicates the number of data packets contained in the burst segment. , This indicates the total number of bytes in the data packets of this burst segment. , Indicates the duration of the sudden segment. , Indicates the direction of the sudden segment; Bursting structures are used to describe local communication patterns formed by continuous requests or responses during webpage loading, so that traffic representation includes not only single-packet level information, but also local temporal structure information.
[0033] S14, fixed-length multi-channel tensor output, finally converting the direction sequence Time interval sequence and sudden structural features Channel splicing is performed to form a multi-channel flow representation: , when When the sequence length is greater than the preset length L, dimensionality reduction is performed using truncation, pooling, or resampling; when the sequence length is less than L, zero-value padding is used; the final output... Where R represents the real number field, c represents the number of channels, and L represents the uniform sequence length; the fixed-length tensor obtained in this step It serves as a unified input for subsequent defense transformations, attack detection, and vulnerability scoring.
[0034] II. Construction of Candidate Defense Strategy Pool, Strategy Classification and State Initialization The pool of candidate defense strategies is denoted as: Where m is the number of candidate defense strategies. This represents the j-th candidate defense strategy. Each candidate defense strategy... Corresponding to a defense transformation function Where X represents the traffic characteristic to be processed. Representation strategy Adjustable parameters. To enable the defense strategy to be dynamically selected based on attack feedback, this step includes the following steps.
[0035] S21, Candidate Strategy Set Definition: First, at least two of Glue, WTF-PAD, Front, Random Padding, ConstantRate, and PEZD are included in the candidate defense strategy pool D. For each candidate strategy... Establish its defense transformation function ,in This can include the number of padding packets, padding probability, delay range, burst disturbance ratio, fixed transmission rate, or window length. Different defense methods are represented as a unified function. The system can invoke different types of website fingerprinting defense strategies under the same scheduling framework.
[0036] S22. Candidate strategy type classification: Based on the security benefits and communication overhead of the strategy, candidate strategies are classified into strong defense strategies, balanced defense strategies, and low-overhead defense strategies. Strong defense strategies prioritize reducing attack accuracy when the attack risk is high; low-overhead defense strategies prioritize reducing bandwidth or latency burden when network resources are limited; and balanced defense strategies aim to strike a trade-off between security and communication costs. This classification is not a fixed selection rule, but rather a candidate strategy attribute used in subsequent comprehensive scoring.
[0037] S23, Establish the policy state vector for each candidate policy. Establish the policy state vector: ,in Representation strategy Historical average vulnerability This represents the historical average bandwidth cost. This represents the historical average latency cost. Indicates the total number of times it has been used. Indicates the most recent round in which it was used. Indicates the current consecutive rounds used. This indicates the cooling-off state. This state vector is used to record the risks, costs, and exposure levels of the strategy in historical offensive and defensive interactions.
[0038] S24, Policy initial state setting, finally initializing the policy state vector. For policies that have not undergone pre-experiment evaluation, you can let... , , ,in , and To unify default values, for strategies that have already passed pre-experiment measurements, their pre-experiment vulnerability, pre-experiment bandwidth overhead, and pre-experiment latency overhead can be respectively set as... , and The initial value; At the same time , , , This initialization provides a comparable risk and cost baseline for different candidate strategies when they first participate in scheduling.
[0039] Policy state update based on historical feedback: After the r-th round of attack and defense interaction ends, the system updates the state vector of the policy being used based on the attack feedback and communication overhead of the current round. Let the policy used in the r-th round be... The current round's vulnerability score is The bandwidth overhead is The latency overhead is This step includes the following steps.
[0040] S25, Historical Vulnerability Update, updated using an exponential moving average method. : ,in This indicates the updated historical average vulnerability. This represents the historical average vulnerability before the update, and tau∈(0,1] represents the update coefficient. The larger the tau, the more the system values the latest attack feedback; the smaller the tau, the more the system values long-term historical performance. S26, Historical cost update, the historical average bandwidth cost and historical average latency cost are updated in the following way: , ,in and These represent the updated historical bandwidth overhead and historical latency overhead, respectively. and These represent historical overhead records before the update. This update method allows the policy state to reflect changes in communication costs in the real-world operating environment. S27, Exposure and Cooldown Status Update. (If the strategy...) If used in the current round, then let And order ;like The strategy is the same as the previous round, then ,otherwise When strategy satisfy ,or ,or ,or At that time, Set to 1, where Indicates the cooling vulnerability threshold. Indicates the cooling bandwidth threshold. Indicates the cooling delay threshold. This indicates the maximum number of consecutive uses. After a preset number of cooling cycles... Restored to 0.
[0041] III. Defense Transformation Execution and Communication Overhead Measurement Let the defense strategy selected in round r be... Its corresponding defense transformation function is r, the strategy parameter is ,r; The i-th flow rate output in step 1 is represented as To obtain both the post-defense sample and deployment cost, this step includes the following steps.
[0042] S31, Current defense strategy read: First, determine the current strategy based on the strategy selection result or initialization strategy output in the previous round. And read the defense function corresponding to the strategy. r and parameters If this is the first round, the strategy will be determined based on the initial strategy configuration or the strategy with the lowest estimated risk. ; S32, the defense transformation is executed, and then it is executed on the i-th sample: ,in ,r represents the flow representation of the i-th sample in the r-th round after defense. ,r represents the defense function corresponding to the current strategy, ,r represents the parameter used by the strategy in the current round, and the defense transformation includes one or more of the following: fake packet stuffing, transmission delay, burst boundary perturbation, fixed rate transmission, or random stuffing; S33, combined defense processing: When the current strategy consists of multiple defense sub-functions, the defense process is represented as follows: ,in , and These represent different defense sub-functions. , and These represent the corresponding parameters. This combined expression allows the system to superimpose multiple traffic perturbation methods in the same round, thereby increasing the difficulty for attackers to adapt. S34, bandwidth overhead metric, further calculates the average bandwidth overhead for the current round: ,in This represents the byte count function, where N represents the current number of evaluation samples, and epsilon is a positive integer to prevent the denominator from being zero. Used to measure the additional traffic burden introduced by the defense strategy.
[0043] S35, latency overhead metric, finally calculate the average latency overhead for the current round: ,in This function represents the session completion delay statistics. Used to measure the impact of defense strategies on access completion time, through and This step outputs both the defense execution results and communication costs simultaneously.
[0044] IV. Attack Probe Feedback Calculation Let the sample set after the r-th round of defense be denoted as . Its actual website tag set is denoted as The attack probe model is denoted as , where theta are model parameters. To obtain attack feedback that can be used for defense scheduling, this step includes the following steps: S41, Website Category Probability Prediction. First, ... Inputting the attack probe model with r, we get: ,in ,r represents the class prediction probability vector of the i-th sample in the r-th round. Let r,c represent the probability that the sample belongs to the c-th website category. This represents the normalized exponential function; S42, Predicted Label Generation. The predicted labels are obtained using the following formula: ,in This indicates that the category index with the highest probability is selected based on the website category dimension. r represents the website category predicted by the attack probe for the i-th defended sample; S43, Attack Accuracy Calculation. Calculate attack accuracy: ,in This represents the accuracy rate of the r-th attack round. This indicates an indicator function that takes the value 1 when the predicted label equals the true label, and 0 otherwise. The higher the value, the easier it is for the website fingerprint to be identified under the current defense strategy; S44, Calculation of attack confidence and attack loss: Calculate the confidence level and attack loss. ,in Indicates the attack confidence level. Indicates damage caused by the attack. ,r, This represents the predicted probability corresponding to the true category. A higher value indicates a more certain prediction from the attack model. A lower value indicates that the attack model fits the true class better; S45, Multi-Attack Probe Integrated Feedback. If multiple attack probe models are used, then the calculation is as follows: Where h represents the h-th attack probe model, Indicates its integration weight, and By integrating multiple probes, the feedback bias caused by a single attack model can be reduced.
[0045] V. Attack Feedback-Driven Vulnerability Fusion Scoring In round r, the system has obtained the attack accuracy. Attack confidence Attack losses Bandwidth overhead and latency overhead To determine whether the current defense strategy is still effective, this step integrates multiple feedback metrics into a unified vulnerability score, including the following steps.
[0046] S51, Attacker Adaptation Gain Calculation, First Calculation: ,in This indicates the attack accuracy of the attack probe before training. This indicates the attack accuracy of the attack probe after training. This represents the accuracy gain that the attacker achieves after continuing to learn under the current defense strategy. The larger the value, the easier it is for the attacker to adapt the strategy; S52, Confidence entropy correction, then calculate prediction entropy: , The average prediction entropy is: And obtain the corrected confidence level: Where C represents the total number of website categories, if the attack model has high confidence and low prediction entropy, then The high value indicates that the sample still retains a clearly identifiable fingerprint after the current defense. S53, Basic Vulnerability Score, Constructing the Vulnerability Score Calculation Formula: Where alpha, beta, eta, and kappa are non-negative weights. This indicates the losses from the previous attack. Indicates the losses in the current round of attacks; when Below When this occurs, it indicates that the attack model's learning effect has improved, and the risk score has increased accordingly; S54, the overhead-aware vulnerability score, is calculated when deployment costs need to be considered: ,in Indicates bandwidth budget, Indicates the delay budget. and This represents the penalty weight for exceeding the overhead limit. This formula allows the system to evaluate not only whether the defense is secure, but also whether the defense is deployable.
[0047] VI. Trend-aware switching determination based on sliding window The most recent k rounds of vulnerability scores form a risk window: , where k represents the sliding window length. To avoid frequent switching based solely on single-round fluctuations, while also being able to respond promptly to attackers' continuous adaptation, this step includes the following steps: S61, Risk Window Construction: First, save the vulnerability scores from the most recent k rounds in chronological order to form... When the number of historical rounds is less than k, a temporary window can be constructed using the scores of existing rounds. Used to represent the risk change trajectory of the current strategy or strategy sequence in recent offensive and defensive interactions; S62, Trend Slope Calculation: The risk trend slope is calculated using: Where j represents the relative position number within the window, and mean(j) represents the mean value of the window position. This represents the average score within the window. Indicates an upward or downward trend in risk. A value greater than 0 indicates an overall increase in risk. The larger the value, the faster the attacker can adapt. S63, Exponential smoothing auxiliary judgment, further calculates the smoothing exponent: ,in This represents the risk of the exponential moving average in round r. This represents the smoothing coefficient; if V_r increases in a single round but... If stable, it is considered to be a random fluctuation; if , and If both increase simultaneously, the risk increase is considered to be persistent; S64, switch condition judgment, finally when the condition is met. ,or and ,or ,or The switching is triggered when any of the conditions in the table are met, where T_v represents the regular vulnerability threshold, m represents the active switching trend boundary, and delta represents the threshold buffer interval. This represents the number of consecutive rounds the current strategy has been used, and Q represents the maximum number of consecutive rounds. Indicates the emergency threshold; S6.5, switch the cause output, if by If triggered, the output threshold will trigger; if triggered by and If triggered, the output trend will be triggered; if by If triggered, the output will continuously use the trigger; if by If triggered, output "emergency trigger"; switch reasons. It is written into the historical status record for subsequent auditing and parameter tuning; VII. Next-round strategy selection under cost constraints When the output triggers a switching signal, the system selects the next round of strategy from the candidate defense strategy pool D. To avoid choosing strategies with unacceptable costs or recent recurrence, this step includes the following steps: S71, hard-overhead filtering, first constructs a set of effective candidate policies: Where B(d) represents the expected bandwidth cost of candidate policy d, and L(d) represents the expected latency cost of candidate policy d. Indicates the hard limit of bandwidth. Indicates the hard limit of latency. This indicates the cooling state of strategy d; S72, normalized cost calculation, then calculate the normalized cost: Where O(d) represents the normalization expense term, This represents the maximum expected bandwidth overhead in the candidate policy pool. This represents the maximum expected latency cost in the candidate policy pool. and Indicates the relative weights of bandwidth and latency; S73, Calculation of Strategy Diversity Benefits: Further calculation of strategy diversity benefits: Where RecentUse(d) represents the number of times candidate strategy d has been used in the most recent rounds. The fewer the recent uses, the larger M(d), indicating that the strategy can provide higher strategy diversity benefits; S74, calculate the switching penalty: Where P(d) represents the switching penalty term, This indicates the penalty or reward coefficient for continuing to use the current strategy. Represents the penalty coefficient for recently reused strategies; RecentStrategies represents the set of recently used strategies. S75, Overall Score Calculation and Strategy Selection, finally calculating the overall score: Where R(d) represents the historical risk estimation term, , , and These are the weighting coefficients; choose: As a next-round defense strategy, this selection process enables the system to prioritize low-risk, low-cost strategies that are not easily adapted in the long term, while meeting overhead constraints.
[0048] When no effective candidate strategy that satisfies the hard overhead constraint exists, a fallback selection mechanism is also included: S76, Constraint Conflict Detection, if If the value is empty, the current round is determined to be in a constraint conflict state, and the conflict type is recorded; the conflict type includes at least one of bandwidth constraint conflict, delay constraint conflict and policy cooling conflict; S77, tiered relaxation of constraints, first relaxing hard delay constraints. But maintain a hard bandwidth constraint If no strategy is available, the strategy with the lowest cost overrun is allowed to be selected, but the state of this round is marked as a degraded running state. S78, downgrade strategy selection calculate: ,in and This is the weight for penalizing hard constraint conflicts. As the next round of defense strategy, conflict constraint information will be written into the historical state record.
[0049] 8. Attacker adaptation training, state recording and closed-loop solidification.
[0050] To simulate the process by which a real attacker continuously learns from post-defense samples and to enable subsequent strategy selections to utilize historical feedback, this step includes the following steps: S81, adapting to training set construction, first constructs the training set: , in This represents the sample after the current round of defense. This indicates a sample to be replayed after historical defense. This indicates an undefended or baseline sample. Used to learn the latest defense patterns Used to preserve historical defense knowledge Used to maintain the ability to identify the basic category characteristics of a website; S82, adapt to the construction of the training objective, and then construct the training objective: Where CE represents the cross-entropy loss and rho represents the parameter drift constraint coefficient. This indicates the probe parameters from the previous attack round. denoted by the L2 norm, this objective is used to constrain attack probes from deviating excessively from their historical attack capabilities when learning new defense samples; S83, Training Intensity Selection: When no strategy switch occurs in the current round, fewer training rounds are used. Perform fine-tuning with the same strategy; when a strategy switch occurs in the current round, use a larger number of training rounds. Retraining after switching, where Greater than By distinguishing between fine-tuning and retraining, the different adaptation costs of attackers when facing the same strategy and new strategies are simulated. S84, Historical State Record, saves historical state records: Where r represents the round number, Indicates the current strategy. Indicates attack accuracy. Indicates the attack confidence level. Indicates adaptive gain. Indicates vulnerability score, Indicates bandwidth overhead. Indicates latency overhead. Indicates the slope of the trend. Indicates whether to switch. Indicates the strategy for the next round. Indicate the reason for switching; S85, closed-loop curing, finally according to Update the state vector in the candidate policy pool The historical state records are used for subsequent vulnerability scoring, trend judgment, strategy selection, experiment reproduction, and deployment auditing, thus forming a closed loop of attack feedback, strategy selection, attacker adaptation, and state updates.
[0051] The overall closed-loop optimization objective of the method of this invention is: Where pi represents the defense scheduling strategy jointly formed by trend-aware switching judgment and cost-constrained strategy selection, and R represents the total number of attack and defense interaction rounds. This represents the vulnerability score in round r. This represents the bandwidth cost in round r. I( represents the delay overhead in round r) This indicates an indicator that takes a value of 1 when a policy switch occurs and a value of 0 otherwise. , and These represent the weights of bandwidth overhead, latency overhead, and handover cost, respectively. This overall objective is used to illustrate how this method simultaneously optimizes defense effectiveness, communication cost, and handover stability in long-term attack-defense interactions.
[0052] IX. Experimental Testing The system includes a traffic encoding module, a defense strategy pool management module, a defense execution module, an attack feedback detection module, a vulnerability scoring module, a trend-aware switching module, a cost-constraint strategy selection module, and an attacker adaptation and historical state management module.
[0053] The system comprises the following modules: a traffic encoding module receives raw encrypted access traffic and converts packet direction, time interval, and burst structure into a multi-channel tensor of uniform length; a defense strategy pool management module maintains a set of candidate defense strategies and their state vectors; a defense execution module calls defense functions in the candidate strategy pool to pad, delay, burst-perturb, or rate-shape traffic samples; an attack feedback detection module runs an attack probe model and outputs attack accuracy, attack confidence, and attack loss; and a vulnerability scoring module calculates vulnerability based on attack feedback and overhead. or The trend-aware switching module is used for calculation. , The module determines whether a switchover should be triggered; the overhead-constrained policy selection module calculates Score(d) and selects the next round's policy; the attacker adaptation and historical state management module performs fine-tuning of the same policy or retraining after a switchover, and saves the results. and updates .
[0054] Deploying the above methods on a single server is suitable for offline experimental evaluation, centralized proxy defense, and laboratory reproduction experiments. In another system implementation, the traffic encoding module and defense execution module are deployed on the client or gateway side, while the attack feedback detection module, vulnerability scoring module, and policy selection module are deployed on the control end. Only statistical characteristics, policy instructions, and status summaries are transmitted between the client and the control end, thereby reducing the risk of leakage of original access content.
[0055] Experiment 1: Website Fingerprint Adaptive Defense Experiment Based on 30 Rounds of Attack and Defense Interaction To verify the effectiveness of this invention, an encrypted access traffic dataset containing multiple website categories was constructed, and the samples were divided into training, validation, test, and reserve sets. Candidate defense strategies included Glue, WTF-PAD, Front, Random Padding, Constant Rate, and PEZD. The attack probe model employed a Deep Fingerprinting model or its equivalent convolutional attack model. After initial training, multiple rounds of attack-defense interaction were performed on the defense samples. Each round executed the defense strategy, attack feedback detection, vulnerability scoring, trend switching determination, cost-constrained strategy selection, and attacker adaptation training. In one specific experimental setting, the number of dynamic attack-defense interaction rounds was set to 30. The reason for setting 30 rounds is that the first 10 rounds can reflect the short-term effects of the defense strategy before the attacker has fully adapted; the first 20 rounds can reflect the medium-term changes after the attacker gradually learns the defense samples; and the first 30 rounds can observe the stability and cost performance of the strategy switching mechanism in longer attack-defense interactions. Setting only 10 rounds could underestimate the attacker's long-term adaptability; setting too many rounds, such as 50 or 100, would significantly increase training time and computational cost with existing experimental resources, and might shift the focus of the experiment from validating the effectiveness of policy switching to ultra-long-term deployment simulation. Therefore, 30 rounds strikes a reasonable balance between calculable cost and long-term adaptive observation.
[0056] Experiment 2: Observation of Training Stability and Overfitting Risk To ensure the credibility of attack feedback, training set loss, validation set loss, training set accuracy, and validation set accuracy are recorded during the attack probe model training phase. When the training set accuracy is significantly higher than the validation set accuracy, and the validation set loss continues to rise, overfitting is considered possible. When both training and validation losses decrease and stabilize, and the difference between training and validation set accuracy is small, overfitting is considered not to have occurred during training. Furthermore, if the training logs do not show NaN, Inf, or gradient norms abnormally close to 0, and the loss continues to decrease, it indicates that no significant gradient vanishing or numerical instability issues have been observed.
[0057] In this experiment, the attack probe model employs convolutional structures, batch normalization, nonlinear activation, and Dropout to reduce overfitting risk and enhance training stability. Observation of the training process curves shows that the training loss and validation loss trends are consistent, and the validation accuracy does not exhibit a long-term decline. This indicates that the model can serve as a stable attack feedback probe, providing reliable feedback for subsequent defense strategy switching.
[0058] Experiment 3: Comparison of different scheduling strategies To verify the advantages of this invention over random switching, blind rotation, and static defense strategies, the following comparison methods were used: the random switching method randomly selects the next strategy from the candidate strategy pool; the blind rotation method rotates strategies in a fixed order; and the static defense method uses the same defense strategy throughout the entire attack and defense process. The method of this invention dynamically selects strategies based on attack feedback, risk trends, and cost constraints.
[0059] Table 1. Experimental results of an adaptive defense strategy switching method based on attack feedback for websites.
[0060] As shown in Table 1, the method of this invention achieves a low average vulnerability under 30 rounds of long-term attack and defense interaction, lower than random switching, blind rotation, and various static defense strategies. Compared with random switching, this invention does not rely on uncertainty without feedback, but selects a strategy based on attack feedback and trend judgment, thus avoiding the misselection of a weak defense strategy by random strategies under high-risk conditions. Compared with blind rotation, this invention can select a more suitable strategy for the next round based on cost constraints and historical risks. Compared with static strategies, this invention reduces the chance of attackers adapting to a single defense pattern over a long period through the switching mechanism.
[0061] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included within the scope of the present invention.
Claims
1. A method for switching adaptive defense strategies based on website fingerprints of attack feedback, characterized in that: Includes the following steps, S1. Traffic Alignment Encoding: Obtain encrypted traffic samples from website access, extract data packet direction, arrival time, packet length, and burst structure features, and after symbol encoding, time smoothing, and burst fragment fusion, uniformly convert them into fixed-length multi-channel traffic time series tensors. S2. Defense Strategy Pool Construction and State Initialization: Construct a candidate strategy pool containing at least two website fingerprinting defense algorithms, and establish a strategy state record for each defense strategy, including historical vulnerability, bandwidth overhead, latency overhead, cumulative number of uses, number of consecutive use rounds, and cooldown flag. S3, Execution of defense strategy: Read the defense strategy selected in the current round, perform defense transformation on the traffic time series tensor obtained in step 1, obtain the traffic sample after defense, and calculate the bandwidth overhead and latency overhead introduced by the current defense strategy. S4. Attack Feedback Detection: Input the post-defense traffic sample into the attack probe model to obtain the website category prediction probability, prediction tag, attack accuracy, attack confidence and attack loss, forming the attack feedback information for the current round. S5. Vulnerability Fusion Score: The attacker's adaptation gain is calculated based on the difference in attack accuracy before and after attack probe adaptation training. The attack confidence is corrected by combining the prediction entropy. The basic vulnerability is obtained by fusing the attack accuracy, corrected confidence, attacker adaptation gain, and loss change. A cost-perceived vulnerability score is obtained by overlaying bandwidth / budget over-limit penalties. S6. Trend perception switching judgment: Construct a multi-round vulnerability sliding risk window and calculate the risk trend slope and exponential smoothing risk value; When any of the following conditions are met: vulnerability threshold exceeds limit, risk continues to rise, strategy is used beyond limit for continuous use, or emergency risk is triggered, it is determined that the defense strategy needs to be switched and the reason for the switch is recorded. S7. Overhead Constraint Strategy Selection: When a switchover is triggered, a valid candidate set is first obtained by filtering based on bandwidth, hard upper limit of latency, and cooling mark; based on historical risk, normalized bandwidth and latency overhead, strategy diversity benefits, and reuse penalty, the comprehensive score of each candidate strategy is calculated, and the strategy with the minimum score is selected as the defense strategy for the next round. When there are no valid candidates, the constraints are relaxed at different levels, and a downgraded selection strategy is implemented. S8. Attacker Adaptation Training and State Consolidation: Construct a training set by fusing current defense samples, historical replay samples, and baseline clean samples, and add parameter drift constraints to train attack probes; set different training rounds to distinguish between policy switching and non-switching scenarios; save the complete attack and defense state record of this round, and update the state vectors of all policies in the candidate policy pool to complete the closed loop of this round and enter the next iteration.
2. The method for switching adaptive defense strategies based on website fingerprinting according to claim 1, characterized in that: Step S1, during traffic alignment encoding, includes the following steps: S11. Direction symbol encoding: Data packets from the client to the server are encoded as 1, and data packets from the server to the client are encoded as -1, thus obtaining the direction sequence; S12, Time Smoothing Coding: Calculates the time interval between adjacent data packets, using... Smoothly eliminate extreme time delay interference, among which, Represents the natural logarithm function. This is used to prevent negative values caused by abnormal timestamps from being included in logarithmic calculations. This represents the smoothed time interval characteristics; S13. Enhance the burst structure of consecutive same-direction packets, merge consecutive same-direction data packets into burst fragments, and record the number of burst fragments, the number of data packets, the total number of bytes in the data packets, the duration of the burst fragments, and the direction of the burst fragments; S14. Fixed-length multi-channel tensor output: The direction sequence, time interval sequence and burst structure features are concatenated into channels to form a multi-channel flow representation. If the sequence length is too long, truncation / pooling is used for dimensionality reduction. If the sequence length is too short, zero-value padding is used. The final output is a real tensor with size c×L, where c is the number of channels and L is the uniform sequence length.
3. The method for switching adaptive defense strategies based on website fingerprinting according to claim 1, characterized in that: In step S2, the candidate defense strategy pool includes at least two of the following: Glue, WTF-PAD, Front, Random Padding, Constant Rate, and PEZD; each defense strategy corresponds to an independent defense transformation function. This allows defense strategies to be dynamically selected based on attack feedback; Where X represents the traffic to be processed. Adjustable parameters for the defense strategy include the number of padding packets, padding probability, delay range, burst disturbance ratio, fixed transmission rate, or window length. Policy state updates are based on historical feedback. These policy state updates include: S21. Historical vulnerability updates are performed using an exponential moving average method: ,in, For the updated historical average vulnerability, The historical average vulnerability before the update, This represents the update coefficient. Score the vulnerability of the current round; S22. Historical cost update, historical average bandwidth cost update adopts: , Historical average latency overhead is updated using: , in, and These are the updated historical bandwidth overhead and historical latency overhead, respectively. and These are the historical cost records before the update. For bandwidth overhead, For latency overhead; S23. Exposure and Cooling Status Update: When the policy vulnerability, overhead, or number of consecutive use rounds exceed the corresponding cooling threshold, the cooling status is marked and automatically removed when the cooling period expires.
4. The method for switching adaptive defense strategies based on website fingerprinting according to claim 1, characterized in that: The attack probe feedback calculation in step S4 includes, S41, Website Category Probability Prediction Input the attack probe model and get ,in, Let i be the class prediction probability vector for the i-th sample in the r-th round. For the attack probe model, For normalized exponential functions, This represents the flow characteristics of the i-th sample in the r-th round after it has undergone defense. S42. The formula for generating predicted labels is: , To select the category index with the highest probability in the website category dimension, The website category predicted by the attack probe for the i-th defended sample; S43, Attack accuracy calculation formula ,in Let r be the accuracy of the attack in round r. For indicator functions; S44. Calculation of attack confidence and attack loss: First, calculate the confidence level. Then calculate the attack damage: ,in, For attack confidence, For the damage caused by the attack, The predicted probability corresponding to the true category; S45. Multi-attack probe integrated feedback: If multiple attack probe models are used, then the calculation is as follows: Where h is the h-th attack probe model, Integrate weights for it, and .
5. The method for switching adaptive defense strategies based on website fingerprinting according to claim 1, characterized in that: The attack feedback-driven vulnerability fusion score in step S5 includes: S51. Attacker adaptation gain calculation, first calculate: , in, To adapt the attack probe to the attack accuracy level before training, To adapt the attack probe to the attack accuracy after training. This represents the accuracy gain that the attacker gains after continuing to learn under the current defense strategy; S52. Confidence entropy correction, calculation of prediction entropy: , Average prediction entropy: And obtain the corrected confidence level: , Where C represents the total number of website categories; S53. Basic vulnerability scoring, constructing the vulnerability scoring calculation formula: , Among them, alpha, beta, eta, and kappa are non-negative weights. As a result of the losses from the previous attack, This represents the losses from the current round of attacks; S54. Overhead-aware vulnerability score, calculating deployment cost: , in, For bandwidth budget, For delay budget, and Weighting for penalties for exceeding spending limits.
6. The method for switching adaptive defense strategies based on website fingerprinting according to claim 1, characterized in that: The trend perception switching determination method in step S6 is as follows: S61. Take the most recent k rounds of vulnerability scores to form a risk window. Where k represents the length of the sliding window, This represents the risk trajectory of the current strategy or strategy sequence in recent offensive and defensive interactions. S62. Calculate the window risk trend slope using the least squares method. , >0 indicates that the risk is continuing to rise; S63. Exponential smoothing auxiliary judgment, calculation of smoothing exponent: ,in, For the risk of the r-th round of exponential moving average, For smoothing coefficients; S64. Switching trigger conditions include: when the following conditions are met... ,or and ,or ,or The switching is triggered when any of the following conditions are met: Here, m represents the standard vulnerability threshold, 'm' represents the active switching trend boundary, and 'delta' represents the threshold buffer zone. Q represents the number of consecutive rounds the current strategy can be used, and Q represents the maximum number of consecutive rounds. Emergency threshold; S65, Switch reason output. If by If triggered, the output threshold will trigger; if triggered by and If triggered, the output trend will be triggered; if triggered by If triggered, the output will continuously use the trigger; if by If triggered, output "Emergency Trigger" and switch the cause. It is written into the historical status record for subsequent auditing and parameter tuning.
7. The method for switching adaptive defense strategies based on website fingerprinting according to claim 1, characterized in that: In step S7, the next round strategy selection under overhead constraints: when the output triggers a switching signal, the next round strategy is selected from the candidate defense strategy pool, including the following steps: S71. Hard-overhead filtering: constructing an effective candidate strategy set. and and ,in, The expected bandwidth cost of candidate strategy d is... The expected latency cost of candidate strategy d is... Hard bandwidth limit As a hard limit on latency, This refers to the cooling state of strategy d; S72. Calculate the normalization cost: ,in To normalize the expense items, The maximum expected bandwidth overhead in the candidate policy pool. The maximum expected latency cost in the candidate policy pool. and The relative weights of bandwidth and latency; S73, Calculate the benefits of strategy diversity: ,in, The number of times candidate strategy d has been used in the most recent rounds; S74. Calculate the switching penalty: , Where P(d) is the switching penalty term, To continue using the penalty or reward coefficient of the current strategy, The penalty coefficient for recently reused strategies; RecentStrategies is the set of recently used strategies. S75. Overall Score Calculation and Strategy Selection: Calculate the overall score. , Where R(d) is the historical risk estimation term, , , and For weighting coefficients; select As the next round of defense strategy.
8. The method for switching adaptive defense strategies based on website fingerprinting according to claim 1, characterized in that: In step S7, when there are no valid candidate strategies that satisfy the hard overhead constraint, a downgrade selection mechanism is executed: S76. Constraint conflict detection, if If the value is empty, the current round is determined to be in a constraint conflict state, and the conflict type is recorded. The conflict type includes at least one of bandwidth constraint conflict, delay constraint conflict, and policy cooling conflict. S77. Gradually relax constraints, first relax hard delay constraints. But maintain a hard bandwidth constraint If no available strategy exists, the strategy with the lowest cost overrun is allowed, but the current state is marked as a degraded running state. S78. Calculate the selection of degradation strategy: , in, and For hard constraint conflict penalty weights, Will As the next round of defense strategy, conflict constraint information will be written into the historical state record.
9. The method for switching adaptive defense strategies based on website fingerprinting according to claim 1, characterized in that: Step 8, which involves attacker adaptation training, state recording, and closed-loop solidification, includes the following steps: S81. Constructing the training set: ,in, This is the sample after the current round of defense. This is a sample for replaying historical defenses. For undefended or baseline samples; S82. Construct training objectives: Where CE is the cross-entropy loss and rho is the parameter drift constraint coefficient. These are the probe parameters from the previous attack. It is an L2 norm; S83. When no strategy switch occurs in the current round, use fewer training rounds. Perform fine-tuning with the same strategy; when a strategy switch occurs in the current round, use a larger number of training rounds. Retraining after switching, where Greater than ; S84. Save historical status records: , Where r is the round number, As the current strategy, For attack accuracy, For attack confidence, To adapt to gain, Vulnerability scoring, For bandwidth overhead, For latency overhead, The trend slope To decide whether to switch, For the next round of strategy, Reason for switching; S85, according to Update the state vector in the candidate policy pool The historical state records are used for subsequent vulnerability scoring, trend judgment, strategy selection, experiment reproduction, and deployment auditing, thus forming a closed loop of attack feedback, strategy selection, attacker adaptation, and state updates.
10. A method for switching adaptive defense strategies based on website fingerprinting according to any one of claims 1-9, characterized in that: The overall closed-loop optimization objective of this method is: , in, The defense scheduling strategy is jointly formed by trend-aware switching judgment and cost-constrained strategy selection, where R is the total number of attack and defense interaction rounds. For the vulnerability score in round r, For the bandwidth overhead of the r-th round, For the delay overhead of the r-th round, This is an indicator that takes a value of 1 when a policy switch occurs and a value of 0 otherwise. , and These represent the weights of bandwidth overhead, latency overhead, and switching cost, respectively.
