Hybrid N-gram-based framework for payload distributed denial of service detection and classification
Abstract
There are three primary approaches to DDoS detection: anomaly-based, pattern-based, and heuristic-based. The heuristic-based method integrates both anomaly- and pattern-based techniques. However, existing DDoS detection systems face challenges in performing HTTP payload-level analysis, mainly due to high false positive rates and insufficient granularity in current datasets. To address this, the study introduces a novel heuristic approach based on a hybrid N-Gram model. This hybrid combines two components: CSDPayload+N-Gram and CSPayload+N-Gram. CSDPayload represents the gap (measured via Chi-Square Distance) between a given payload and normal traffic payloads, while CSPayload reflects the similarity (measured via Cosine Similarity) between them. These metrics form a new feature set evaluated using three datasets: CIC2019, MIB2016, and H2N-Payload. The methodology begins with packet extraction and conversion of TCP/IP traffic—specifically HTTP traffic—into hexadecimal payloads. N-Gram analysis (from 1-Gram to 6-Gram) is then applied to these payloads. For each N-Gram, frequency counts are computed, followed by calculations of Chi-Square Distance (CSD), Cosine Similarity (CS), and Pearson’s Chi-Square test to classify payloads as either benign or malicious. Subsequently, feature selection is performed using weight correlation, and the resulting features are fed into three machine learning classifiers: Support Vector Machine (SVM), K-Nearest Neighbors (KNN), and Neural Network. Experimental results demonstrate high detection accuracy, particularly in the 4-Gram feature category: Neural Network achieves 99.65%, KNN 95.14%, and SVM 99.73% accuracy on average.
Keywords
Chi square; Cosine similarity; DDoS; Network; Payload
Full Text:
PDFDOI: http://doi.org/10.11591/ijai.v14.i6.pp4763-4774
Refbacks
- There are currently no refbacks.
Copyright (c) 2025 Andi Maslan, Cik Feresa Mohd Foozy, Kamaruddin Malik Bin Mohamad, Abdul Hamid, Dedy Fitriawan, Joni Hasugian

This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
IAES International Journal of Artificial Intelligence (IJ-AI)
ISSN/e-ISSN 2089-4872/2252-8938
This journal is published by the Institute of Advanced Engineering and Science (IAES).