EvaluatingDeepLearning-basedNIDSinAdversarialSettings
EvaluatingDeepLearning-basedNIDSinAdversarialSettings
net/publication/358631178
CITATIONS READS
3 850
3 authors:
Ali A. Ghorbani
University of New Brunswick
343 PUBLICATIONS 20,569 CITATIONS
SEE PROFILE
All content following this page was uploaded by Hesamodin Mohammadian on 23 March 2022.
Abstract: The intrusion detection systems are a critical component of any cybersecurity infrastructure. With the increase
in speed and density of network traffic, the intrusion detection systems are incapable of efficiently detecting
these attacks. During recent years, deep neural networks have demonstrated their performance and efficiency
in several machine learning tasks, including intrusion detection. Nevertheless, recently, it has been found that
deep neural networks are vulnerable to adversarial examples in the image domain. In this paper, we evaluate
the adversarial example generation in malicious network activity classification. We use CIC-IDS2017 and
CIC-DDoS2019 datasets with 76 different network features and try to find the most suitable features for
generating adversarial examples in this domain. We group these features into different categories based on
their nature. The result of the experiments shows that since these features are dependent and related to each
other, it is impossible to make a general decision that can be supported for all different types of network
attacks. After the group of All features with 38.22% success in CIC-IDS2017 and 39.76% in CIC-DDoS2019
with ε value of 0.01, the combination of Forward, Backward and Flow-based feature groups with 23.28%
success in CIC-IDS2017 and 36.65% in CIC-DDoS2019 with ε value of 0.01 and the combination of Forward
and Backward feature groups have the highest potential for adversarial attacks.
435
Mohammadian, H., Lashkari, A. and Ghorbani, A.
Evaluating Deep Learning-based NIDS in Adversarial Settings.
DOI: 10.5220/0010867900003120
In Proceedings of the 8th International Conference on Information Systems Security and Privacy (ICISSP 2022), pages 435-444
ISBN: 978-989-758-553-1; ISSN: 2184-4356
Copyright c 2022 by SCITEPRESS – Science and Technology Publications, Lda. All rights reserved
ICISSP 2022 - 8th International Conference on Information Systems Security and Privacy
436
Evaluating Deep Learning-based NIDS in Adversarial Settings
4 PROPOSED METHOD and group these features into six sets and evaluate the
effectiveness of using each of these sets and a com-
In this section, we explain our method for making an bination of them to generate adversarial examples.
adversarial attack against the NIDS. First, we train These six sets are Forward Packet, Backward Packet,
a DNN model for classifying different types of net- Flow-based, Time-based, Packet Header-based and
work attacks in our dataset with good performance Packet Payload-based features. You can find the
compared to other classifiers. Since we are mak- details of these feature sets in Table 1.
ing a white-box attack, we assume that the attacker In the FGSM method, after computing the magni-
knows the parameter and architecture of the target tude of the perturbation using Equation 2, the attacker
DNN model. We use one of the well-known adversar- will add the perturbation to all the input features to
ial attack methods in computer vision called FGSM generate the adversarial example. But, since we only
to craft our adversarial examples. change a subset of input features to craft adversarial
examples, we use the following equation:
4.1 Training the DNN Target Model X 0 = X + mask vector ∗ η (3)
First, we train our DNN model for classifying differ- Where X 0 is the adversarial example, X is the orig-
ent network attacks. We train a multi-layer perceptron inal example, η is the magnitude of the perturbation
with two hidden layers, each of them has 256 neu- (ε) multiplied by the sign of the model gradient, and
rons. We used RelU as our activation function and mask vector is a binary vector with the same size as
a Dropout layer with 0.2 probability in both hidden input vector which for the features that we want to
layers. change, has the value 1 and for the other features 0.
In this research, we use CIC-DDoS2019
(Sharafaldin et al., 2019), and CIC-IDS2017
Algorithm 1: Crafting adversarial examples.
(Sharafaldin et al., 2018) datasets to train our
DNN model and perform the adversarial attack. 1 for each (x, y) ∈ Dataset do
Each dataset contains several network attacks. The 2 if F(x) = y then
CIC-DDoS2019 attacks are: DNS, LDAP, MSSQL, 3 η = εsign(5x J(θ, x))
NetBios, NTP, SNMP, SSDP, UDP, UDP-Lag, 4 x0 ← x + mask vector ∗ η
WebDDos, SYN and TFTP. The CIC-IDS2017 5 if F(x0 ) 6= y then
includes DDoS, PortScan, Botnet, Infiltration, Web 6 return x0
Attack-Brute Force, Web Attack-SQL Injection, 7 end
Web Attack-XSS, FTP-Patator, SSH-Patator, DoS 8 end
GoldenEye, DoS Hulk, DoS Slowhttp, Dos Slowloris 9 end
and Heartbleed attack. They extracted more than
80 network traffic features from their datasets using
CICFlowMeter (Lashkari et al., 2017) and labeled Algorithm 1 shows how we generate adversarial
each flow as benign or attack name. examples using a different set of features. For each
We used the data from training day of the CIC- flow in the dataset, we use the FGSM method to com-
DDoS2019 and the whole CIC-IDS2017 to train our pute the magnitude of the perturbation. Then, we
DNN model and craft adversarial examples. During multiply the mask vector of the set that we are using
preprocessing, we removed seven features, namely and add the result to the original input. If the classi-
Flow ID, Source IP, Source Port, Destination IP, Des- fier cannot make a correct prediction for the generated
tination Port, Protocol and Timestamp, which are not sample, the algorithm will return it as a new adversar-
suitable for a DNN model. ial example.
437
ICISSP 2022 - 8th International Conference on Information Systems Security and Privacy
Table 2: Results of the Classifiers. ples using different feature sets and present the result
Machine Learning DDOS IDS for each dataset.
Techniques F1-score PC RC F1-score PC RC
DT 97.09 98.54 96.26 99.84 99.76 99.92
Naive Bayes 50.55 60.20 62.03 28.47 32.43 73.75 5.2.1 CIC-IDS2017
LR 69.53 70.68 68.94 36.71 39.76 34.96
RF 95.65 98.55 94.60 96.58 99.79 94.24
DNN (Our) 98.97 99.00 98.96 98.18 98.27 98.22 After training the model on CIC-IDS2017, we start
generating adversarial examples. We only use those
tack against NIDS and also find the most vulnerable original samples that the model detected correctly.
type of network attacks against adversarial attacks. The number of these samples are 2,777,668. As the
model could not detect the Web Attack-SQL Injection,
we do not use them for adversarial sample generation.
5.1 The DNN Classifier Performance Table 3 contains the result of adversarial sample
generation on CIC-IDS2017 dataset with 0.001 and
We train a DNN model on both datasets and compare 0.01 as values for ε. The table shows the number of
its performance with other machine learning tech- adversarial examples generated using different feature
niques. The DNN model is a simple multi-layer sets. The first column is the result when we use all
perceptron. Table 2 shows the results that demon- features in the dataset.
strate that our model’s performance is comparable With 0.001 the attack cannot generate any adver-
with other machine learning models. sarial examples for Infiltration, Web Attack-XSS and
Heartbleed, so we remove them from the results table.
5.2 The Adversarial Attack Results As we expected, the best result in both cases is when
all the features were used. With ε = 0.001, the attack
After training the DNN model, we use the proposed is able to generate adversarial examples for 9.05% of
method to generate adversarial examples for the two the original samples and with ε = 0.01 for 38.22% of
selected datasets. To perform the adversarial attack, the actual samples.
we use the FGSM method with two different values In both cases the second-best set of features is the
for ε. In order to choose the suitable ε values for combination of Forward, Backward and Flow-based
our detailed experiments, first we perform the attack features with 8.89% for ε = 0.001 and 23.28% for
using 6 different values including: 0.1, 0.01, 0.001, ε = 0.01. The third and fourth-best feature sets are
0.0001, 0.00001, and 0.000001 for ε. Based on the also the same for both ε values. The combination
results, 0.001 and 0.01 were chosen as the preferred of Forward and Backward features is third and the
values for ε. Also, we generate the adversarial exam- combination of Forward and Flow-based features is
438
Evaluating Deep Learning-based NIDS in Adversarial Settings
fourth one. more than Time-based features. The third best feature
The worst results for both cases are when we use set is Backward features.
Packet header-based features. The reason could be In Table 3, we also show the number of generated
that the number of features in this set is the lowest samples with two values of the ε for each network
and almost all the features in this set are based on the attack type in the dataset.
packet flags which may not have much effect on de- Comparing the results for the Benign samples,
tecting the attack types. shows that, in all cases increasing the value of the
If we only compare the results for the main fea- ε will increase the percentage of generated samples,
ture sets, the best results for both ε values are when except for the combination of Backward, Flow-based
the Forward features were used. This result supports features and Time-based features.
our previous findings that show the best feature sets For DDoS attack we are able to generate adver-
combination are the ones with the Forward features sarial examples for 99.15% of original samples when
present. There is a difference in the second-best fea- we use All the features with ε = 0.01. Unlike Benign
tures set between two ε values. For value 0.001 the samples, the results for all feature sets got better when
second-best set is Time-based features but for value the ε value is increased.
0.01 is Packet Payload-based set. This result shows The third comparison is for PortScan attack. The
that increasing the magnitude of the perturbation in- highest percentage of generated examples is 99.7%
creases the effect of Packet Payload-based features with ε = 0.01 for three different feature sets. This re-
439
ICISSP 2022 - 8th International Conference on Information Systems Security and Privacy
sult shows we can completely fool our model without use all the features for performing the attack. The per-
even using all the features during adversarial samples centage of generated sample with ε = 0.001 is 1.14%
generation. and with ε = 0.01 is 39.76%. Also, the worst result
These results for Botnet attack show even with is for Packet Header-based features for both ε values:
ε = 0.001 in four cases; we were able to generate ad- 0.003% for ε = 0.001 and 0.01% for ε = 0.01. For
versarial examples for more than 95% of the original both ε values the top 5 feature sets are almost same,
samples, which means Botnet attack is vulnerable to except for 3rd and 4th place that are changed between
adversarial attack. Forward plus Backward features and Forward plus
Infiltration, Web Attack-XSS and Heartbleed rows Flow-based features.
only contain values for ε = 0.01, because the at- Again, like before we also compare the results for
tack cannot generate any adversarial examples with the main feature sets. For both ε values, the best per-
ε = 0.001. formance is for Forward features. The second and
In 7 cases, we were able to generate adversarial third place are visa-versa for two ε values. With
examples for all the original examples with ε = 0.01 ε = 0.001 the second best is Time-based features with
for Web Attack-Brute Force. Two interesting results 0.04% and the third is Packet Payload-based features
are for Flow-based and Time-based features. The with 0.02%. Packet Payload-based result is 4.62%
number of generated samples were 0 with ε = 0.001 and Time-based result is 4.60% for ε = 0.01.
for these two sets, but with ε = 0.01 the success rate In Table 4, the first row shows the result for Be-
was 100%. nign samples. Even with ε = 0.01 and using All the
For FTP-Patator with ε = 0.001 the results for all features, the percentage of generated adversarial sam-
the feature sets are same (94%) except for Backward ples is less than 7%, which means making an adver-
and Packet Header-based features. Also, with ε = sarial attack on Benign samples is a tough task.
0.01 the success was more than 99% for almost all The next row is for DNS attack. The percentage of
the feature sets. generated adversarial samples with ε = 0.001 for all
When we perform the adversarial attack against different sets are less 0.4%. But when the value of the
SSH-Patator samples with ε = 0.01 the success rate is ε is increased, we hada better results with 32.58% for
almost zero for all the feature sets. But after increas- All the features, 26.16% for combination of Forward,
ing the value of the ε we had perfect results except Backward and Flow-based features, and 21.87% for
when packet related features were used. Forward and Flow-based features.
The next four rows are for different types of DoS The success of the adversarial attack on LDAP
attacks. It seems the best result with ε = 0.001 is for samples with ε = 0.001 is almost zero for all the dif-
DoS Hulk and with ε = 0.01 is for DoS GoldenEye. ferent feature sets with 0.04% as the highest for All
With both ε DoS Slowhttp has the worst result, with features. The interesting finding here is that after in-
success less than 2% for all sets with ε = 0.001. creasing the ε value to 0.01 we got better result with
The last row is the comparison for all the gener- Forward and Backward features combination than All
ated samples using different feature sets. As we men- features.
tioned earlier, the best and worst feature sets for ad- The next four attacks are MSSQL, NET, NTP and
versarial sample generation in this dataset are All and SNMP. The attack performance for all of them is re-
Packet Header-based features. ally low with ε = 0.001. But with ε = 0.01 all of
them have results more than 64% and up to 86% when
5.2.2 CIC-DDoS2019 using All the features and combination of Forward,
Backward and Flow-based features. The next two
The number of detected samples for CIC-DDoS2019 best feature sets are Forward, Backward combination
is 48197029, and we use them for performing our ad- and Forward, Flow-based combination, which means
versarial attack. Since the model is not able to detect using Forward features have a great effect on our at-
any of the Web-DDoS attack samples, we do not use tack performance.
them for adversarial sample generation. The results Amongst all the different attack types, the best
of adversarial attack on CIC-DDoS 2019 dataset with results with ε = 0.001 are for SSDP, and UDP. For
values 0.001 and 0.01 for ε are shown in Table 4. In SSDP when we use All the features, Forward features
this tables, you can see the number of generated ad- or a set that contains Forward features we are able to
versarial examples and their respective percentage. generate adversarial examples for at least 9% percent
With both values for ε, we were able to generate of original samples. This finding also apply to UDP,
some adversarial examples for all the attacks and fea- but with less percentage of success.
ture sets. Same as before the best result is when we Next is the result comparison for SYN attack sam-
440
Evaluating Deep Learning-based NIDS in Adversarial Settings
ples. For ε = 0.001 all the results are almost zero. The The last row shows the whole number of gener-
feature sets that have Backward features have the best ated adversarial samples using each feature sets. As
result with ε = 0.01, which means they are effective expected, the best result with both values of ε is when
for performing an adversarial attack on SYN samples. All the features were used. The next three best re-
The performance of the adversarial attack on sults were when we use feature sets containing For-
TFTP samples is really low even with ε = 0.01. The ward features. Also, the worst result is when we used
unusual finding here is that the result when the at- Packet Header-based features in both cases of ε val-
tack only uses Forward features is the best, even bet- ues.
ter than using All the features. When we use For-
ward features with Backward or Flow-based features 5.3 Perturbation Magnitude Analysis
the performance dropped almost to half. This means
changing Backward or Flow-based features is not In the previous section, we provided a comprehensive
good for creating adversarial samples. description and analysis for all illustrated results. We
One to the last attack is for UDP-Lag. Again, the talked about each attack group’s results in the two
result with ε = 0.001 is not good and close to zero datasets one by one and compared the effect of dif-
for all the feature sets. With ε = 0.01, the results get ferent feature sets and ε values on the adversarial ex-
better and get up to 34.14% when we perform an ad- amples generation results.
versarial attack with All the features. Also, as it is Before we go forward with the detailed exper-
evident in the sub-figure using feature sets containing iments, we did some experiments with more val-
Forward features have the best results. ues for ε. Table 5 and Table 6 contain the re-
441
ICISSP 2022 - 8th International Conference on Information Systems Security and Privacy
sults of these experiments for CIC-IDS2017 and CIC- tack. For example, we expect to have the best results
DDoS2019 datasets. We started the experiments with when using All the features, but for DoS Slowhttp in
ε = 0.000001 and multiplied it by 10 each time for the CICIDS-2017 and TFTP in CIC-DDoS2019 we do
next ε value until 0.1. not get the best result with All the features.
By increasing the value of ε by a factor of 10 each The next key finding is that the rankings of feature
time, it is evident in both tables that the number of sets for two datasets are almost the same. The first six
generated examples increase for all the different fea- best feature sets are the same for both datasets with
ture groups. But there is no relation between how a slight difference in their ranking for different ε val-
much we increase the values of the ε and how much ues. Also, the worst feature set for both datasets with
more adversarial samples we can generate. Also, the both ε values is Packet Header-based features. This
increase between different feature groups is not equal means it would be better to focus on these feature sets
for the same ε value. For example, after increasing the for evaluating and enhancing adversarial attacks per-
value of ε from 0.01 to 0.1 for CIC-IDS2017 dataset, formance in network intrusion detection and network
the percentage of generated adversarial samples with traffic classification domain.
Forward features went up from 17.35% to 50.27% In average, it seems that the CIC-DDoS2019
which is almost multiplied by 2.9 but samples with dataset is more robust to adversarial attacks than CIC-
Backward features increased from 11.80% to 17.35% IDS2017. With ε = 0.001, the average percentage of
which is an increase by a factor of 1.5. generated adversarial samples are 0.36% and 4.55%,
After choosing the two final ε values, we did an- which is low for CIC-DDoS2019. For ε = 0.01, they
other experiment. We add a small amount to these ε both have averaged around 16%, but since we are
values to evaluate the effect of these small changes. trying to make changes as small as possible during
This time we use 0.0015 and 0.015 as the ε values. our attack, these results show that CIC-DDoS2019 is
Results for these two values are also in Tables 5 and more robust.
6. As you can see in all cases, the number of gener-
ated adversarial examples increased, sometimes by a
factor of more than 2.
When we compare our findings for both datasets,
we are not able to make a general conclusion on
the most influential feature sets for an adversarial at-
442
Evaluating Deep Learning-based NIDS in Adversarial Settings
6 CONCLUSION AND FUTURE Buczak, A. L. and Guven, E. (2015). A survey of data min-
ing and machine learning methods for cyber security
WORKS intrusion detection. IEEE Communications surveys &
tutorials, 18(2):1153–1176.
In this paper, we investigate the problem of adversar- Chen, P.-Y., Zhang, H., Sharma, Y., Yi, J., and Hsieh, C.-J.
ial attack on deep learning models in the network do- (2017). Zoo: Zeroth order optimization based black-
main. We chose two famous and well-known datasets: box attacks to deep neural networks without train-
CIC-DDoS2019 (Sharafaldin et al., 2019) and CIC- ing substitute models. In Proceedings of the 10th
ACM Workshop on Artificial Intelligence and Security,
IDS2017 (Sharafaldin et al., 2018) for our experi-
pages 15–26.
ments. Since CIC-DDoS2019 has more than 49 mil-
Dalvi, N., Domingos, P., Sanghai, S., and Verma, D. (2004).
lions records and it is more than 16 times the records
Adversarial classification. In Proceedings of the tenth
in CIC-IDS2017, using these two datasets we can ACM SIGKDD international conference on Knowl-
verify the scalability of our method. We use CI- edge discovery and data mining, pages 99–108.
CFlowMeter (Lashkari et al., 2017) to extract more Duddu, V. (2018). A survey of adversarial machine learning
than 80 features from these datasets. From these in cyber warfare. Defence Science Journal, 68(4).
extracted features, 76 features are used to train our Gao, N., Gao, L., Gao, Q., and Wang, H. (2014). An
deep learning model. We group these selected fea- intrusion detection model based on deep belief net-
tures into six different categories based on their na- works. In 2014 Second International Conference on
ture: Forward, Backward, Flow-based, Time-based, Advanced Cloud and Big Data, pages 247–252. IEEE.
Packet Header-based and Packet Payload-based fea- Goodfellow, I., Pouget-Abadie, J., Mirza, M., Xu, B.,
tures. We use each of these categories and a combi- Warde-Farley, D., Ozair, S., Courville, A., and Ben-
nation of them to generate adversarial examples for gio, Y. (2014a). Generative adversarial nets. In
our two datasets. Two different values are used as the Advances in neural information processing systems,
pages 2672–2680.
magnitude of adversarial attack perturbations: 0.001
and 0.01. Goodfellow, I. J., Shlens, J., and Szegedy, C. (2014b). Ex-
plaining and harnessing adversarial examples. arXiv
The reported results show that it is tough to make preprint arXiv:1412.6572.
a general decision for choosing the best groups of fea- Grosse, K., Papernot, N., Manoharan, P., Backes, M., and
tures for all different types of network attacks. Also, McDaniel, P. (2017). Adversarial examples for mal-
by comparing the results for two datasets, we found ware detection. In European Symposium on Research
out that the adversarial sample generation is harder in Computer Security, pages 62–79. Springer.
for CIC-DDoS2019 than CIC-IDS2017. Hashemi, M. J., Cusack, G., and Keller, E. (2019). Towards
While the topic of adversarial attack on deep evaluation of nidss in adversarial setting. In Proceed-
learning model in network domain has been gaining ings of the 3rd ACM CoNEXT Workshop on Big DAta,
a lot of attention, there is still a big problem compar- Machine Learning and Artificial Intelligence for Data
Communication Networks, pages 14–21.
ing these kinds of attack in the image domain. The
main point in adversarial attack is to make sure that Ibitoye, O., Shafiq, O., and Matrawy, A. (2019). Analyzing
adversarial attacks against deep learning for intrusion
the attacker did not change the nature of the original detection in iot networks. In 2019 IEEE Global Com-
sample completely. This is easily done in the image munications Conference (GLOBECOM), pages 1–6.
domain by using a human observer. But in the net- IEEE.
work domain, we cannot use a human expert, and it is Kuppa, A., Grzonkowski, S., Asghar, M. R., and Le-Khac,
tough to make sure the changes we made to the fea- N.-A. (2019). Black box attacks on deep anomaly de-
tures of a flow did not change the nature of that flow. tectors. In Proceedings of the 14th International Con-
For future works, the researcher should work on this ference on Availability, Reliability and Security, pages
problem in the network domain. 1–10.
Lashkari, A. H., Draper-Gil, G., Mamun, M. S. I., and Ghor-
bani, A. A. (2017). Characterization of tor traffic using
time based features. In ICISSp, pages 253–262.
REFERENCES Papernot, N., McDaniel, P., Goodfellow, I., Jha, S., Celik,
Z. B., and Swami, A. (2017). Practical black-box at-
Ashfaq, R. A. R., Wang, X.-Z., Huang, J. Z., Abbas, H., and tacks against machine learning. In Proceedings of the
He, Y.-L. (2017). Fuzziness based semi-supervised 2017 ACM on Asia conference on computer and com-
learning approach for intrusion detection system. In- munications security, pages 506–519.
formation Sciences, 378:484–497. Peng, Y., Su, J., Shi, X., and Zhao, B. (2019). Evaluat-
Biggio, B. and Roli, F. (2018). Wild patterns: Ten years ing deep learning based network intrusion detection
after the rise of adversarial machine learning. Pattern system in adversarial environment. In 2019 IEEE 9th
Recognition, 84:317–331. International Conference on Electronics Information
443
ICISSP 2022 - 8th International Conference on Information Systems Security and Privacy
444