Ddos Detection and Mitigation in SDN Using Onos Controller: Dr. Shashank Srivastava
Ddos Detection and Mitigation in SDN Using Onos Controller: Dr. Shashank Srivastava
by
Ayush Gupta (20168024)
Shubham (20168045)
Anukul Joshi (20168056)
Ajeet Prasad (20168085)
Group: IT-04
to the
COMPUTER SCIENCE AND ENGINEERING DEPARTMENT
MOTILAL NEHRU NATIONAL INSTITUTE OF TECHNOLOGY
ALLAHABAD, PRAYAGRAJ, UTTAR PRADESH (INDIA)
June, 2020
UNDERTAKING
I declare that the work presented in this report titled “DDoS Detection and Mitigation
in SDN using ONOS controller”, submitted to the Computer Science and Engineering
Department, Motilal Nehru National Institute of Technology Allahabad, Prayagraj,
Uttar Pradesh (India) for the award of the Bachelor of Technology degree in
Information Technology , is my original work. I have not plagiarized or submitted
the same work for the award of any other degree. In case this undertaking is found
incorrect, I accept that my degree may be unconditionally withdrawn.
June, 2020
Prayagraj
U.P. (India)
(Ayush Gupta)
(Shubham)
(Anukul Joshi)
(Ajeet Prasad)
‘
ii
iii
Preface
We hereby present the project on DDoS Detection and Mitigation in SDN (Software
Defined Networking)using ONOS controller. The controller that we used is ONOS.
ONOS is based on the principle of SDN. In SDN we have various controllers which
help us in network monitoring, defining rules for the network management, identifi-
cation of anomalies etc. in an efficient manner. In this project we have performed
DDoS attacks (SYN flood and ICMP flood attacks) on a targeted single host with
ONOS controller managing the network components. Then network traffic details
and statistics are collected using ONOS APIs and openflow protocol which helps us
in creating the dataset. Various machine learning techniques are then applied on the
dataset to analyse and gain useful insights from the data. We have also performed
live detection and mitigation of the attacks. Detection is performed by testing the
incoming traffic against the machine learning model that we have already trained
and once the attack is detected, mitigation is performed with the ONOS application
running at the controller which installs new flow rules in the flow tables at switches
to stop the attack.
We declare that we have taken help from the internet whose references have been
stated. We have also taken immense help and guidance from our mentor Dr.
Shashank Srivastava. We hope this thesis proves helpful to its readers.
iv
Acknowledgements
We are very grateful to our mentor Dr. Shashank Srivastava Sir for giving us an
opportunity to learn something new. We take this opportunity to thank him for
the encouragement, sound advice and lots of good ideas and suggestions during the
project.
We would also like to thank Dr. Shashwati Banerjea for formation of groups for
projects which enabled us to work on this project.
We are also thankful to Mr. Naveen Kumar for his constant guidance throughout
the project.
Further, we thank all the teaching and non-teaching staff of the Department of
Computer Science and Engineering for their constant assistance and co-operation.
We would also like to thank the Linux Foundation for hosting the ONOS project as
an open source project.
v
Contents
Preface iv
Acknowledgements v
1 Introduction 1
1.1 Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2 Related Work 4
3 Proposed Work 6
3.1 Attacks Performed . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3.1.1 SYN Flood . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3.1.2 ICMP Flood . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
3.2 Tools Used . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.2.1 ONOS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.2.2 Mininet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.2.3 Maven . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.2.4 Bazel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.2.5 hping3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3.2.6 Mausezahn . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3.2.7 sFlow-rt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
3.3 Creation of Data Set . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
3.3.1 Generating Normal Traffic . . . . . . . . . . . . . . . . . . . . 12
3.3.2 Generating DDoS Attacks Traffic . . . . . . . . . . . . . . . . 12
3.3.3 Collecting Statistics using ONOS APIs . . . . . . . . . . . . . 12
3.4 Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
vi
3.4.1 Multi Layer Perceptron(MLP) . . . . . . . . . . . . . . . . . . 14
3.4.2 K Nearest Neighbours (kNN) . . . . . . . . . . . . . . . . . . 15
3.4.3 Support Vector Machine(SVM) . . . . . . . . . . . . . . . . . 16
3.4.4 Performance Evaluation . . . . . . . . . . . . . . . . . . . . . 17
3.5 Live Detection and Mitigation . . . . . . . . . . . . . . . . . . . . . . 19
3.5.1 Worflow using Openflow for collecting Data . . . . . . . . . . 20
3.5.2 Workflow using sflow-RT and its limitations . . . . . . . . . . 22
References 48
vii
Chapter 1
Introduction
A world without internet cannot be imagined. And internet service is not possible
without the underlying networking infrastructure. Traditional networking princi-
ples have now become old and new paradigm for network management called SDN
(Software Defined Networking) has emerged. In a Software Defined Network, a net-
work engineer or administrator can shape traffic from a centralized control console
without having to touch individual switches in the network. The centralized SDN
controller directs the switches to deliver network services wherever they’re needed,
regardless of the specific connections between a server and devices. The basis of
SDN is virtualisation, which in its most simplistic form allows software to run sep-
arately from the underlying hardware.
1. The control and data planes are decoupled. Control functionality is removed
from network devices that will become simple (packet) forwarding elements.
DDoS has remained a nightmare for industries and academia since last decade.
1
SDN came with a hope of solving the critical problem of DDoS detection and mit-
igation. But due to design issues of OpenFlow and centralized point of control,
it has been found vulnerable to DDoS Attack. DDoS attacks are dangerous and
can potentially bring down networks. In SDN environment, an OpenFlow switch
matches the flow input by checking the packet header. In case of no match, packet
is forwarded to the controller which writes a flow rule for such packets and forwards
it to switch flow tables. At the time of a DDoS attack, large number of packets
(with the spoofed IP addresses) are sent to the controller. And hence the controller
becomes overwhelmed with these packets and is unable to process the legal packets.
Also since a lot of new flow rules are forwarded to the switches, the flow tables with
limited capacity become full and thus legal traffic transmission halts. Hence both
the controller and switches can be attacked. Therefore, this paper provides mech-
anisms to tackle the DDoS attacks in SDN, and found Open Network Operating
System (ONOS) as an ideal as well as an unexplored controller to perform the task.
We aim to explore the different types of DDoS attacks that may be performed on
an SDN controller and lists out the prominent features that reflect unusual traffic.
Further, machine learning algorithms are used to classify the legitimate traffic and
the attack traffic. The model generated from the application of these algorithms
would help to detect DDoS attacks in real time and also mitigate them.
2
1.1 Motivation
The separation of the control plane from the data plane of a switch enables abstrac-
tion of a network through a logically centralized controller. The controller functions
as the “brain” of a software-defined network. However, centralized control draws
attackers to exploit different network devices by hijacking the controller. Security
was initially not a key characteristic of SDN architecture, which left it vulnerable
to various attackers. The investigation of such attacks in the newly emerging SDN
architecture is a challenging task. Therefore, a comprehensive forensic mechanism
is required to investigate different forms of attacks by determining their root cause.
DDoS attacks are dangerous and can potentially bring down network causing
immense loss to the victim. Since the number of such attacks are increasing at a
very high pace day by day, hence we wanted to find mechanisms to tackle the DDoS
attacks in SDN and we found ONOS as an ideal controller to perform our task.
By making use of machine learning techniques to first train the model and then
applying it to test the incoming unknown traffic, we try to detect any such attempt
made by attackers before they victimize the entire network.
3
Chapter 2
Related Work
There has been some research and development in the field of DDoS attacks in SDN
environment in the previous years. Dayal et al. [1] analysed the various DDoS at-
tacks in SDN architecture and compares and contrasts these attacks on how they
affect the system.
Mohan et al. [2] discussed the solution to various attacks possible in SDN including
denial of service to network and to the controller. Generally, the DDoS attack de-
tection module in SDN is based on statistical analysis or static policy which helps
in detecting volumetric attacks. For the detection of the different class of DDoS
attack including volumetric, reflection and protocol exploitation, traffic analysis is
cumbersome and its analysis through machine learning paves a way of efficient DDoS
detection.
For the SDN paradigm, Braga et al. in [3] first and foremost suggested the use
of Self-organizing map (SOM) to classify network flows. They proposed a feature
set for the detection of DDoS attack in SDN based infrastructure. Exploiting the
proposed feature set, the SOM-based classifier classifies the flow as malicious or le-
gitimate.
Kokila et al. [4] proposed and implemented SVM based model in SDN controller
for identifying DDoS attack and obtained less false positive results as compared to
other classifiers like Random Forest, J48, Radial Basis Function (RBF) and Naı̈ve
Bayes.
Gabriel et al. [5] and Cui et. al. [6] used Neural Network in their proposed DDoS
4
detection model for analyzing network flows to identify malicious behavior. Tree
based method XGBoost is used by [7].
Bawany et al. [8] proposed a detection and mitigation mchanism of DDoS attacks
in a large-scale network, but the same is not suitable for small-scale network.
Latah and Toker [9] used two staged approach to detect the DDoS attacks. First
they would measure the rate of the arriving packets in the network based on statis-
tics collected by controller. When packet rate passed the pre-determined threshold,
an inspection unit that used SVM was activated to detect DDoS flooding attacks.
Ye et al. [10] collected the data traffic by means of the controller. Six features re-
lated to DDoS attacks were extracted and SVM was employed to detect the attack.
For UDP and TCP attacks, high accuracy was reported. But for the ICMP attack,
low accuracy rate was reported due to the fact that they considered no. of source
port per unit time as one of the features and ICMP flow has no source or destination
port.
This report discusses the various attacks performed in SDN environment and pro-
poses a solution to detect such attacks by developing a machine learning based
trained model. The features are selected in such a way so that they can used to
detect various types of attacks with a high accuracy and avoid the limitations of
previously discussed approaches.
5
Chapter 3
Proposed Work
The proposed DDoS detection system consists of data collection, analysing the data
collected, applying machine learning techniques to detect whether an attack attempt
has been made and then mitigating the attack. To create SDN network topology,
mininet network emulator is used. Mininet creates a network of virtual switches
supported openflow for flexible and customized routing, host and links. There are
variety of open source SDN controllers like RYU, Floodlight, OpenDay Light, POX
etc. We chose ONOS as a controller for managing the network topology created by
mininet. The flowchart below describes the different steps that were involved.
6
3.1 Attacks Performed
3.1.1 SYN Flood
A SYN flood (half-open attack) is a type of denial-of-service (DDoS) attack which
aims to make a server unavailable to legitimate traffic by consuming all available
server resources. Here’s how it works:
1. The attacker sends a high volume of SYN packets to the targeted server, often
with spoofed IP addresses
2. The server then responds to each one of the connection requests and leaves an
open port ready to receive the response.
3. While the server waits for the final ACK packet, which never arrives, the
attacker continues to send more SYN packets. The arrival of each new SYN
packet causes the server to temporarily maintain a new open port connection
for a certain length of time, and once all the available ports have been utilized
the server is unable to function normally [21].
7
3.1.2 ICMP Flood
An icmp flood is a denial-of-service attack in which the attacker attempts to over-
whelm a targeted device with ICMP echo-request packets, causing the target to
become inaccessible to normal traffic. ICMP flood can be broken down into 2 re-
peating steps:
1. The attacker sends many ICMP echo request packets to the targeted server
using multiple devices.
2. The targeted server then sends an ICMP echo reply packet to each requesting
device’s IP address as a response [22].
8
3.2 Tools Used
The important setup tools that have been used are ONOS, Mininet and maven which
are describes as follows.
3.2.1 ONOS
ONOS stands for Open Network Operating System. ONOS provides the control
plane for a software-defined network (SDN), managing network components, such
as switches and links, and running software programs or modules to provide com-
munication services to end hosts and neighboring networks.
OpenFlow is the communications protocol that gives access to the forwarding
plane of a network switch or router over the network [11].
3.2.2 Mininet
Mininet is a network emulator which creates a network of virtual hosts, switches,
controllers, and links. Mininet hosts run standard Linux network software, and its
switches support OpenFlow for highly flexible custom routing and SDN [12].
3.2.3 Maven
Maven is a build automation tool used primarily for Java projects. Maven can
also be used to build and manage projects written in C, Ruby, Scala, and other
languages. The Maven project is hosted by the Apache Software Foundation.
Since the ONOS apps are written using Java language, maven was used to build
the app and create an oar file which was then installed using ONOS cli.
3.2.4 Bazel
Bazel is a tool that automates software builds and tests. Supported build tasks
include running compilers and linkers to produce executable programs and libraries,
and assembling deployable packages for Android, iOS and other target environments.
9
Bazel is similar to other tools like Make, Ant, Gradle, Buck, Pants and Maven.
Features of bazel are:
• Multi-platform support: The same tool and the same BUILD files can be used
to build software for different architectures, and even different platforms [13].
Bazel has been used to first build the ONOS project and then to run it locally.
3.2.5 hping3
hping is a command-line oriented TCP/IP packet assembler/analyzer. The interface
is inspired to the ping(8) unix command, but hping isn’t only able to send ICMP echo
requests. It supports TCP, UDP, ICMP and RAW-IP protocols, has a traceroute
mode, the ability to send files between a covered channel, and many other features
[14]. hping is a widely used tool for performing DDoS attacks. It provides a lot of
options to adjust the traffic according to the requirements.
3.2.6 Mausezahn
Mausezahn is a free fast traffic generator written in C which allows you to send nearly
every possible and impossible packet. It is mainly used to test VoIP or multicast
networks but also for security audits to check whether your systems are hardened
enough for specific attacks [15]. Mausezahn can be used for generating traffic gen-
erator (e. g. to stress multicast networks), for penetration testing of firewalls, for
DDoS attacks on networks (for testing purposes) etc.
10
Mausezahn is basically a versatile packet creation tool on the command line with
a simple syntax. Currently Mausezahn is only available for Linux platforms. It is
also a widely used tool for performing DDoS attacks.
3.2.7 sFlow-rt
sFlow-rt provides real-time analytics for actionable intelligence to support Devel-
opers and SDN applications. sFlow-RT receives a continuous stream of telemetry
from standard sFlow agents embedded in network devices, hosts and applications
and converts them into actionable metrics, accessible through a REST API [16].
11
3.3 Creation of Data Set
3.3.1 Generating Normal Traffic
60% percent of our dataset contains the normal traffic that would be generated
when normal usage of the network is going on. The normal traffic has been gen-
erated using mausezahn/hping3 commands by sending the data between multiple
source/destination pairs. Different types of traffic including TCP, UDP, ICMP and
DNS packets etc. were sent during the normal traffic.
• Average bytes per flow(bps in and bps out): Bytes(bytes-in and bytes-
out) per flow will be high during an attack phase, making it an important
feature in the identification of DDoS attack.
12
• Entropy of source IP address per second: As DDoS attack is distributed
in nature, i.e. the attack sources are either distributed in the network via a
bot or attacker is using spoofed IP addresses to attack the victim. Hence, the
randomness of source IP addresses in the attack flows will be quite high.
13
3.4 Testing
3.4.1 Multi Layer Perceptron(MLP)
A multilayer perceptron (MLP) is a feedforward artificial neural network that gen-
erates a set of outputs from a set of inputs. An MLP is characterized by several
layers of input nodes connected as a directed graph between the input and output
layers. MLP uses backpropagation for training the network.
• Activation Function
The activation function combines the input to the neuron with the weights
and then adds a bias to produce the output. In other words, the activation
function maps the weighted inputs to the output of the neuron. One of such
activation functions is the sigmoid function which is used to determine the
output of the neuron. Another types of activation function that can be used
are the Rectified Linear Unit (ReLU) or the tanh function.
There are 3 types of layers. They are Input, Hidden and Output layers respectively.
• Input or Visible Layers - The bottom layer that takes input from your
dataset is called the visible layer, because it is the exposed part of the network.
Often a neural network is drawn with a visible layer with one neuron per input
value or column in your dataset.
• Hidden Layers - Layers after the input layer are called hidden layers because
that are not directly exposed to the input. The simplest network structure is
to have a single neuron in the hidden layer that directly outputs the value.
Given increases in computing power and efficient libraries, very deep neural
networks can be constructed. Deep learning can refer to having many hidden
layers in your neural network.
• Output Layer - The final hidden layer is called the output layer and it is
responsible for outputting a value or vector of values that correspond to the
format required for the problem.
The choice of activation function in he output layer is strongly constrained by
the type of problem that you are modeling.
14
Figure 4: Figure depicting working of Multi Layer Perceptron with input, hidden
and output layers [18]
15
each with a class label. The training phase of the algorithm consists only of stor-
ing the feature vectors and class labels of the training samples. In the classification
phase, k is a user-defined constant, and an unlabeled vector (a query or test point) is
classified by assigning the label which is most frequent among the k training samples
nearest to that query point. Here we used Euclidean distance as distance metric.
p
Euclidean distance between two points is given by (x1 − x2 )2 + (y1 − y2 )2
16
Figure 6: Figure depicting three hyper planes differentiating two classes and their
distances from the two classes (maximum is the best)[20]
Precision tells how precise the model is, out of those predicted positive, how many
17
of them are actual positive. It is calculated as -
TP
P recision =
TP + FP
When there is high cost associated with false negatives, recall is used. Recall tells out
of total actual positives, how many are detected by our model as positive. Formula
for recall is -
TP
Recall =
TP + FN
F1-score is a function of Precision and Recall and is relevant to determine the balance
between precision and recall. F1-score can be calculated as -
P recision ∗ Recall
F 1 − score = 2 ∗
P recision + Recall
18
3.5 Live Detection and Mitigation
• Live Detection - The models which we have trained already with the data
collected are used for detecting whether an attack has been launched or not.
The new incoming traffic is tested against the trained model and information
is sent to the ONOS app running at controller.
This entire work at the controller end would be done through the app that we built
for ONOS.
19
Figure 7: Tools used for detection
• sFlow-RT - The data statistics were collected using sflow-RT which installs an
agent on every switch in the network.
• OpenFlow - The data statistics were collected using openflow protocol and
ONOS APIs inside ONOS app.
The detailed live detection and mitigation process using Openflow protocol is ex-
plained as follows -
2. Then we created an app in ONOS that would do the work of mitigating the
attack when it happens by defining the flow rules for switches.
3. The code of the app is written in Java and build was done using maven.
20
4. Then we start the local ONOS instance, mininet to create the topology using
the commands mentioned in the next section.
5. After this a python server is started. App running at ONOS controller connects
as client to the python server. The incoming data statistics collected using
ONOS APIs in the app are sent to the server. The server analyses the incoming
traffic to find whether there is an attack or not. Prediction is done using the
stored trained models. If any of the model detects that an attack has been
launched, the result is sent as ”Attack Detected” to the app running at ONOS
controller.
6. App receives the information. Now, there are two possibilities, the result
obtained is -
(a) Attack - In this case, the controller traces back the attacker using the
tracebacking technique already mentioned above and defines a flow rule
to drop the packets sent by the attacker and destined to the victim. In
this way, we make sure that the victim host doesn’t get overwhelmed
by the huge amount of packets coming from attacker since they will be
dropped at the switch itself.
21
(b) No Attack - In this case, the normal flow in the traffic continues. Con-
troller need not take any specific action.
Here two major differences are visible from the approach used earlier.
1. Data collection - The data statistics are collected using sflow-RT tool in the
python server script. Earlier the data was being collected inside the ONOS
app itself and it was sent to the python server by the app.
Limitations -
sflow-rt is an external app which installs an agent at every switch in the net-
work. These agents are then used to collect the data statistics. This creates
an extra overhead on the switches which are already handling such a large
volume of data and this also increases the external dependencies in the app.
2. Mitigation - Mitigation of the attacks was done by creating flow rules on the
switch to which the victim was connected. Whereas in the earlier approach, the
22
flow rules are being created on the switch to which the attacker is connected.
Limitations -
Creating flow rules on the switch to which victim is connected stops the victim
from receiving the data but the attack data still travels from the attacker to the
entire network and then reaches the victim. Hence the attack data exploits
the network bandwidth and creates unnecessary load and congestion in the
network.
23
Chapter 4
#Mininet
sudo apt-get install mininet
#Maven
sudo apt-get install maven
#Bazel
sudo apt-get install bazel
#sFlow-RT
sFlow-RT folder can be downloaded from here:
https://sflow-rt.com/download.php
#Hping3
sudo apt-get install hping3
# Mausezahn
24
sudo apt-get install netsniff -ng
#Python 3.6
Python 3.6 and its packages:
sudo apt-get install python3.6
sudo apt-get install python3-pip
sudo pip3 install numpy
#starting Mininet
25
$ sudo mn --custom=filename.py
--topo topology --controller=remote,ip=127.0.0.1
26
4.4 Attacking with Hping3/Mausezahn
Next we open xterm windows from various nodes and target a node to bring it
down. We perform two of the most devastating DDoS attacks SYN flood and ICMP
flood. We chose host 10.0.0.1 as the victim and the attacks were performed from
host 10.0.0.10. The following commands are used :
#SYN flood
hping3 -S -p 80 --flood 10.0.0.1 --rand-source
mz eth0 -c 0 -t tcp dp=80,flag=syn -A rand -B 10.0.0.1
#ICMP flood
hping3 --icmp --rand-source --flood 10.0.0.1
mz eth0 -c 0 -t icmp "ping" -A rand -B 10.0.0.1
27
4.6 Data Analysis
The data was collected for normal traffic and attack traffic separately. Dataset of
total 15000 (9000 for normal traffic + 6000 for attack) tuples was created for each
attack. K-fold cross validation technique was used to evaluate the machine learning
models. Our feature vector consists of six features. Our target vector consists of
two classes to identify a flow as the attack (1) or normal traffic (0).
We have done the analysis of each attack separately. We plotted the heatmap to
find the correlation between the features, boxplots to observe how the feature values
varied during attack and no attack.
And then after applying machine learning algorithms on the dataset, we also com-
puted accuracy, precision, recall etc.
28
SYN ATTACK ANALYSIS
• Description of Dataset
• Correlation matrix
The correlation matrix shows that the attack status depends heavily on source
29
entropy. This is because we have used random source ip addresses during at-
tack. It also highly depends on destination entropy since during the attack,
enormous amount of packets are destined towards the same destination (vic-
tim) and hence the entropy is quite low.
Source entropy is very high during attack since we have spoofed the source ip
address during the attack to use random address during every frame transfer.
30
Range of destination entropy is low during an attack as one node is targeted
and comparatively high during normal packet flow.
The boxplot in Figure shows there is not much variation in the bps in param-
eter during a syn attack since it isn’t a volumetric attack.
The boxplot in Figure 15 above shows there is not much variation in the bps
out parameter during a syn attack.
31
• Relation between frames and attack vectors
The boxplot in Figure above shows there is some variation in the frames pa-
rameter during a syn attack as compared to no attack.
The boxplot in Figure shows that protocol entropy is low during attack since
large number of packets of same type are sent.
32
ICMP ATTACK ANALYSIS
• Description of Dataset
• Correlation matrix
Correlation between attack and source entropy, destination entropy, bps in,
bps out is very high. Also, mean value of bps in and bps out in case of ICMP
33
attack is quite high as compared to SYN attack since this is a volumetric
attack.
Source entropy is high since source ip has been spoofed during the attack.
Since icmp flood is a volumetric based attack, bps in are high in this case also.
34
• Relation between bps out and attack vectors
Destination entropy is low during attack as one node is targeted with large
number of packets and comparatively high during normal packet flow.
35
• Relation between frames and attack vectors
The boxplot in Figure above shows there is high variation in the frames pa-
rameter during a icmp attack as compared to syn attack.
The boxplot in Figure shows that protocol entropy is low during attack since
large number of packets of same type are sent.
36
4.7 Testing
The following classification algorithms were used to classify whether the incoming
traffic was an attack or not -
Using the above classification algorithms, confusion matrix between the predicted
label and actual label is drawn as below. Accuracy, precision, recall and f1-score are
calculated for each model as mentioned in section 3.4.4.
In both of the attacks, kNN model had the best accuracy 99.23% and 98.65% for
SYN and ICMP attacks respectively. Hence, the accuracy obtained is quite high.
Furthermore, performance in terms of precision, recall and f1-score is also great
and thus it is evident that the model is unbiased and performs really well.
37
SYN ATTACK
• k-fold Cross Validation results for MLP Classifier
Accuracy = 99.2%
Precision = 0.99
Recall = 0.99
f1 score = 0.99
Accuracy = 99.2%
Precision = 0.99
Recall = 0.99
f1 score = 0.99
Accuracy = 99.23%
Precision = 0.99
Recall = 0.99
f1 score = 0.99
38
(a) MLP - SYN attack (b) SVM - SYN attack
39
ICMP ATTACK
• k-fold Cross Validation results for MLP Classifier
Accuracy = 97.94%
Precision = 0.98
Recall = 0.98
f1 score = 0.98
Accuracy = 96.99%
Precision = 0.97
Recall = 0.97
f1 score = 0.97
Accuracy = 98.65%
Precision = 0.99
Recall = 0.99
f1 score = 0.99
40
(a) MLP - ICMP attack (b) SVM - ICMP attack
The area under ROC curve (AUC) in the case of ICMP attack is somewhat
smaller than the AUC obtained in the case of SYN attack, but is still quite high.
41
4.8 Live Detection and Mitigation
Command for creating a new app.
$ onos-create-app app org.ddosmodule ddos-app 1.0-SNAPSHOT
org.ddosmodule.app
After the app has been built by maven, the following commands add the app inside
our local ONOS instance.
$ cd onos
$ export ONOS_ROOT="‘pwd‘"
$ source tools/dev/bash_profile
$ onos-app localhost install <path to the oar file in target>.oar
42
Pseudo code for mitigation in ONOS app.
1. start a python client and connect to the server
2. collect the required features through ONOS APIs
3. calculate the (shannon) source entropy, destination entropy using
the packet-in packets.
4. send the data to server
5. receive the prediction from server
5. if the prediction is "Attack Detected"
Perform tracebacking as described in section 3.5
6. else
do nothing
43
Testing
This is the python server output. The difference in the output is visible clearly.
During the time of attack, ”Attack Detected” is printed and during the normal
traffic ”—–” is printed.
Here attacker is h10 (10.0.0.10/32)
and the victim is h1 (10.0.0.1/32)
The controller receives the prediction from the server. Red rectangular box in
Figure 30 shows that when the prediction is received as “Attack Detected”, trace-
backing is performed and it reaches the attacker which is “10.0.0.10” in this case.
After finding the attacker, flow rule is installed at the switch to which attacker is
connected.
In this way, we detected the attack attempt and mitigated it successfully.
44
Figure 30: ONOS console output
45
Chapter 5
Limitations - The data for legitimate traffic could have been collected in a more
better way. This would have made it more challenging for the ML models to dif-
ferentiate between the two types of traffic. But due to the hardware and software
limitations (low RAM and old processor in our laptops) we weren’t able to create
a large topology in mininet. Due to this the source entropy in case of legitimate
traffic was quite low as compared to the attack traffic, and hence the data became
quite refined.
46
5.2 Future Work
The future work in the project would be to collect the dataset on a high performance
computer with adequate hardware specifications. If these requirements are met, a
larger topology can be created in mininet than what we used now and it would be-
come more challenging task for the machine learning model to classify the incoming
traffic as attack or legitimate. Along with this, since in ONOS we can implement
multiple controllers at the same time, so in future we are thinking of using multiple
controllers instead of just one so that they communicate with each other and more
efficiently prevent DDoS attacks.
47
References
[2] Mohan Dhawan, Rishabh Poddar, Kshiteej Mahajan, Viay Mann, Sphinx: De-
tecting Security Attacks in Software-Defined Networks, NDSS Symposium, 2015.
[3] Braga, R., Mota, E., & Passito, A., “Lightweight DDoS flooding attack detection
using NOX/OpenFlow”, In IEEE 35 th Conference on Local Computer Networks
(LCN),IEEE , 2010 pp. 408-415.
[4] Kokila, R. T., Selvi, S. T., & Govindarajan, K., “DDoS detection and analysis
in SDN- based environment using support vector machine classifier”, In Sixth
International Conference on Advanced Computing (ICoAC), IEEE, 2014, pp.
205-210.
[5] Mihai-Gabriel, I., & Victor-Valeriu, P., “Achieving DDoS resiliency in a software
defined network by intelligent risk assessment based on neural networks and
danger theory”, In 15th International Symposium on Computational Intelligence
and Informatics (CINTI), IEEE, 2014 (pp. 319-324).
[6] Cui, Y., Yan, L., Li, S., Xing, H., Pan, W., Zhu, J., & Zheng, X., “SDAnti-
DDoS: Fast and efficient DDoS defense in software-defined networks”, Journal
of Network and Computer Applications, 68, 2016, pp.65-79.
[7] Zhuo Chen, Fu Jiang, Yijun Cheng, Xin Gu, Weirong Liu et al., “XGBoost
Classifier for DDoS Attack Detection and Analysis in SDNbased Cloud”, IEEE
International Conference on Big Data and Smart Computing, 2018.
48
[8] N. Z. Bawany, J. A. Shamsi, and K. Salah, “DDoS attack detection and mitiga-
tion using SDN: methods, practices, and solutions,” Arabian Journal for Science
and Engineering, vol. 42, no. 2, pp. 425–441, 2017.
[9] M. Latah, L. Toker, A novel intelligent approach for detecting DoS flooding
attacks in software-defined networks. Int. J. Adv. Intell. Inform. 2018, 4, 11–20.
[10] J. Ye, X. Cheng, J. Zhu, L. Feng, L. Song, A DDoS attack detection method
based on SVM in software defined network. Secur. Commun. Netw. 2018.
[12] Mininet:An Instant Virtual Network on your Laptop (or other PC), Available
from http://mininet.org/http://mininet.org/
49
[21] Syn flood attack [Online]. Available: https://www.cloudflare.com/learning/ddos/syn-
flood-ddos-attack/
50