A Novel Solution for Zero-Day Attack Detection in IDS using Self-Attention and Jensen-Shannon Divergence in WGAN-GP
Organizations: Institute for Digital Technologies, Loughborough University, London, UK
Abstract
The increasing sophistication of cyber threats, especially zero-day attacks, poses a significant challenge to cybersecurity. Zero-day attacks exploit unknown vulnerabilities, making them difficult to detect and defend against. Existing approaches patch flaws and deploy an Intrusion Detection System (IDS). Using advanced Wasserstein GANs with Gradient Penalty (WGAN-GP), this paper makes a novel proposition to synthesize network traffic that mimics zero-day patterns, enriching data diversity and improving IDS generalization. SA-WGAN-GP is first introduced, which adds a Self-Attention (SA) mechanism to capture long-range cross-feature dependencies by reshaping the feature vector into tokens after dense projections. A JS-WGAN-GP is then proposed, which adds a Jensen-Shannon (JS) divergence-based auxiliary discriminator that is trained with Binary Cross-Entropy (BCE), frozen during updates, and used to regularize the generator for smoother gradients and higher sample quality. Third, SA-JS-WGAN-GP is created by combining the SA mechanism with JS divergence, thereby enhancing the data generation ability of WGAN-GP. As data augmentation does not equate with true zero-day attack discovery, we emulate zero-day attacks via the leave-one-attack-type-out method on the NSL-KDD dataset for training all GANs and IDS models in the assessment of the effectiveness of the proposed solution. The evaluation results show that integrating SA and JS divergence into WGAN-GP yields superior IDS performance and more effective zero-day risk detection.
Figures & tables
| WGAN-GP | SA-WGAN-GP | JS-WGAN-GP | SA-JS-WGAN-GP | |
| G | Dense layers: 128, 256, 512 | Dense layers: 128, 256, 512 + SA layers | Dense layers: 64, 64, 128, 256, 512, 1024 | Dense layers: 64, 64, 128, 256, 512, 1024, Dense layers in SA: 128, 256, 512 |
| C | Dense layers: 512, 256, 128 | Dense layers: 512, 256, 128 + SA layers | Dense layers: 128, 64, 32, 16, Output | Dense layers: 128, 64, 32, 16, Output, Dense layers in SA: 128 and 64 |
| D | – | – | Dense layers: 128, 64, 32, 16, Output | Dense layers: 128, 64, 32, 16, Output, Dense layers in SA: 128 and 64 |
| Learning Rate | G: , C: | G: , C: | G: , C: , D: | G: , C: , D: |
| Epochs | 10,000 | 10,000 | 10,000 | 10,000 |
| G Activation Function | LeakyReLU, Tanh | LeakyReLU, Tanh | LeakyReLU, Tanh | LeakyReLU, Tanh |
| WGAN Variant | IDS Model | Acc. | Normal | Abnormal | ||||
| Rec. | Prec. | F1-score | Rec. | Prec. | F1-score | |||
| WGAN-GP | SVM | 75.1 0.0 | 88.1 0.0 | 65.7 0.0 | 75.3 0.0 | 65.2 0.0 | 87.9 0.0 | 74.9 0.0 |
| DT | 78.8 1.0 | 91.1 1.8 | 70.4 2.2 | 80.9 1.3 | 49.5 3.5 | 95.3 1.6 | 80.3 2.1 | |
| DNN | 75.7 6.0 | 76.5 9.1 | 83.1 11.4 | 78.4 2.0 | 76.5 9.1 | 83.1 11.4 | 78.4 2.0 | |
| CNN | 76.6 5.1 | 62.7 10.6 | 96.5 2.0 | 75.3 7.5 | 96.7 2.4 | 66.8 5.9 | 78.8 3.4 | |
| LSTM | 81.4 0.7 | 97.4 0.2 | 72.7 2.4 | 82.1 0.7 | 72.4 3.4 | 96.9 0.5 | 82.8 2.1 | |
| IDS Model | WGAN Variant | Acc. | Normal | Abnormal | ||||
| Rec. | Prec. | F1-score | Rec. | Prec. | F1-score | |||
| SVM | WGAN-GP | 75.1 0.0 | 88.1 0.0 | 65.7 0.0 | 75.3 0.0 | 65.2 0.0 | 87.9 0.0 | 74.9 0.0 |
| SA-WGAN-GP | 73.3 0.0 | 93.6 0.0 | 62.7 0.0 | 73.3 0.0 | 57.9 0.0 | 92.2 0.0 | 71.2 0.0 | |
| JS-WGAN-GP | 73.1 0.0 | 98.2 0.0 | 61.8 0.0 | 73.1 0.0 | 54.2 0.0 | 97.5 0.0 | 69.6 0.0 | |
| SA-JS-WGAN-GP | 73.3 0.0 | 98.2 0.0 | 62.0 0.0 | 73.3 0.0 | 54.5 0.0 | 97.5 0.0 | 69.9 0.0 | |
| DT | WGAN-GP | 78.8 1.0 | 91.1 1.8 | 70.4 2.2 | 80.9 1.3 | 49.5 3.5 | 95.3 1.6 | 80.3 2.1 |
| WGAN Variant | IDS Model | Acc. | DoS | Probe | ||||
| Rec. | Prec. | F1 | Rec. | Prec. | F1 | |||
| WGAN-GP | SVM | 71.8 0.0 | 70.5 0.0 | 96.4 0.0 | 81.5 0.0 | 61.3 0.0 | 69.4 0.0 | 65.1 0.0 |
| DT | 73.4 0.5 | 84.8 2.1 | 95.6 0.6 | 89.9 1.2 | 72.8 1.4 | 76.3 0.4 | 74.5 0.9 | |
| DNN | 77.7 1.9 | 82.6 2.5 | 90.5 4.5 | 86.3 1.3 | 74.2 5.7 | 71.0 2.6 | 72.5 3.2 | |
| CNN | 79.1 1.0 | 84.0 1.5 | 91.8 2.4 | 87.7 1.5 | 82.9 1.4 | 72.7 3.7 | 77.4 2.1 | |
| LSTM | 78.0 5.2 | 80.7 2.5 | 90.9 3.9 | 85.5 2.7 | 79.2 7.9 | 72.0 4.2 | 75.3 5.5 | |
| WGAN Variant | IDS Model | R2L | U2R | |||||
| Rec. | Prec. | F1 | Rec. | Prec. | F1 | |||
| WGAN-GP | SVM | - | - | - | - | - | - | |
| DT | 14.6 2.3 | 96.8 1.1 | 25.3 3.5 | 11.9 0.0 | 30.0 4.5 | 17.0 0.9 | ||
| DNN | 39.1 15.7 | 71.6 12.2 | 49.1 5.5 | 26.6 5.2 | 26.7 13.2 | 24.7 6.2 | ||
| CNN | 9.4 5.0 | 96.0 2.8 | 16.8 8.1 | 34.8 2.9 | 23.4 7.7 | 27.3 5.5 | ||
| LSTM | 50.9 17.2 | 64.3 5.4 | 54.0 18.1 | 34.2 4.7 | 6.7 3.7 | 10.9 5.3 | ||
| IDS Model | WGAN Variant | Acc. | DoS | Probe | ||||
| Rec. | Prec. | F1 | Rec. | Prec. | F1 | |||
| SVM | WGAN-GP | 71.8 0.0 | 70.5 0.0 | 96.4 0.0 | 81.5 0.0 | 61.3 0.0 | 69.4 0.0 | 65.1 0.0 |
| SA-WGAN-GP | 73.1 0.0 | 71.1 0.0 | 94.6 0.0 | 81.2 0.0 | 71.2 0.0 | 78.9 0.0 | 74.9 0.0 | |
| JS-WGAN-GP | 74.4 0.0 | 75.2 0.0 | 97.2 0.0 | 84.8 0.0 | 69.1 0.0 | 90.7 0.0 | 69.1 0.0 | |
| SA-JS-WGAN-GP | 74.6 0.0 | 75.2 0.0 | 97.2 0.0 | 84.8 0.0 | 69.1 0.0 | 90.7 0.0 | 69.1 0.0 | |
| DT | WGAN-GP | 73.4 0.5 | 84.8 2.1 | 95.6 0.6 | 89.9 1.2 | 72.8 1.4 | 76.3 0.4 | 74.5 0.9 |
| IDS Model | WGAN Variant | R2L | U2R | |||||
| Rec. | Prec. | F1 | Rec. | Prec. | F1 | |||
| SVM | WGAN-GP | - | - | - | - | - | - | |
| SA-WGAN-GP | 3.9 0.0 | 84.3 0.0 | 7.5 0.0 | 10.4 0.0 | 43.8 0.0 | 16.9 0.0 | ||
| JS-WGAN-GP | 0.2 0.0 | 40.0 0.0 | 0.4 0.0 | 6.0 0.0 | 8.2 0.0 | 6.9 0.0 | ||
| SA-JS-WGAN-GP | 0.2 0.0 | 33.3 0.0 | 0.5 0.0 | 34.3 0.0 | 63.9 0.0 | 44.7 0.0 | ||
| DT | WGAN-GP | 14.6 2.3 | 96.8 1.1 | 25.3 3.5 | 11.9 0.0 | 30.0 4.5 | 17.0 0.9 | |
| GAN Models | Acc. (B) (%) | Acc. (M) (%) | Training Time (hours) |
| SYN-GAN [ 30 ] | 79.1 5.6 | 85.1 1.2 | 5.4 |
| IGAN-IDS [ 17 ] | 81.5 4.2 | 79.8 1.4 | 2.3 |
| AI-based NIDS [ 27 ] | 79.2 7.8 | 79.8 0.5 | 2.8 |
| VAE-GAN [ 44 ] | 83.3 0.9 | 81.5 3.1 | 3.9 |
| Mts-dvGAN [ 38 ] | 80.1 1.6 | 80.7 0.7 | 5 |
| GANS-ECNN [ 36 ] | 80.8 3.6 | 76.1 2.6 | 15 |
| GAN model | IDS model | Acc | Macro-F1 | AUROC | TPR@5%FPR |
| Baseline (No GAN) | LSTM | 84.8 1.1 | 71.7 1.3 | 64.0 7.2 | 7.0 1.4 |
| CNN | 85.1 0.3 | 75.1 1.1 | 72.7 1.2 | 29.5 8.7 | |
| DNN | 78.4 6.9 | 61.4 5.4 | 45.4 8.8 | 14.4 7.7 | |
| DT | 75.4 17.6 | 56.4 11.0 | 50.1 0.1 | 0.2 0.2 | |
| SVM | 80.8 0.0 | 62.2 0.0 | 47.0 0.0 | 0.0 0.0 | |
| WGAN-GP | LSTM | 83.4 1.4 | 60.8 1.2 | 46.8 11.0 | 2.9 1.6 |
| Model | frac_lt_eps | Macro kNN p50 | Macro kNN p95 | Macro MMD 2 (clip 0) | ALL MMD 2 |
| WGAN-GP | 0.0 | 0.148 | 0.686 | 0.000512 | 0.023734 |
| SA-WGAN-GP | 0.0 | 0.309 | 1.312 | 0.002859 | 0.021832 |
| JS-WGAN-GP | 0.0 | 7.824 | 8.548 | 0.379318 | 0.285558 |
| SA-JS-WGAN-GP | 0.0 | 8.216 | 8.885 | 0.622680 | 0.343730 |
Network Intrusion Detection
Network intrusion detection identifies malicious or abnormal network activity to help protect computers, connected devices, and critical infrastructure.
See all 168 papers