New AI Security System Accurately Catches Hidden Unknown Cyber Attacks in Encrypted Traffic
A multi-granularity machine learning framework uses prototype distance and risk scores to spot unseen threats without breaking encryption.
When everyday internet traffic is scrambled by heavy encryption, security software faces a frustrating guessing game, forcing hidden malware or stealthy cyber attacks into whatever standard category the computer program already knows. This blind spot can conceal emerging threats by misjudging unknown digital behavior as normal background noise or routine traffic. To solve this puzzle, a new study published in PLOS One introduces a computer security framework that learns how to spot when incoming network activity simply does not belong anywhere.
How Can Computers Spot Hidden Cyber Threats Without Looking Inside Encrypted Messages?
Led by researcher Siyan Gao, the study proposes a system named MGPT-PCL-OSD that examines encrypted communication across five different levels of detail. Instead of trying to read scrambled payload data, the method studies outer behavioral clues such as byte fragments, individual packet lengths, connection flows, session contexts, and overall interaction graphs between different network addresses. By examining these observable patterns, the model identifies characteristic traits of malicious activity, such as the high frequency and short connections typical of network scanning, or the steady, periodic heartbeats often associated with command and control servers.
Before any classification takes place, the system undergoes a multi-task pre-training phase using a specialized computer architecture known as a Transformer. This allows the model to absorb general structural patterns from large amounts of unlabeled network data without needing plaintext access. The training protocol uses specific objectives like masked fragment recovery, flow contrastive learning, and burst direction reconstruction to build a robust internal understanding of how normal and abnormal encrypted sessions behave.
What Makes Prototype Contrastive Learning Better at Catching Unknown Attacks?
Traditional machine learning models rely on a closed-set assumption, meaning they force every test sample into one of the pre-trained categories even if the sample represents a completely new type of threat. To overcome this limitation, the authors implemented a prototype contrastive learning module that pulls samples of the same known category tightly together while pushing different categories far apart in the feature space. This mathematical separation creates defined boundaries around known behaviors, leaving an expansive, measurable gap for anything that falls outside established parameters.

To decide whether an incoming network stream is truly unknown, the system calculates a composite risk score that combines nearest sub-prototype distance, predictive energy, classification confidence, and uncertainty. A sample is accepted as a known class only if its confidence is high, its distance to the nearest prototype falls within a calculated acceptance radius, and its risk score remains below a strict threshold. Otherwise, the traffic is flagged and rejected as an unknown anomaly.
How Does the System Turn Rejected Unknown Traffic Into Usable Security Knowledge?
Simply rejecting strange traffic does not automatically make a security system smarter, so the framework includes a controlled discovery and update loop. Rejected data embeddings are accumulated in a time-indexed cache and grouped using a density-based clustering algorithm over 600-second windows. A candidate new class is only recognized as stable if it persists across consecutive time windows with high core-sample similarity, ensuring that isolated glitches or adversarial noise do not immediately alter the model.

Once human analysts confirm the nature of the clustered traffic, the system updates its prototype library using an exponential moving average, while a bounded replay buffer stores exemplars from older classes to prevent the network from forgetting what it learned previously. Across rigorous evaluations on standard benchmark datasets including CICIDS2017 and CICIoT2023, the model achieved an accuracy of about ninety-four percent on known categories and maintained an open-set area under the receiver operating characteristic of about ninety-four percent when identifying held-out unknown attack types.
What Are the Limitations of This Open-Set Cyber Defense Approach?
Despite the strong performance metrics, the authors emphasize important technical boundaries for the research. The held-out attack classes used in the experiments serve as a reproducible proxy for zero-day behavior rather than definitive proof of detecting previously undisclosed real-world exploits. Furthermore, combining five granular levels of traffic representation increases computational overhead, resulting in an end-to-end processing latency of eleven milliseconds per flow on the tested hardware platform.
Additionally, the system remains sensitive to environmental domain shifts, meaning that differences in network architecture, device types, or protocol distributions can reduce open-set accuracy. The authors also note that the model has not yet been tested against sophisticated attackers who intentionally mimic normal packet lengths and timing to evade detection boundaries. Future work will need to address adversarial resilience and lightweight deployment to ensure reliable performance in live enterprise environments.
The research was published in PLOS One on November 24, 2026.
This article has been fact checked for accuracy, with information verified against reputable sources. Learn more about us and our editorial process.
Last reviewed on .
Article history
- Latest version
Reference(s)
- Gao, Siyan. “Open-set detection of training-time unseen attacks in encrypted traffic based on a multi-granularity pre-trained transformer and prototype contrastive learning.” PLOS One, vol. 21, no. 11, November 24, 2026, pp. e0359792 Public Library of Science (PLoS), doi: 10.1371/journal.pone.0359792. <https://doi.org/10.1371/journal.pone.0359792>.
Cite this page:
- Posted by Rabia Shah