8/18/2019 Simulation of Attacks in a Wireless Sensor Network
1/49
i
Simulation of Attacks in a Wireless Sensor Network
using NS2
GRADUATE PROJECT REPORT
Submitted to the Faculty of
The School of Engineering & Computing Sciences
Texas A&M University-Corpus ChristiCorpus Christi, TX
In Partial Fulfillment of the Requirements for the Degree ofMaster of Science in Computer Science
By
Anusha Sher
Spring 2015
Committee Members
Dr. Mario Garcia _____________________________
Committee Chairperson
Dr. David Thomas _____________________________Committee Member
8/18/2019 Simulation of Attacks in a Wireless Sensor Network
2/49
ii
ABSTRACT
A Wireless Sensor Network (WSN) consists of autonomous sensor devices that
are used to monitor physical and environmental conditions like temperature, pressure etc.
The WSN is built of hundreds and thousands of detection stations called nodes, where
each node consists of one or more sensors. Each WSN consists of a radio transceiver, an
internal/external antenna, a microcontroller and a battery. Wireless sensor networks are
the networks that are used to communicate by sensing the behavioral changes and the
sensing nodes will collect the data and it will get processed. After data processing, the
data will be communicated to the receiver.
There are some organizations that are having very important necessity of wireless
networks in organizations such as military, ecology and health. In these kinds of
organizations, the wireless sensor networks have to be secured from network attacks
especially at unfriendly situations because data can easily be attacked by the attackers.
There are also some security protocols being implemented in sensor networks. There are
some limitations in a wireless sensor network like they have limited storage capacity,
limited capability of processing and limited energy to transmit data. These drawbacks can
make wireless sensor network different from other networks. The simulation of the
attacks are done in the NS2 simulator. By simulating, the performance of the network can
be monitored.
8/18/2019 Simulation of Attacks in a Wireless Sensor Network
3/49
iii
TABLE OF CONTENTS
1 BACKGROUND AND RATIONALE ....................................................................... 1
1.1 Introduction to WSN ............................................................................................ 1
1.2 Existing Systems .................................................................................................. 3
1.3 Introduction to NS2 Simulator ............................................................................. 4
1.4 Introduction to Proposed System ......................................................................... 6
2 NARRATIVE .............................................................................................................. 7
2.1
Motivation ............................................................................................................ 7
2.2 Project Objective .................................................................................................. 7
2.3 Project Scope ........................................................................................................ 8
3 PROPOSED SYSYEM DESIGN ................................................................................ 9
3.1 System Design and Architecture .......................................................................... 9
4 SYSTEM IMPLEMENTATION ............................................................................... 11
4.1 Configuring Network Simulator: ....................................................................... 11
4.1.1 Creating and setting connection between the nodes in the simulator: ........ 12
4.1.2 Setting the position of the nodes ................................................................. 15
4.1.3 Generation of movements ........................................................................... 16
4.1.4 Zone Partitioning ........................................................................................ 16
4.1.5 Creating Application: .................................................................................. 18
4.1.6 Setting of Malicious node ........................................................................... 19
4.1.7 Making the nodes dynamic ......................................................................... 19
4.2 Simulation of Sybil attack .................................................................................. 20
4.3 Simulation of Denial of Service attack .............................................................. 22
8/18/2019 Simulation of Attacks in a Wireless Sensor Network
4/49
iv
4.3.1 Simulation of Sinkhole attack: .................................................................... 24
4.3.2 Simulation of Hello Flood Attack: .............................................................. 26
5 TESTING AND EVALUATION .............................................................................. 29
6
CONCLUSION AND FUTURE WORK .................................................................. 34
BIBLIOGRAPHY………………………………………………………………………..34
APPENDIX………………………………………………………………………………36
8/18/2019 Simulation of Attacks in a Wireless Sensor Network
5/49
v
LIST OF FIGURES
Figure 1.1: Illustration of a WSN………………………….................................2
Figure 1.2: Applications of a WSN……………………………………………..3
Figure 1.3: Basic architecture of a NS2 simulator……………………………...5
Figure 3.1: Components of a sensor node………………………………………9
Figure 3.2: Layered architecture…………………………………………….....10
Figure 4.1: Creation of nodes in the simulator…………………………………14
Figure 4.2: Partitioning into zones and assigning color codes…………………16
Figure 4.3: User entering the nodes…………………………………………….19
Figure 4.4: Simulation of Sybil attack………………………………………….21
Figure 4.5: Simulation of DOS attack…………………………………………..23
Figure 4.6: User making the nodes dynamic……………………………………24
Figure 4.7: Simulation of sinkhole attack……………………………………….25
Figure 4.8: User making the nodes dynamic……………………………………27
Figure 4.9: Simulation of hello flood attack…………………………………….27
Figure 5.1: Incorrectly entered node…………………………………………….29
Figure 5.2: Overlapping of nodes……………………………………………….30
Figure 5.3: Simulation of Sybil attack…………………………………………..31
Figure 5.4: Graph for throughput………………………………………………..32
8/18/2019 Simulation of Attacks in a Wireless Sensor Network
6/49
1
1 BACKGROUND AND RATIONALE
1.1 Introduction to WSN
A WSN consists of sensor devices that are used to monitor physical and
environmental conditions like temperature, humidity, pressure etc. [1]. Figure 1.1
represents the architecture of a WSN. The WSN is built of hundreds and thousands of
detection stations called nodes, where each node connects to sensors. Each WSN consists
of a radio transceiver, an internal/external antenna, a microcontroller and a battery.
Constructing a wireless sensor network (WSN) has become important in all places. [2]
Small sensor devices can perform multiple tasks like data processing, sensing and
communicating with other devices in the wired network. A Wireless sensor network is
used for easier system design and monitoring the device in wireless network. Many
sensors are deployed in various places, hence they need security for transferring data
through the network. Using some technologies and efficient techniques we can create a
secure data transfer scheme in WSN. Wireless sensor network security plan must have
effective key distribution among all different nodes in same network.
8/18/2019 Simulation of Attacks in a Wireless Sensor Network
7/49
2
Figure 1.1: Illustration of a WSN
The sensor nodes collect the data and send to the base station for processing and then it
sent to the user via a wireless medium. A WSN has numerous applications in many
fields. They are deployed in many places. A WSN is used in these applications to monitor
the maintenance, improve the productivity and enhance the security and safety. For wide
deployment, it is required that the sensors should be made smaller and inexpensive. There
are also many methods being proposed to secure the network from different kinds of
attacks. Figure 1.2 shows the applications of WSN’s in numerous fields. They are
deployed in many places and the sensors have a capability to give a warning at
emergency situations.
8/18/2019 Simulation of Attacks in a Wireless Sensor Network
8/49
1
i
s
t
t
i
a
e
e
.2 Existin
There are
a wireless
nsor netwo
SN and th
e network
ansmission
plemented
hieving pu
crypted a
crypted da
g Systems
some syste
sensor net
rks have li
y can easil
ithout any
over the n
. A WSN
lic key cry
d decrypte
a. In the e
Figure 1.
s propose
ork, but t
ited functi
change da
user involv
twork, sev
is more v
tography, t
at the re
xisting syst
3
: Applicati
earlier tha
ey have th
nalities, so
a integrity,
ment. [1] F
ral cryptog
lnerable to
e security l
eivers end
ems, the se
ns of a WS
deal with
eir own dis
unauthorize
introduce a
or the purpo
raphic and
several at
evel is not
. The attac
urity of th
N
roviding se
dvantages.
d users can
wrong mes
se of provi
other tech
tacks/threat
roper in W
kers could
data integ
ure data tr
Present wi
easily acce
sage and d
ing a secur
iques have
. [4] Inspi
N. The dat
even attac
ity is weak
nsfer
eless
s the
stroy
data
been
te of
was
the
. The
8/18/2019 Simulation of Attacks in a Wireless Sensor Network
9/49
4
attacker can attack all the information in the intermediate nodes which violates data
confidentiality.
1.3 Introduction to NS2 Simulator
Using the network simulator NS2, the attacks in the WSN can be simulated. NS2
creates a replica of a real time network. It is a time based event driven simulator. The
code can be written in such a way that at what time, what particular event can happen.
The nodes can be created, the data transfer between the nodes and the attacks can be
shown. It has become one of the most widely used open source simulators. It is a free
simulation tool that can be available online [14] [19]. The simulator consists of a wide
variety of applications, protocols like TCP, UDP and many network parameters. It runs
on various platforms like UNIX, Mac and windows platforms. This NS2 tool allows to
develop a model design for wireless sensor network connection between nodes in the
network. Based on the network attacks like denial of service [4], hello flood attack,
sinkhole attacks, Sybil attack the network security can be tested. These attacks can be
created in the network and the security level of the wireless sensor network can be tested
to ensure secure data transmission between the nodes in the network.
Figure 1.3 shows the basic architecture of NS2 Simulator [13]. It is provided with a
command ‘ns’ to execute the code written in NS2. The name of the Tcl simulation script
is passed as an input argument. After executing a simulation trace file is created which
can be used to create animation or to plot graph. NS2 Simulator consists of two languages
namely C++ and OTcl (Object oriented Tool Command Language). C++ does the internal
mechanism i.e. back end and OTcl deals with the front end [12].
8/18/2019 Simulation of Attacks in a Wireless Sensor Network
10/49
T
n
r
T
he simulati
etwork ani
corded in d
here are ma
It is f
Any
The r
It sup
can b
It can
It is
Fig 1.
n trace file
ator or to pl
ata format i
ny advantag
eely availa
omplex net
sults can b
ports a wide
used for c
run on a va
ost widely
: Basic Arc
generated a
ot a graph.
namtrace
es of NS2 S
le online. It
ork can be
obtained e
variety of
mmunicati
iety of plat
sed simula
5
hitecture of
ter executio
he informa
ile.
imulator:
is cheaper t
simulated a
sily in the f
pplications
n between i
orms like
ors.
a NS2 Sim
n can be us
tion in the
han any oth
nd used for
orm of grap
and protoc
n the nodes.
indows, Li
lator [13]
d to create
etwork ani
er simulator
testing.
h or in a net
ls like TCP
.
ux, Unix et
nimation i
ator can be
s.
work anima
, UDP etc.
c.
a
tor.
hich
8/18/2019 Simulation of Attacks in a Wireless Sensor Network
11/49
6
1.4 Introduction to Proposed System
A WSN has numerous applications in many fields. It is deployed in many
places. Ensuring the security in a WSN is of great concern. Because of the constraints in
the network, it is vulnerable to many attacks. The major attacks include denial of service,
sinkhole, Sybil and hello flood attack. [4] These attacks decrease the performance and
efficiency of the network. The attacks are studied in detail and are simulated in a
simulator. The characteristics of the attack and the nature of the attack can be known. By
simulating, the behavior of the network and the performance can be examined. The
network simulated is closer to real time network. By understanding the attacks, proper
measures can be taken in order to detect and prevent them. A simulator holds good for
replicating the real time network. By understanding all the problems in the design phase
itself, one can be able to construct a more efficient network.
8/18/2019 Simulation of Attacks in a Wireless Sensor Network
12/49
7
2 NARRATIVE
2.1
Motivation
Wireless Sensor networks are employed in various applications such as health,
military and many other organizations. They provide tremendous benefits to industries.
The ability to add sensors without wires has led to many benefits including energy,
material and labour savings, productivity also increases [11]. WSN’s are deployed in
many places and have numerous applications. Several computation problems such as
small memory, limited energy resources cause difficulty in security and protection in
WSN’s. It is very necessary to protect WSN’s from several attacks/threats. To ensure
confidentiality of data, a WSN should be secure.
2.2 Project Objective
As said earlier, the WSN’s are deployed in many places, they need to be
prevented from attacks. Because of the many constraints in a WSN, it is vulnerable to
many attacks. Understanding the attacks and providing security in the network is of great
necessity. By using the network simulator NS2, the attacks can be simulated. By the
simulation of the attacks, the attacks can be understood clearly and proper measures to
detect and prevent the attacks can be taken. It is also cost effective and closer to a real
time scenario.
8/18/2019 Simulation of Attacks in a Wireless Sensor Network
13/49
8
2.3 Project Scope
Though the WSN has many limitations with the energy consumption,
resource utilization, limited battery power etc., they are being used in many organizations
and places. WSN’s are vulnerable to many threats and attacks which are very common.
Hence there is much necessity for security in a WSN. WSN’s have the capability to
protect attackers in broadcast transmission medium. Based on the some advance
techniques wireless sensor network have an extra safe susceptibility. With simulating the
attacks, the performance and the efficiency of the network can be known before even
constructing the network. The behavior and the communication between the nodes can be
understood in a better way. They can prevent the network layers from the DOS,
wormhole attack, hello flood attack, sinkhole attack, Sybil attack [2] and selective
forwarding attack [7].
8/18/2019 Simulation of Attacks in a Wireless Sensor Network
14/49
8/18/2019 Simulation of Attacks in a Wireless Sensor Network
15/49
10
Figure 3.1: The components of a sensor node [1]
Figure 3.2 describes the details of the different layers in the wireless network and
the communication process between the nodes and the wireless device. A WSN consists
of an application layer, network layer, MAC and physical layer. The Sensor operates in
the application layer. The packet is forwarded through a wireless channel from physical
layer to application layer.
8/18/2019 Simulation of Attacks in a Wireless Sensor Network
16/49
8/18/2019 Simulation of Attacks in a Wireless Sensor Network
17/49
12
As said earlier WSN’s are vulnerable to many attacks. Each attack may lead to a
different problem. There are two types of attacks that are popular with the Wireless
Sensor Networks. They are Physical attacks and logical attacks. [13] Physical attacks
include capturing of the nodes and tampering the nodes which will lead to loss of data.
On the other hand, Logical attacks include attacks like sinkhole attack, wormhole attack,
hello flood attack, selective forwarding attack, Sybil attack, Denial of service attack.
These attacks are more common in a Wireless Sensor Network. These attacks must be
detected and must be avoided in order to increase the performance and security level in a
WSN.
The Simulation of the attacks is being done by using NS2 Simulator. It is an open
source free simulator available online. It stands good for simulation of TCP, UDP and
many other routing protocols. It works on an object oriented language called Tool
Command language (OTcl). With the help of OTcl language, different network
topologies and the routing protocols can be explained. [14] The language is very easy to
use and is platform independent. The code can be written for creation of the nodes,
showing the data transfer and introducing the attacks and the simulation can be shown by
running the simulator. The simulator consists of wide variety of applications, protocols
like TCP, UDP and many other network parameters. The simulator consists of nodes and
the data transfer between the nodes can be shown. The attacks can be introduced into the
system by making some of the nodes malicious. In our system the simulation is shown
on four attacks mainly Sybil attack, sinkhole attack, hello flood attack and denial of
service attack.
4.1.1 Creating and setting connection between the nodes in the simulator:
8/18/2019 Simulation of Attacks in a Wireless Sensor Network
18/49
13
The first step is creation of the nodes in the network. Any number of nodes can be
created in the network as per the user. The nodes can be made dynamic. The user can
enter the source, destination and malicious node as he wishes when he runs the simulator.
Figure 4.1 shows the creation of the nodes in the network. The movement of the nodes
can be generated and the nodes can be partitioned into zones. After creating the nodes, a
connection must be established between the nodes in the network. There are several
protocols defined that can be used namely TCP and UDP. TCP is connection oriented
protocol and it provides acknowledgement from the receiver. The UDP protocol can be
used when there is a lot of traffic in the system which would be efficient. There is a TCP
agent and a TCP sink. TCP agent is responsible for sending the packets in the network
which can be called as a source node. TCP sink is the receiver node which receives the
packets sent by the receiver.
Following shows how to create a node in the simulator. nn represents the number of
nodes being initialized. The looping is done through the number and nodes and each node
is created and assigned a random motion.
Code:
8/18/2019 Simulation of Attacks in a Wireless Sensor Network
19/49
8/18/2019 Simulation of Attacks in a Wireless Sensor Network
20/49
4
i
s
F
.1.2 Setti
T
itialized. It
t at a partic
ollowing sh
hereas as t
Fig
g the positi
e X dimens
represents t
ular coordin
ows how to
e Y and Z a
ure 4.1: Cre
on of the n
ion and the
e area in th
ate in the si
set the posit
e set to 0.
15
ation of no
des
Y dimensio
e simulator.
ulator.
ion of the n
es in the si
of the top
The initial
des. The X
ulator
graphy in t
location of
coordinate
e system w
he nodes ca
s set to 20,
ill be
n be
8/18/2019 Simulation of Attacks in a Wireless Sensor Network
21/49
4
b
F
$
4
a
o
ode:
.1.3 Gene
ovements o
e moved to
ollowing sh
oves to the
ode:
ns at 0.2 "$
.1.4 Zone
Th
ssigned to e
ther.
ration of m
ince it is a
f the nodes
particular
ows the gen
particular d
ode_(49) s
Partitionin
nodes crea
ach node. T
vements
SN, the n
n the simul
estination
eration of m
stination.
etdest 100.7
g
ted can be
his is just f
16
des keep m
tor can be
an be set.
ovement of
8 980.56
artitioned i
r a clear vi
oving in the
one. The ti
a node. The
000"
nto differen
ew and ide
simulator.
e at which
node 49 at
t zones. A c
tifying the
he generati
the node sh
ime 0.2 sec
olor code c
nodes from
on of
ould
n be
each
8/18/2019 Simulation of Attacks in a Wireless Sensor Network
22/49
8/18/2019 Simulation of Attacks in a Wireless Sensor Network
23/49
4
r
t
t
a
n
.1.5 Crea
The
ceiver. Her
affic. The
e applicati
plication s
ode. Follo
BR applica
ode:
ing Applic
application
e, constant
ther applic
n like tim
arts at a par
ing shows
ion are initi
tion:
indicates t
it rate (CB
tions that c
interval,
ticular time
ow to set
lized and t
18
e type of t
) is used a
an be used
aximum p
, the packet
CBR appl
e applicati
ransmission
s an applic
are FTP, T
ckets size
will be se
ication to
n is started.
between t
tion in ord
lnet etc. T
etc are set.
t from one
DP. The p
e sender an
r to genera
e paramete
When the
node to the
rameters f
d the
e the
s for
CBR
other
r the
8/18/2019 Simulation of Attacks in a Wireless Sensor Network
24/49
4
k
t
$
4
o
t
F
t
.1.6 Setti
Any
inds of atta
set a partic
ode:
ns at 50.0 "[
.1.7 Maki
The
wn source,
ose nodes.
ollowing c
rminal is se
ode:
g of Malici
of the node
ks. More th
ular node a
$node_ (30)
ng the node
nodes creat
destination
t will help t
de shows h
t to source,
ous node
s created c
n one mali
malicious:
set ragent_
s dynamic
ed can be
and malici
o make the
ow to mak
rgv1 is set
19
n be made
ious node
] malicious"
ade dynami
us node to
imulation
the nodes
o destinatio
as a malic
an be creat
c which me
see the si
ore interac
dynamic w
n and argv2
ious node t
d. The foll
ans the user
ulation ha
ive.
here argv0
is set to ma
o show dif
wing show
can enter h
pening bet
entered fro
licious nod
erent
how
s/her
ween
the
.
8/18/2019 Simulation of Attacks in a Wireless Sensor Network
25/49
8/18/2019 Simulation of Attacks in a Wireless Sensor Network
26/49
21
be prevented so that the system can be made secure. Maintaining the identities of the
system is necessary. There are many authorities that help in maintaining the identity by
using certification software’s [15]. Sybil attacks are the most common types of attacks.
They tend to challenge the security and safety of the system. There are many ways to
protect a system from Sybil attack. Trusted authority and proper identity can help prevent
a network from such type of an attack.
The simulation of the Sybil attack is done by using the NS2 Simulator. It can be done by
modifying aodv.cc file in ns2.35 which can be shown by dropping the packets in the
simulator. Figure 4.4 shows the simulation of the Sybil attack. The attack can be seen by
dropping of the packets of the intermediate node. This attack is one of the well-known
attack in WSN. The attacker nodes may obtain the legitimates IP Address or Mac
Address in order to Steal and make its own. Then the attacker node can do plenty of
things with new stolen identity. Node 43 acts as source whereas node 44 is the destination
node. The source node start sending packets to the destination node through the shortest
path that is decided by the routing protocol. The intermediate node 15 acts as a malicious
node and at time 30 sec, it starts dropping the packets coming from the node.
8/18/2019 Simulation of Attacks in a Wireless Sensor Network
27/49
4
r
f
l
r
e
.3
Simul
sources m
cusses on t
gitimate. It
quests. Du
etwork wo
en more h
tion of De
SN are c
kes the W
he energy p
can be do
e to this at
ld be reduc
rmful. Ther
Figure 4.4:
ial of Serv
ncerned w
SN more
rotocols. [1
e by overl
tack, effici
ed. This pa
e are many
22
Simulation
ce attack
th numerou
ulnerable t
6] DoS atta
ading the
ncy and t
ticular type
types of D
of Sybil att
s security i
o Denial o
k prevents
estination
e performa
of attack i
S attacks.
ck
ssues. The
f Service
the system
ystem with
nce of the
unfriendly
mong the
onstraint o
ttack beca
or the user
huge num
Wireless S
situations c
ifferent ty
n the
se it
to be
er of
ensor
n be
es of
8/18/2019 Simulation of Attacks in a Wireless Sensor Network
28/49
23
DOS Attacks, SYN flood is the most common kind of an attack. It uses TCP three way
handshake mechanism for communication between the nodes.
Denial of service Attack involves saturating the performance of the target node with lots
of unwanted communication requests which will create fake traffic. [16] These kinds of
attacks overload the server. Here, DOS attack is implemented by using UDP protocol and
CBR application. Once its buffer size is full, the target node can be seen dropping the
packets coming from the malicious node as well as the source. Figure 4.5 shows the
simulation of the denial of service attack. Node 41 is the source and node 50 is the
destination. The packets from the source node are sent to the destination node via the
target node 58. After sometime node 48 acts as a malicious node and starts sending huge
number of packets to the target node. Since the target node buffer size is limited, it cannot
handle all the packets and at time 23 sec will drop the packets coming from the malicious
node 48 as well as the source node 41. This will lead to the loss of data and will degrade
the service of the network.
8/18/2019 Simulation of Attacks in a Wireless Sensor Network
29/49
4
s
i
n
n
c
.3.1
Sim
nd the coll
cases whe
etworks an
ere, a mali
odes. Sinkh
oser to the
lation of Si
WSN con
cted data t
re there is
proper me
ious node
ole attack i
destination
Figure 4.5:
nkhole atta
ists of man
the base st
any to one
asures sho
cts as desti
s the select
node in o
24
Simulation
ck:
nodes con
ation for pr
communic
ld be take
nation node
ive forward
der to attr
of DOS att
nected to ea
ocessing. A
tion. It is
in order t
and looks
ing attack.
ct all maxi
ck
ch other. T
sinkhole at
serious th
detect an
attractive to
The malici
mum possi
ese nodes
ack is more
eat to the s
prevent it
the surrou
us node w
le traffic
ould
seen
ensor
[18].
ding
ll be
f the
8/18/2019 Simulation of Attacks in a Wireless Sensor Network
30/49
n
d
a
r
t
s
n
u
d
etwork. It i
ifficult. In t
tracts all t
uting proto
e current o
nkhole atta
eighbor nod
ser can ent
hen he ru
estination a
s one of th
e simulator
e packets i
cols that co
es are affe
k. In the in
es. The nod
r the sourc
s the simul
d 7 as mali
Fi
complex
, the malici
nstead of f
ld withsta
ted by the
itial stage, t
e that is cl
e, destinati
ation. Figu
ious node.
gure 4.6: U
25
ttack and
us node is
orwarding
d the sinkh
sinkhole att
e maliciou
ser to the d
n and the
e 4.12 sho
er making t
etection of
placed besi
o the legiti
ole attack a
ack. Figure
s node gets
estination a
alicious n
s the use
he nodes dy
the Sinkho
e the desti
mate node.
t a certain l
4.6 shows
all the infor
cts as a mal
de in the c
entering 0
namic
le attack is
ation node
There are
vel but ma
he simulati
mation abo
icious node
ommand p
as source,
very
nd it
some
ny of
on of
t the
. The
ompt
9 as
8/18/2019 Simulation of Attacks in a Wireless Sensor Network
31/49
8/18/2019 Simulation of Attacks in a Wireless Sensor Network
32/49
27
will alter the security of the system. [17] The node which receives such a message
assumes that it has been sent by the sender which is not the case always. It can occur
when there is huge amount of traffic in the system. Several cryptographic techniques and
methods have been implemented in order to prevent this attack but each one had its own
drawback.
This attack can be simulated by modifying the Aodv.h and Aodv.cc file in ns2 simulator
in order to create hello flood attack where we can see the target node being flooded by
the packets. These files are the inbuilt files that come along with the ns2 package when
one downloads. They contain all the code about the routing, providing a path for routing
and information on the packet forwarding. Figure 4.8 shows the simulation of hello flood
attack. A node is made as a target node and it is flooded with lots of hello messages
which will create a lot of black circles in the simulator. The user can enter the source and
destination as he wishes which is shown in figure 4.9.Here, the node 0 is made as the
source and the node 9 is made destination. Every node is seen sending hello messages to
every other nodes in the network.
8/18/2019 Simulation of Attacks in a Wireless Sensor Network
33/49
Fi
Fi
gure 4.8: U
gure 4.9: Si
28
er making t
ulation of
he nodes dy
hello flood
namic
attack
8/18/2019 Simulation of Attacks in a Wireless Sensor Network
34/49
29
5 TESTING AND EVALUATION
Using the network simulator NS2, the attacks can be simulated. It creates a
replica of a real time network [12]. NS Simulators are mainly used for network research
and learning. It helps me to create security nodes and establish the communication
between them. This NS2 tool allows to develop a model design for WSN connection
between nodes in the network. Based on the network attacks like Dos, wormhole attack,
hello flood attack, sinkhole attacks, Sybil attack, selective forwarding attacks, the
network security can be tested [9]. NS2 tool gives scope in testing, so the level of
network security can easily be tested. The attacks can be created in the network and the
security level of the wireless sensor network can be tested. Here, for the given input, what
output it is generating are my test cases.
Test Case 1: When the node entered by the user is greater than the number of nodes:
From the terminal, the user can enter his own source, destination and malicious node. A
fixed number of nodes will be created. So, if the entered node is greater than the number
of nodes created, the simulation will not start because it cannot read the node. In the
figure 5.1, the number of nodes created are 10. The user has entered 15 as destination
node. Since it cannot find the node for communication, it throws an error.
8/18/2019 Simulation of Attacks in a Wireless Sensor Network
35/49
8/18/2019 Simulation of Attacks in a Wireless Sensor Network
36/49
I
c
n
a
est Case 3:
Sybil attac
ill have its
omes with t
ode should
alicious no
tack occurs
Choosing t
k, lot of tra
wn routing
e installati
e one of th
e created r
. It can be s
Figure 5.
he routing
smissions b
path. The r
n of ns2 pa
intermedia
sides in the
own in figu
31
2: Overlapp
ath
etween the
uting path
kage. For t
te nodes bet
path betwe
re 5.3.
ing of node
odes are cr
ill be deci
e Sybil atta
ween the so
n the sourc
s
eated. Each
ed by the
ck to happe
urce and de
and destin
transmissio
ODV file t
, the malic
tination. If
tion, then t
at
ous
he
e
8/18/2019 Simulation of Attacks in a Wireless Sensor Network
37/49
5
n
o
a
p
.1 Results
As a p
etwork perf
verall numb
fected by
erformance.
sing the gr
xis represe
art of the
ormance. It
er of bytes
arious nu
The trace f
ph, one ca
ts the time
Figure 5.3:
roposed s
calculates t
eceived in
ber of fact
ile generate
easily und
and Y Axi
32
Simulation
stem, a gr
e throughp
the network
ors. It play
is passed
rstand the
s represents
of Sybil att
ph has be
ut of the n
. The Thro
s a vital ro
as an input
imulation r
the throug
ck
n generate
twork. Thr
ghput in th
le in analy
in order to
esults of th
put rate. I
to monito
ughput ind
network c
ing the ne
enerate a g
network.
itially, whe
r the
cates
n be
work
raph.
he X
n the
8/18/2019 Simulation of Attacks in a Wireless Sensor Network
38/49
t
h
ansmission
igh. Later it
starts there i
drops at on
s huge amo
point whe
Figure 5
33
nt of traffi
an attack o
.4: Graph fo
in the syst
ccurs. Figu
r throughpu
em, so the t
e 5.4 shows
t
roughput w
the graph.
ill be
8/18/2019 Simulation of Attacks in a Wireless Sensor Network
39/49
34
6
CONCLUSION AND FUTURE WORK
WSN’s are of huge demand. The request for wireless sensor networks are
increasing rapidly, because the growth of using WSN has increased. There are some
limitations in a wireless sensor network like they have limited storage capacity, limited
capability of processing and limited energy to transmit data [1]. These drawbacks can
make WSN different from other networks. There are some little concerns that occur in a
WSN. Based on the above mentioned difficulties in the data integrity, security, there are
many solutions that are available to overcome these dangers. The attacks that are popular
in a WSN like hello flood attack, sinkhole attack, Sybil attack and denial of service attack
have been simulated in a simulator. On simulation, the performance and the efficiency of
the network can be analyzed. The behavior and the energy parameters can be examined.
A mechanism for ensuring secure data transfer and preventing the attacks in a WSN must
be proposed. The parameters which determine the network performance can be calculated
from the simulation. Because of the numerous attacks happening in the WSN, there is
less amount of security.
8/18/2019 Simulation of Attacks in a Wireless Sensor Network
40/49
35
BIBLIOGRAPHY AND REFERENCES
[1] Y. Wang, G. Attebury, et al. "A survey of security issues in wireless sensor
networks." Computer Science and Engineering. Vol.8, no. 2. 2006.
[2] E. Shi and A. Perrig, “Designing Secure Sensor Networks,” Wireless Commun. Mag.,
vol. 11, no. 6, pp. 38–43, Dec. 2004.
[3] N. Gura, A. Patel, et al. "Comparing elliptic curve cryptography and RSA on 8-bit
CPUs." Cryptographic Hardware and Embedded Systems-CHES 2004, pp 925-943, 2004.
[4] M. Razzaque., S.Ahmad Salehi. Security and Privacy in Vehicular Ad- Hoc
Networks: Survey and the Road Ahead. Wireless Networks and Security, Springer: 107-
132, 2013.
[5] A. Perrig et al., “SPINS: Security Protocols for Sensor Networks,” Wireless
Networks, vol. 8, no. 5, pp. 521–34, Sept. 2002.
[6] H. Du, X. Hu, et al. "Energy efficient routing and scheduling for realtime data
aggregation in WSNs." Computer communications. Vol.29, no. 17. 3527-3535, 2006.
[7] X. Hung, et al. “An Energy-Efficient Secure Routing and Key Management Scheme
for Mobile Sinks in Wireless Sensor Networks Using Deployment Knowledge,” Sensors,
Vol 8. 2008, 7753-7782
[8] L. Jialiang, Valois, F.; Dohler, M.; Min-You Wu; "Optimized Data Aggregation in
WSNs Using Adaptive ARMA," Sensor Technologies and Applications(SENSORCOMM), 2010 Fourth International Conference on pp.115-120, 18-25 July
2010.
8/18/2019 Simulation of Attacks in a Wireless Sensor Network
41/49
36
[9] S. Zhu et al., “An Interleaved Hop-by-Hop Authentication Scheme for Filtering of
Injected False Data in Sensor Networks,” Proc. IEEE Symp. Security and Privacy,
Oakland, CA, pp. 259–71, May 2004.
[10] J. Ben-Othman, and B. Yahya. "Energy efficient and QoS based routing protocol forwireless sensor networks." Journal of Parallel and Distributed Computing 70(8), 849-857
2010.
[11] D.W. Carman, P.S. Krus, and B.J. Matt, “Constraints and approaches for distributed
sensor network security”, Technical Report 00-010, NAI Labs, Network Associates Inc.,
Glenwood, MD, 2000.
[12] Teerawat Issariyakul and Ekram Hossain.
Introduction%20to%20Network%20Simulator%20NS2%20(1).pdf
[13] R. E. Shannon, “Introduction to the art and science of simulation,” in Proc. of the
30th conference on winter simulation (WSC’98), 1989
[14] http://ns2tutor.weebly.com/ns2-in-windows.html
[15] http://www.cs.berkeley.edu/~dawnsong/papers/sybil.pdf
[16] http://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=4431860
[17]http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.403.6592&rep=rep1&type
[18] http://ijaiem.org/Volume2Issue2/IJAIEM-2013-02-06-005.pdf
[19] http://sourceforge.net/projects/nsnam/files/
[20] http://www.ipcsit.com/vol35/003-CNCS2012-N010.pdf
8/18/2019 Simulation of Attacks in a Wireless Sensor Network
42/49
onfiguring and settin the nodes,
37
APPEND
initializing
IX
objects an trace files
8/18/2019 Simulation of Attacks in a Wireless Sensor Network
43/49
S
etting topo raphy and setting the
38
values to t e configur d paramet rs
8/18/2019 Simulation of Attacks in a Wireless Sensor Network
44/49
reation of
abelling th
odes and s
nodes and
etting posit
setting TC
39
on of the n
P connecti
odes
n between the nodes
8/18/2019 Simulation of Attacks in a Wireless Sensor Network
45/49
S
etting of C R application
40
8/18/2019 Simulation of Attacks in a Wireless Sensor Network
46/49
T
t
d
ode for ma
hese are so
e ns2. Thes
rop the pac
ode for sin
licious nod
e of the lin
e lines are f
ets. It is co
hole attac
:
es that I ha
r setting up
mon for al
:
41
e added in t
the malicio
the four att
he AODV.c
us node and
acks.
c which is a
making the
n inbuilt fil
malicious
in
ode
8/18/2019 Simulation of Attacks in a Wireless Sensor Network
47/49
ode for Do attack:
42
8/18/2019 Simulation of Attacks in a Wireless Sensor Network
48/49
8/18/2019 Simulation of Attacks in a Wireless Sensor Network
49/49
ode for Sy il attack: