arXiv:2610.07776cs.CROct 2026

Manuscript Offprint

arXiv:2610.07776

SCSM: A Traffic-Native Foundation Model for Transferable Website Fingerprinting

Xianwen Deng, Ruijie Zhao, Mingwei Zhan, Yijun Wang, Zhi Xue

Xianwen Deng, Ruijie Zhao, Mingwei Zhan, Yijun Wang, and Zhi Xue

Abstract—Website fingerprinting infers the websites visited by users from encrypted traffic metadata. However, models trained under fixed collection conditions often degrade as website sets, collection times, network paths, browsers, or defenses change. Existing transferable attacks either rely on handcrafted perturbations of individual traces or adapt language-oriented architectures to traffic, limiting their ability to capture traffic-native semantics. To address these limitations, we propose SCSM, a traffic-native foundation model for transferable website fingerprinting. Specifically, SCSM constructs pairs of pretraining views from the same group of unlabeled traces through Segmentation, Combination, Scaling, and Masking. These operations produce diverse observable patterns while preserving the underlying packet events and local traffic dynamics of real trace fragments. The corresponding windowed traffic counting matrices serve as inputs for contrastive pretraining of a state-space encoder without website annotations. The pretrained encoder is then fine-tuned on a small labeled support set, and predictions are aggregated across temporal scales at inference. Experimental results demonstrate that SCSM surpasses the strongest baselines by 16.4% in average top-3 accuracy over six temporal-drift tasks on GTT23 and by 13.8% in average macro-F1 over four cross-domain datasets. The code and datasets will be made available at https://github.com/SJTU-dxw/WF-SCSM.

Index Terms—Website fingerprinting, traffic foundation models, few-shot adaptation.

I. INTRODUCTION

Website Fingerprinting (WF) attacks [1]–[7] infer the websites visited by users from encrypted traffic metadata, such as packet directions, timings, and burst patterns. Recent deep learning approaches [8]–[11] have achieved high identification accuracy under controlled experimental settings. However, their effectiveness largely relies on the assumption that training and deployment traffic follow similar distributions [12]. In practice, website content evolves continuously, Tor circuits traverse heterogeneous network paths, users adopt different browser configurations, and the set of monitored websites may change over time [13], [14]. These factors create substantial mismatches between training and deployment traffic, causing task-specific WF classifiers to deteriorate rapidly [15]–[18]. Real-world WF is therefore not a single stationary classification problem, but a family of related recognition problems defined over heterogeneous traffic domains. A deployment domain may differ from the training domain in its website population, collection period, network location, or browser configuration. Conventional WF attacks address each domain independently, requiring attackers to repeatedly collect labeled traces and train new classifiers [15], [16]. Such a task-by-task learning paradigm fails to exploit the traffic knowledge shared across different WF domains.

Transferable WF attacks [15], [16], [19], [20] seek to alleviate this problem by pretraining traffic encoders and adapting them to a target domain with only a small number of labeled traces. Existing transferable WF methods typically construct alternative views by applying handcrafted perturbations to an individual trace [15] or its numerical representation [16]. This strategy has two limitations. First, independently modifying burst sizes, packet positions, or window-level counts can disrupt the directional and temporal dependencies jointly produced by actual page-loading activities, reducing the fidelity of the augmented traffic. Second, because every view remains a local variant of a single trace within a predefined transformation space, the resulting views cover only a limited range of global traffic structures and browsing compositions. Consequently, the encoder may primarily learn invariance to designer-specified perturbations rather than transferable traffic semantics.

More recently, TraVerse [17] introduces foundation-model pretraining into WF by adapting a pretrained language model to traffic. It serializes burst sequences as textual prompts, introduces bidirectional attention, and performs traffic-domain pretraining on unlabeled traces through masked traffic-pattern reconstruction. While demonstrating the potential of large-scale pretraining for transferable WF, TraVerse still inherits tokenization, representation spaces, and architectural priors developed for natural language. Traffic knowledge is therefore acquired by adapting a language-centric backbone rather than learned natively within a traffic foundation model.

The limitations of both handcrafted traffic augmentation and language-centric pretraining motivate two design requirements for a traffic-native WF foundation model. First, it should be built on traffic-native representations and directly capture their directional and temporal dependencies, rather than recasting traffic through a language-oriented interface. Second, its pretraining views should preserve packet events and local traffic dynamics observed in real traces while introducing diverse higher-level variations in temporal organization and traffic composition. Such a design combines event-level fidelity with structural diversity, allowing the encoder to learn traffic semantics beyond invariance to a fixed set of numerical perturbations. By satisfying these requirements, the model can learn reusable traffic representations from unlabeled data and support few-shot adaptation across website sets, network conditions, and browsing scenarios.

Xianwen Deng, Mingwei Zhan, Yijun Wang, and Zhi Xue are with the School of Electronic Information and Electrical Engineering, Shanghai Jiao Tong University, Shanghai 200240, China (e-mails: {2594306528, mw.zhan, ericwyj, zxue}@sjtu.edu.cn).

Ruijie Zhao is with the School of Cyber Science and Engineering, Southeast University, Nanjing 211189, China (e-mail: ruijiezhao@seu.edu.cn).

Corresponding author: Zhi Xue.

To this end, we propose SCSM, a traffic-native foundation model for transferable WF. Unlike approaches that serialize traffic through a language-oriented interface, SCSM operates directly on windowed traffic counting matrices, which preserve the temporal evolution of incoming and outgoing packets. A state-space encoder then models the local dynamics and long-range dependencies within these traffic-native representations [11]. To learn reusable representations from unlabeled traffic, SCSM constructs traffic-grounded views through three complementary stages. At the trace level, Segmentation and Combination treat fragments of observed single-tab traces as construction primitives. They preserve the packet directions and relative timings within each fragment, while randomized segmentation, cropping, ordering, and temporal interleaving produce a combinatorial range of global traffic structures. During matrix construction, temporal Scaling varies the observation granularity without modifying the underlying packet events. At the feature level, Masking randomly removes temporal regions, encouraging the encoder to integrate evidence across the observation horizon. Applying this pipeline independently to the same source group yields two structurally diverse views with the same latent website composition, which form a positive pair for contrastive pretraining. The pretrained encoder can subsequently be adapted to new website sets, network conditions, and browsing scenarios using only a small number of labeled traces.

We evaluate SCSM under diverse adaptation settings, including temporal drift, cross-scenario and cross-domain transfer, open-world recognition, defended traffic, and multi-tab browsing. Under temporal drift on GTT23, SCSM surpasses the strongest baseline by 16.4% in Accuracy@3 averaged over six target weeks. On Swallow, it improves average macro-F1 by 6.0% across shifts in guard-relay location, website content, and browser. For closed-world cross-domain transfer, it improves macro-F1 by 13.8% on average across four target datasets. Strong results in open-world recognition, defended traffic, and multi-tab browsing further demonstrate the broad transferability of its learned traffic representations.

Our main contributions are as follows:

• We present SCSM, a traffic-native foundation model for transferable WF that operates directly on windowed traffic counting matrices. By coupling traffic-native representations with a state-space encoder, SCSM learns reusable traffic knowledge from unlabeled traces and supports sample-efficient adaptation across website sets, network conditions, and browsing scenarios.

• We develop a three-stage view construction mechanism comprising trace-level Segmentation and Combination, matrix-level temporal Scaling, and feature-level Masking. It preserves observed packet events and local directional-temporal dynamics while generating structurally diverse views through cross-trace composition and multi-level transformations. This traffic-grounded design expands pretraining diversity beyond local perturbations of individual traces and enables label-free contrastive learning from shared website compositions.

• We conduct extensive experiments on diverse real-world encrypted traffic datasets to assess SCSM’s transferability and robustness. Under limited labeled supervision, SCSM substantially outperforms state-of-the-art baselines, demonstrating the effectiveness and generalizability of its learned traffic representations.

References (30)