*Article* **An LSTM-Based Deep Learning Approach for Classifying Malicious Traffic at the Packet Level**

#### **Ren-Hung Hwang \*, Min-Chun Peng, Van-Linh Nguyen and Yu-Lun Chang**

Department of Computer Science and Information Engineering, National Chung Cheng University, Chiayi 62102, Taiwan

**\*** Correspondence: rhhwang@cs.ccu.edu.tw

Received: 12 July 2019; Accepted: 14 August 2019; Published: 19 August 2019

**Abstract:** Recently, deep learning has been successfully applied to network security assessments and intrusion detection systems (IDSs) with various breakthroughs such as using Convolutional Neural Networks (CNN) and Long Short-Term Memory (LSTM) to classify malicious traffic. However, these state-of-the-art systems also face tremendous challenges to satisfy real-time analysis requirements due to the major delay of the flow-based data preprocessing, i.e., requiring time for accumulating the packets into particular flows and then extracting features. If detecting malicious traffic can be done at the packet level, detecting time will be significantly reduced, which makes the online real-time malicious traffic detection based on deep learning technologies become very promising. With the goal of accelerating the whole detection process by considering a packet level classification, which has not been studied in the literature, in this research, we propose a novel approach in building the malicious classification system with the primary support of word embedding and the LSTM model. Specifically, we propose a novel word embedding mechanism to extract packet semantic meanings and adopt LSTM to learn the temporal relation among fields in the packet header and for further classifying whether an incoming packet is normal or a part of malicious traffic. The evaluation results on ISCX2012, USTC-TFC2016, IoT dataset from Robert Gordon University and IoT dataset collected on our Mirai Botnet show that our approach is competitive to the prior literature which detects malicious traffic at the flow level. While the network traffic is booming year by year, our first attempt can inspire the research community to exploit the advantages of deep learning to build effective IDSs without suffering significant detection delay.

**Keywords:** deep learning for network security; long short-term memory; malicious traffic classification
