Programming a SinkHole Attack in MANET


SinkHole attacks are one of the intrusion attacks that a MANET faces. In a SinkHole attack, the intruder node/malicious node sends fake routing information claiming that it has an optimum route to the target which causes other nodes in the Ad Hoc Network to route data packets through it. Thus, the malicious node gets access to all the traffic and is free to tamper the data as it wishes. In this example, we show how to implement a SinkHole attack on Manet running the DSR routing Protocol using Netsim by a simple modification of the DSR Protocol source code.

Code Modification

We create a file Malicious.c in which we write the following  three functions.

int fn_NetSim_DSR_MaliciousNode(NetSim_EVENTDETAILS* ); — This function returns 1 if the current Device is the Malicious node that we have set.

int fn_NetSim_DSR_MaliciousRouteAddToCache(NetSim_EVENTDETAILS* ,DSR_PRIMITIVES* ); — This function adds the route from the current node to the target in the current nodes’ route cache.

int n_NetSim_DSR_MaliciousProcessSourceRouteOption(NetSim_EVENTDETAILS * ,DSR_PRIMITIVES* ); — This function receives the data packet from the transmitting node, sends an acknowledge request and then receives the data.

In the existing file DSR.c, in the case ctrlPacket_Route_Request in Network_In_Event, we add a false route from the present node to target in the route cache of a malicious node. Thus the malicious node will send a fake route reply. In the default case of a data packet, the malicious node will receive the data packet and then it generates an acknowledge request.

Source Code 

The following files are attached:

Visit: E-Mail: