Wormhole Attack is implemented in NS2 at the Network Layer


What is Wormhole Attack?How Wormhole is implemented in NS2 at the Network Layer?

The Attacker gets a strong location in a network in a Wormhole Attack.Attacker in a wormhole attack make use of this location as a shortest path between nodes.Attacker advertise this node as a shortest path to all other nodes for transmitting data.

 

Modes of wormhole attack:

  • Wormhole using protocol deviations.
    • Half open wormhole attack.
    • Closed wormhole attack.
    • Open wormhole attack.
  • Wormhole using packet relay.
  • Wormhole using encapsulation.
  • Wormhole with power transmission.
  • Wormhole Out-of-Band Channel.

Architecture of Wormhole Attack:

Architecture-of-Wormhole-Attack

 

Sample code for wormhole attack:

This is how Wormhole Attack is implemented in NS2 at the Network Layer,This code has information of nodes and their links involved in network layer.

 

set udp [new Agent/UDP]
$ns attach-agent $node_(0) $udp

set cbr [new Application/Traffic/CBR]
$cbr set packetSize_ 1024
$cbr set interval_ 0.1

$cbr attach-agent $udp
set null [new Agent/Null] 
$ns attach-agent $node_(1) $null
$ns connect $udp $null
$ns at 2.0 "$cbr start"
$ns at 10.0 "$cbr stop"
$ns at 2.0 "$ns trace-annotate \"Sender sends the data to the receiver through the selected router which is attacker\""
$ns at 2.1 "$ns trace-annotate \"Attacker 2 and 6 forms wormhole\""

set udp [new Agent/UDP]
$ns attach-agent $node_(1) $udp
set cbr [new Application/Traffic/CBR]
$cbr set packetSize_ 1024
$cbr set interval_ 0.1
$cbr attach-agent $udp
set null [new Agent/Null] 
$ns attach-agent $node_(3) $null
$ns connect $udp $null
$ns at 3.0 "$cbr start"
$ns at 10.0 "$cbr stop"
$ns at 3.0 "$ns trace-annotate \"Attacker forwards the data to Attacker 8 which does not forward the data to receiver\""

Journal Support for NS2 Projects:(Wormhole Attack is implemented in NS2 at the Network Layer)

NS2-Projects-Journal-Support