{'fraction_non_alphanumeric': 0.029196316450397657, 'fraction_numerical': 0.009418166596902469, 'mean_word_length': 4.6597571809298195, 'pattern_counts': {'":': 0, '<': 1, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
On Multi-Session Website Fingerprinting over TLS Handshake

Analyzing users' Internet traffic data and activities has a certain impact on users' experiences in different ways, from maintaining the quality of service on the Internet and providing users with high-quality recommendation systems to anomaly detection and secure connection. Considering that the Internet is a complex network, we cannot disintegrate the packets for each activity. Therefore we have to have a model that can identify all the activities an Internet user does in a given period of time. In this paper, we propose a deep learning approach to generate a multi-label classifier that can predict the websites visited by a user in a certain period. This model works by extracting the server names appearing in chronological order in the TLSv1.2 and TLSv1.3 Client Hello packets. We compare the results on the test data with a simple fully-connected neural network developed for the same purpose to prove that using the time-sequential information improves the performance. For further evaluations, we test the model on a human-made dataset and a modified dataset to check the model's accuracy under different circumstances. Finally, our proposed model achieved an accuracy of 95% on the test dataset and above 90% on both the modified dataset and the human-made dataset.


I. INTRODUCTION
Internet traffic classification is used for multiple intentions. Primarily, website classification was used for enterprise network management [1], [2], providing users with Quality-of-Service (QoS) [2]- [5], recommender systems based on users' activity [6], and anomaly detection [7]. These classification tasks can allow an adversary to use a website fingerprinting attack to invade the network's confidentiality. Recently, with the widespread usage of TLS encrypted protocol over the Internet, complex procedures are being employed to address the new challenges of encrypted traffic classification [8]- [11].
Traditionally, the port-based analysis was used to detect different applications over the network. However, with the emerging utilization of dynamic ports, such approaches have become obsolete. Other methods try to inspect the payload of packets (i.e., known as deep packet inspection) to identify the application or the website. These methods work perfectly for unencrypted packets. The most advanced approach is to use machine learning (ML) and deep learning models to extract the important features of the network traffic, either by experts or automatically, and to train an ML model to predict the application or the website used or visited.
For instance, Wang et al.propose a classification method for encrypted traffic data that uses a 1-dimensional convolutional neural network [8]. They use this model to automatically extract useful features from the raw ISCX traffic dataset and classify both VPN and nonVPN traffic data on 14 classes representing different activities, e.g., email, and streaming. Similar to this work, [9] introduces Deep Packet, a deep learning based approach that uses the same dataset as [8], but with IP addresses masked, and use a convolutional neural network to recognize both traffic characterization and application identification.
Alshammari et al. use a machine learning approach to detect encrypted from unencrypted tunnels. They use different learning algorithms trained on both packet header features, and statistical flow features, e.g., number of packets in forward/backward direction, without using the IP addresses, ports, and payloads on two encrypted traffic tunnels, SSH, and Skype to distinguish different services [12]. This work proves that much can be inferred from the statistical features of the traffic flow. On statistical feature selection techniques, Shen et al. use the cumulative length of a sequence of packets as the traffic feature to fingerprint different webpages of a website with a K-NN classifier. They use encrypted traffic as raw data, but their approach is different from ours as their goal is to classify different webpages of one particular website [13]. Here, we try to distinguish different websites from each other, having users visit different random webpages of each website. Salman et al. develop a multi-level classifier using ConvNet architecture, along with other deep learning classification methods to detect various applications on different network requirements of QoS and security policies [14]. They use a hierarchical approach to classification, starting from classes of interactive, streaming, bulk data transfer, and the transaction traffic to subcategories such as video calls, voice calls, and texting. The multi-level classifier can then continue to detect different applications and devices. They use a feature selection method and extract the size, interarrival time, direction, and transport protocol of the first packets of the flow.
In this paper, we use a feature selection approach and combine it with deep learning to develop a classifier that can predict the websites visited by a user. Our proposed website prediction aims to investigate whether the TLS handshake protocol guarantees users with enough confidentiality or an adversary or a recommender system can infer the user's activity from the TLS handshaking.
In this regard, we extract the server name field as the main feature of packets. It is an unencrypted field in the Client Hello packet of the handshake protocol used in TLSv1.2 and TLSv1.3. Using this feature mitigates the need to analyze the encrypted traffic to discover any leakage of information. Figure 1 shows the structure of the Client Hello packets and the positions of the server name field within. We take a similar approach to [11], and use the time sequential quality of the traffic flow for our classification task. They use a convolutional neural network combined with a Long Short-Term Memory (LSTM) model to extract the packet-level and flow-level information and use that information to distinguish the application class of the traffic flow.
In this work, we try to identify the set of websites visited by a user from a given traffic flow using Long Short-Term Memory (LSTM) [15]. Our model works by using any 20 consecutive Client Hello packets from the flow and predicts the websites responsible for the generated traffic. By using the server name, this work can be considered as the followup work of [16]. The model provided in [16] predicts the server names from an encrypted TLS application data. As a result, by combining the model presented in this work with the technique presented in [16], one can predict the user activity (e.g., visited websites) using only encrypted data of TLS flow, without any additional information from unencrypted parts of packet, proving that the newly found flaws by [16] on the TLS protocol is critical. Figure 2 presents our framework for website prediction.
Despite the wide use and development of Internet traffic classification, to the best of our knowledge, there has been no method that can name all the activities generating a traffic flow. Considering the great possibility of having users multitask on the Internet, e.g., visiting multiple websites at a time, we must develop a model that considers this possibility and classifies a set of possible labels as the classification task. In this work, we address this issue by developing a multi-label classifier trained on a dataset labeled with more than one website.
The key contributions of this paper are summarized as follows: • Our proposed method does not need feature extractions, nor deals with the encrypted payload. The only feature used is the unencrypted server name field in the TLS protocol. • We consider the sequential characteristics of the Internet traffic flow using a recurrent neural network to extract the time sequence information. • In this paper, we tackle the problem of multitasking behavior of the users. We develop a multi-label classifier that predicts a set of websites visited at the same time. Applying our method for any initial choice of n websites requires only O(n 2 ) labels. • Our experimental results are comparable to those of stateof-the-art works. Our proposed model has achieved an accuracy of 95.5% on the test dataset. • The dataset gathered for this work contains the newest versions of the TLS protocol applied in real-world set-tings.
The rest of the paper is organized as follows. Section II introduces our data collection method and the data-set. Sections III and IV elaborate on the method architecture, the experiments, and their results. Finally, the conclusion sums up the paper's purpose and the method proposed.

II. DATA COLLECTION
A classifier's performance highly depends on the adequacy of the training data. To collect the dataset, we used a webcrawling process, and gathered the .pcap files generated from the traffic flow of visiting a set of websites. Here we explain our data collection approach and the datasets generated.

A. Data collector system
To create our dataset, we used 20 websites based on the Alexa list of most visited websites on the Internet. To generate the .pcap files, we used a Selenium-based crawler to visit random entry pages of selected websites. The tcpdump tool is used to generate the .pcap files created while visiting the pages. Each .pcap file was then reduced to the server name field of Client Hello packets of TLSv1.2, or TLSv1.3 handshake protocol appeared in it chronologically. As a result, for each initial .pcap file, we make a list of server names. Server names in Client Hello TLS handshake packets are unencrypted; thus, they are useful to extract information about the flow.

B. Datasets
In this section, we present our three datasets collected for the multi-tasking website prediction problem. The first dataset called the main dataset, consists of 20 2 labels, each label representing a possible set of three websites visited simultaneously. The second dataset, as we call it the supplementary dataset, contains more than 800 labels chosen randomly from all possible 20 3 triples, to evaluate the model's performance on never-seen samples. The final dataset, or the so called real user dataset, consists of three sub-datasets that are the traffic collected by real user activity on the Internet. We use this dataset to assess the model in a real-world environment circumstance. Here, we describe each dataset in details.
1) Main Dataset: For the main dataset used in train and test, we created 190 labels, each consisting of three websites from the twenty selected websites. These 190 labels represent all 20 2 ways that any two websites can be visited simultaneously by a user. More specifically, these 190 labels are chosen so that every two websites appear at least once in a triple. For each triple, the crawler visited 15 random entry pages of each website simultaneously and saved the .pcap file created. As a result, each .pcap file consists of all packets transferred through the network while the crawler was visiting multiple pages of three different websites at a time. This procedure is repeated 11 times for each triple.

2) Supplementary Test Dataset:
To test the model's performance on the triples not seen during the training process, we choose 843 triple labels randomly of all 20 3 possible labels we could assign to a set of three websites. We follow the same procedure used for the main dataset and capture a .pcap file for each label.
3) Real User Dataset: In addition to the test data gathered with a crawler, to evaluate the model on a traffic flow collected by a real user, we assembled three sets of datasets by searching a set of websites on a computer and clicking on random public pages of the websites, simulating what a real user would do surfing multiple websites at a time. Then, we collected a .pcap file for each label.
For the first real-user-made test dataset, we visited one website at a time and gathered the .pcap file generated. For the second real-user-made test dataset, we visited two websites at a time and collected the .pcap files, and the final real-user-made test data was collected by visiting four different websites at a time to evaluate the model on samples that were labeled with more than three websites. For the rest of the paper, we will call these datasets uni-label, binary-label, and multi-label datasets, respectively. Table I summarizes the information about each dataset.

A. Representation of the traffic flow
To train our classifiers, we use the one-hot encoding to represent both server names and single websites. For n-tuple labels, i.e., tuple, triple, and 4-tuple, we use a vector of a size of 20, i.e., the number of selected websites, with the websites in the triple as ones, and the rest as zeros.

B. Proposed models
We label each sequence of chronological server names with a label, e.g., a triple for the main dataset. We devise two multilabel classifier models that predict a set of websites for a given sequence of server names and compare their performance over the test dataset.
1) LSTM Model: The first classifier is a recurrent neural network model consisting of a hidden layer of 256 LSTM cells. These types of recurrent neural networks have proven to be a powerful tool in working with sequential data. All Main dataset  Triple  190  Supplementary  Triple  843  Uni-label real-user dataset  Single  10  Binary-label real-user dataset  Tuple  9 Multi-label real-user dataset 4-Tuple 7  the initial LSTM cell states are zero, and the time sequence used is T = 20, and a learning rate of 0.01. We take an early stopping approach to prevent the over-fitting of the model. To tackle the problem of simultaneous website visiting, the final layer of the model works as a multi-label classifier by using sigmoid cross-entropy cost function on the logits and Adam Optimizer [17]. Figure 3 gives a visual representation of this model.

2) Fully-Connected Model:
To prove our point that the information provided by the packets' sequence is beneficial, we developed a regular fully-connected neural network as our alternative model. This model consists of 3 hidden layers with 256, 218, and 64 neurons. A dropout rate of 0.2 is used to avoid overfitting. Similar to the LSTM model, we use a sigmoid cross-entropy cost function to have a multi-label classifier. The training procedure runs for 50 epochs.

IV. EXPERIMENTS
We split the main dataset randomly into train and test sets with 85% and 15% portions of the dataset, respectively. We also use two additionals test datasets explained in Section II to evaluate our model. To train the LSTM model, each time we randomly choose a label (i.e., a .pcap file regarding that label) and a starting index in the set of consecutive server names appeared in the .pcap file. We then transform the sequence of server names to their one-hot representation and feed this sequence to the network. To measure the accuracy, we calculate the average number of correctly predicted, either existing or non-existing websites in the label. The accuracy is estimated as follows: where TP, FP, TN, and FN stand for True Positive, False Positive, True Negative, and False Negative respectively. To train the fully-connected model, each .pcap file is represented by the server names frequency vector that appeared in it. Using this representation, the traffic flow information, i.e., the server names' chronological order, is lost. All the layers, except for the last layer of this model, use the ReLU activation function. The accuracy of this model is estimated similarly to the LSTM model described in (1) Table II compares the performance of these two models on the main dataset test set. The LSTM model and the fully-connected model have achieved accuracies of 95.5% and 92.7%, respectively. Figure 4 compares the accuracy of each website class on the main test set. The significant difference between the achieved accuracies of the two models indicates that the server name appearing in a .pcap file have to be viewed from a time-sequence perspective, rather than eliminating the inherent time-sequence quality of the traffic flow (p = 0.0001804 < 0.01, paired t − test). Figure 5 displays the recall, precision, and F1 score regarding each website of the LSTM model.    To measure the performance of the models given a real user, we tested it on the real-made datasets addressed in section II. Table III compares the achieved accuracies of the LSTM and the fully-connected models on the uni-label real-user and the binary-label real-user datasets. The obtained results prove that the LSTM model can successfully predict a set of websites a real user is visiting simultaneously in a complex network, and be used in real-world environments. We tested only the LSTM model on the real-user-multi-label dataset, as it had outperformed the fully-connected model on all previous datasets. The LSTM model achieved an accuracy of 87.18% on the multi-label dataset. On average, it can predict 2.9 out of 4 labels correctly.
To further assess the LSTM model's performance on a set of new labels that are not seen during the training process, we employ the supplementary dataset collected in Section II. The LSTM model could successfully achieve an accuracy of 93.21% on this dataset, which contained new labels. This result can be explained by knowing that the main dataset labels are selected so that all 190 possible ways of having any two websites in a triple were covered.
For final performance measurement, we remove server names that included the websites' names in them from the main test set. For example, server name 1sn34.ebay.com was removed from its respective .pcap files since it contained ebay.com. The dataset still kept its sequential quality, but some server names were removed from the flow. In this scenario, the LSTM model achieved an accuracy of 93.82%. This result emphasizes that the model can predict the websites visited by the user, even when the server names do not leak any specific information about the websites' names.

V. CONCLUSION
In this paper, we proposed a novel framework that classifies internet packets to discover users' activities surfing on the internet. To the best of our knowledge, our framework is the first to predict more than one activity done by the users at a time, considering the multitasking inherent nature of working with the internet. We use an unencrypted feature of the TLS handshake protocol, and a recurrent neural network model with LSTM cells to extract the features of the packet flow in a time sequence. Experiment results have shown that considering the information from the sequential character of the traffic flow by using an LSTM model, outperforms looking at the whole flow at once. Furthermore, our framework can be used for any combination of websites since it needs no more than O(n 2 ) triple labels. We conclude that the unencrypted information in the TLS handshake protocol packets used along with the sequential nature of the traffic flow can leak specific information about the users' activity that may be favored confidential.