1. INTRODUCTION
The internet has become a central communication medium, making the security and privacy of its communications increasingly important. Essential internet traffic includes Domain Name System (DNS) traffic, which translates humanreadable domain names into IP addresses recognized by computers. DNS over HTTPS (DoH) improves privacy by encrypting DNS queries, making users’ browsing activity harder to monitor. However, this integration also creates new challenges for traffic classification and security monitoring. An important task in analyzing DNS test traffic, particularly DoH and related protocols such as DNS over HTTPS carried over HTTP/3 by browsers, is distinguishing traffic classes in order to assess system security risks [1, 2, 3].
Traffic classification sorts data according to network-traffic characteristics. In DNS traffic analysis, classification algorithms can help distinguish regular traffic from traffic that may indicate security problems or malicious activity. Analysis of DoHBrw traffic is challenging because DNS traffic is encrypted with HTTPS and carried over HTTP/3 by browsers, introducing new challenges for traffic-analysis methods [3, 4, 5].
This paper examines classification approaches for DNS test traffic that incorporates DoHBrw. It compares machinelearning models using traffic characteristics such as packet sizes, timing patterns, and signatures typical of DoH and DoHBrw. The aims are to develop and assess classification models, distinguish DNS traffic types, detect potential threats in DNS queries, and evaluate the contribution of DoH to DNS security [6, 2, 7].
Accurate categorization of encrypted DNS traffic can help security programs identify anomalies such as DNS tunneling and denial-of-service attacks. Understanding DoHBrw traffic characteristics can therefore inform the tools and protocols used to manage and secure DNS traffic. Information from classification models may also support traffic monitoring and DoH protocol implementations [4, 8, 9]. Classification of DNS test traffic involving DoHBrw is con-sequently relevant to the analysis and protection of contem-porary DNS communications. This study aims to improve understanding of DNS traffic characteristics and support ef-fective monitoring and protection, contributing to the devel-opment of DNS security in response to modern technologies and threats.
2. RELATED WORKS
DNS traffic classification, particularly for DNS over HTTPS (DoH) with browser-based rewriting (DoHBrw), is an ac-tive topic in network security and privacy. Classification approaches have been applied to analyze network traffic, se-cure DNS, and detect threats. Decision trees and random forests are commonly used to classify DNS traffic patterns and detect anomalies. Decision trees partition traffic according to features such as packet size, timing, and destination IP address. Random forests combine multiple trees to model complex DNS traffic patterns [10, 3]. Support Vector Machines (SVMs) have been used in DoH-tunneling and encrypted-traffic classification, where they can operate in high-dimensional feature spaces and model nonlin-ear relationships [11, 3].
Neural networks and convolutional neural networks can ex-tract complex structures and relationships from raw traffic data, including encrypted DNS queries and traffic correla-tions. Deep-learning approaches have been applied to detect malicious DoH traffic and DNS tunnels [12, 3]. Machine-learning intrusion-detection methods have also been used to identify malicious DNS traffic [7].
Intrusion detection systems (IDSs) use classification algo-rithms to monitor network traffic for possible intrusions. Machine-learning-based IDSs can extend detection beyond fixed attack signatures by learning from traffic patterns [13, 7].
Feature selection and engineering can improve classification performance. Features such as query length, encryption flags, and timing information can make raw traffic data more useful to a classifier. Feature fusion and traffic-feature selection have also been studied for DoH and encrypted traffic [11, 14]. Research on encrypted DNS also emphasizes balancing traffic analysis with users’ confidentiality and privacy [14]. Machine-learning and ensemble approaches have been ex-plored to improve the accuracy and reliability of DNS traffic analysis [7, 3]. Prior work also describes the use of classifica-tion techniques to identify security threats in DoH and other encrypted traffic [7].
3. DATASET DESCRIPTION
3.1 Overview of the DoHBrw-2020 Dataset
The DoHBrw-2020 dataset contains real network traffic collected to investigate and benchmark the DoH protocol. It was compiled by the Canadian Institute for Cybersecurity (CIC) at the University of New Brunswick with assistance from the Canadian Internet Registration Authority (CIRA) [9].
DoHMeter, a tool designed for aggregated DoH traffic analysis, was used to create the dataset. It identifies and categorizes network traffic in real time, separating normal and abnormal activity over both traditional DNS and DoH. The dataset is intended to support the development and evaluation of techniques for monitoring attacks concealed by DoH traffic.
The dataset is divided into multiple CSV files containing network-flow records. These records include timestamps, source and destination IP addresses, protocol and packet-size information, indicators of DNS or DoH traffic, and labels for benign or malicious traffic. The flow records provide data for training and testing machine-learning algorithms for secure DNS traffic classification.
3.2 Data Preprocessing
Several preprocessing steps were used to prepare the DoHBrw-2020 dataset for model training:
- Data cleaning: Missing values and data gaps were checked. Incomplete or erroneous records were corrected or removed, and features that did not contribute to classification, such as constant-valued columns or identifiers, were excluded.
- Normalization: Features with different scales, such as packet sizes and time intervals, were normalized, commonly to the range 0–1, to prevent any single feature from dominating the model.
- Feature selection: Correlation analysis and featureimportance ranking were used to identify features associated with the traffic-classification label. This step reduced the feature set and the likelihood of overfitting.
- Dataset splitting: The preprocessed data were divided into training and test sets so that model performance could be evaluated on unseen data. Common splits include 80/20 and 70/30.
Figure 1 presents the dataset’s feature-correlation matrix. The heatmap makes the direction and strength of pairwise linear relationships visible, helping to identify feature interactions relevant to modeling and feature engineering.
Figure 2 shows the ten most important features in the dataset. Feature-importance information can help guide feature selection and model development.
4. METHODOLOGY
4.1 Machine-Learning Models
This study uses the DoHBrw-2020 dataset and several machine-learning methods to classify DoH traffic and detect its presence in the analyzed data. The models were selected to cover different approaches to identifying malicious traffic in encrypted communications.
- Decision Tree: A tree-based classifier that successively partitions the dataset according to feature values. It can handle numerical and categorical data and is relatively easy to interpret.
- Support Vector Machine (SVM): A classifier that seeks a separating hyperplane between classes. A linear SVM was used, which can be effective when classes are separable in the feature space and is suited to settings with many features and relatively few samples.
- K-Nearest Neighbors (KNN): A non-parametric classifier that assigns a class based on the majority class among the k nearest training samples. It can model nonlinear decision boundaries.
- Naive Bayes: A classifier based on Bayes’ theorem that assumes feature independence. Despite this simplifying assumption, it can be efficient on large datasets with many features.
- Neural Network (MLP): A multilayer perceptron with input, hidden, and output layers that can learn complex, nonlinear relationships.
- Gradient Boosting: An ensemble method that trains weak models sequentially, with each model attempting to correct errors made by its predecessors.
- SVM with RBF kernel: An SVM variant that uses a radial basis function kernel to map data into a higher-dimensional space for classification.
These models were selected to provide diverse approaches to encrypted-traffic classification and to compare their effectiveness at detecting malicious traffic.
4.2 Evaluation Metrics
Model performance was evaluated using accuracy, sensitivity (true positive rate, TPR), specificity (true negative rate, TNR), positive predictive value (PPV), negative predictive value (NPV), and F-score. Here, TP, TN, FP, and FN denote true positives, true negatives, false positives, and false negatives, respectively:
Accuracy = TP+TN TP+TN +FP+FN , (1)
Sensitivity = TP TP+FN , (2)
Specificity = TN TN +FP, (3)
PPV = TP TP+FP, (4)
NPV = TN TN +FN , (5)
F-score = 2PPVSensitivity
PPV+Sensitivity. (6)
Sensitivity measures the proportion of malicious-traffic instances correctly identified, while specificity measures the proportion of benign instances correctly identified. PPV and NPV describe the reliability of positive and negative predictions, respectively. The F-score is the harmonic mean of precision (PPV) and recall (sensitivity), making it useful when class imbalance is present. Together, these metrics compare model accuracy while accounting for threat detection and false alarms.
5. RESULTS
The models were evaluated on DoHBrw-2020 to compare their ability to detect malicious traffic in encrypted DNS flows. Table 1 summarizes their performance across the evaluation metrics.
The Decision Tree achieves the highest accuracy, sensitivity, specificity, and F-score in Table 1. Its tree structure can represent feature relationships useful for classifying encrypted DNS traffic. The high TPR values for Decision Tree and Gradient Boosting indicate that both identify malicious traffic effectively. The Decision Tree’s specificity also corresponds to fewer benign instances being incorrectly flagged. The linear and RBF SVM models show competitive performance, though below that of the Decision Tree in this comparison.
Figure 3 presents the accuracy values plotted for the machinelearning models. The figure provides a visual comparison of the models’ correct-prediction rates.
Figure 4 compares model sensitivity, or the ability to identify positive (malicious-traffic) cases. This measure is important when missing a threat has serious consequences.
Overall, the results indicate that Decision Tree and Gradient Boosting are among the most effective models for classifying secure DNS traffic in the DoH setting. These findings can inform further research and the development of frameworks for detecting improper DNS activity.
6. CONCLUSION
This study compared machine-learning models for analyzing DoH traffic and distinguishing legitimate from malicious activity using the DoHBrw-2020 dataset. The evaluated models were Decision Tree, linear SVM, SVM with an RBF kernel, KNN, Naive Bayes, MLP, and Gradient Boosting. The Decision Tree achieved the highest accuracy (99.65%) and strong sensitivity, specificity, and F-score, supporting its use in secure DNS traffic classification. Gradient Boosting also performed well in sensitivity and may be useful when detecting positive cases is the primary concern.
The findings demonstrate the potential of machine learning to improve the detection of threats concealed within encrypted traffic. Because cyber threats and network traffic continue to evolve, further work is needed to develop these models and improve comprehensive, dependable DNS traffic analysis as part of modern security strategies.