How to Implement Quench Attack in NS2

 

To implement the Quench Attack in ns2 has needs to follow the steps and initially the quench attack is a kind Denial-of-Service (DoS) attack in which the attacker delivers fake “Source Quench” messages to a target, misleading it into decreasing its sending rate or even stopping interaction. The “Source Quench” message was part of the ICMP protocol (Internet Control Message Protocol) used in traditional network architectures. The idea behind schedule the attack which an attacker can mimic a router and deliver the forged ICMP “Source Quench” messages to a legitimate sender, that leads it to throttle or cease its transmission.

In ns2 we need to replicate the Quench Attack concept by setting up a malicious node to send messages that would leads a legitimate node to diminish its transmission rate. Since NS2 does not directly support an ICMP Source Quench, that need to mimic this behaviour by setting up the malicious node to disturb the flow of traffic by sending messages that trigger a reduction in transmission rate.

Here is the approach to implement the quench attack in ns2:

Steps to Simulate a Quench Attack in NS2:

  1. Set Up the Network Topology:
  • Describe a network with legitimate nodes for normal communication.
  • Establish a malicious node that will mimic sending “Source Quench”-like messages to the legitimate sender that leads it to decrease or stop its transmission.
  1. Simulate the Quench Behavior:
  • The attacker node can deliver the certain traffic to the legitimate sender that mimics a “Source Quench” message, forcing the sender to decrease its transmission rate.
  • This can be completed by enthusiastically adapting the packet interval or stopping the transmission from the sender node in response to the attack.
  1. Monitor the Network Behaviour:
  • Evaluate on how the quench attack impacts the sender’s transmission rate, packet delivery, and network throughput.

Tcl Script for Simulating a Quench Attack in NS2:

# Create a new simulator

set ns [new Simulator]

# Open trace file for output

set tracefile [open out.tr w]

$ns trace-all $tracefile

# Define network nodes

set n0 [$ns node]  ;# Legitimate sender node

set n1 [$ns node]  ;# Legitimate receiver node

set n2 [$ns node]  ;# Malicious attacker node (Quench attacker)

# Create duplex links between nodes

$ns duplex-link $n0 $n1 1Mb 10ms DropTail  ;# Link between legitimate sender and receiver

$ns duplex-link $n2 $n0 1Mb 10ms DropTail  ;# Link between attacker and sender

# Define TCP agents for legitimate communication between n0 and n1

set tcp0 [new Agent/TCP]

set sink0 [new Agent/TCPSink]

$ns attach-agent $n0 $tcp0

$ns attach-agent $n1 $sink0

$ns connect $tcp0 $sink0

# Create an FTP traffic source to simulate normal communication

set ftp0 [new Application/FTP]

$ftp0 attach-agent $tcp0

$ns at 1.0 “$ftp0 start”

# Quench attack: Malicious node sends packets to stop/reduce the sender’s transmission

proc quench_attack {attacker victim sender} {

global ns

set udp [new Agent/UDP]

$ns attach-agent $attacker $udp

set cbr [new Application/Traffic/CBR]

$cbr attach-agent $udp

$cbr set packetSize_ 64   ;# Simulate quench message packet size

$cbr set interval_ 0.01   ;# Send frequent quench-like messages

# Stop the sender’s transmission when the quench attack starts

$ns at 2.5 “$sender stop_traffic”

puts “Quench attack: Malicious node sending quench-like messages to stop transmission.”

$ns at 2.0 “$cbr start”

}

# Procedure to stop the legitimate sender’s traffic

proc stop_traffic {sender} {

puts “Quench attack: Legitimate sender reducing its transmission.”

$sender stop

}

# Start the quench attack at the malicious node, targeting the legitimate sender

$ns at 2.0 “quench_attack $n2 $n0 $ftp0”

# End the simulation after 10 seconds

$ns at 10.0 “finish”

proc finish {} {

global ns tracefile

$ns flush-trace

close $tracefile

exit 0

}

# Run the simulation

$ns run

Explanation of the Script:

  1. Nodes:
    • n0: Legitimate sender node, transmitting data to n1.
    • n1: Legitimate receiver node.
    • n2: Malicious attacker node, mimic the quench attack by sending quench-like packets to n0.
  2. Legitimate Traffic:
    • A TCP connection is introduced among n0 (legitimate sender) and n1 (legitimate receiver). FTP is used to mimic regular interaction among the nodes.
  3. Quench Attack Simulation:
    • The malicious node (n2) deliver frequent small UDP packets to n0 mimic the “Source Quench” messages that would instruct n0 to minimize or stop its transmission.
    • When the attack initiates, the sender (n0) minimizes or stops its transmission by invoking the stop_traffic procedure, mimic the behaviour of a sender responding to a quench attack.
  4. Traffic Analysis:
    • The trace file (out.tr) will capture both legitimate and malicious traffic that enable them to observe how the legitimate sender minimize or terminate its transmission in response to the quench attack.

Post-Simulation Analysis:

  1. Trace File Analysis:
    • After executing the simulation, evaluate the trace file to see how the sender’s transmission is impacted by the quench attack. We should monitor the sender (n0) stopping its traffic after receiving quench-like packets from the malicious node (n2).
    • Evaluate on how the attack affects the throughput and packet delivery among the n0 and n1.
  2. NAM Visualization:
    • Use NAM (Network Animator) to visualize the network and monitor how the attacker delivers quench-like packets to the sender. we can see how the legitimate traffic is disturbed and eventually stops.
  3. Performance Metrics:
    • Evaluate the effect of the quench attack on the network performance, like the reduced throughput and increased latency in the interaction among the sender and receiver.

Example of Quench Attack Simulation in NAM:

In NAM, we should monitor the following:

  • Legitimate Traffic: Normal packet flow among the legitimate sender (n0) and receiver (n1).
  • Quench Traffic: Small, frequent packets sent by the malicious node (n2) to the sender (n0) that leads it to minimize or terminate its transmission.

Enhancing the Simulation:

  1. Multiple Attackers:
    • Attach more malicious nodes to mimic a distributed quench attack, in which multiple attackers send quench messages to congest the sender.
  2. Varying Attack Intensity:
    • Validate with diverse packet sizes and intervals for the quench-like messages to mimic numerous intensities of the attack, from mild throttling to comprehensive termination of transmission.
  3. Dynamic Responses:
    • Rather than stopping the traffic completely, we could adjust the script so that the legitimate sender minimizes its transmission rate enthusiastically, that mimic a more realistic response to the quench messages.
  4. Simulating Real-Time Responses:
    • We could establish more sophisticated mechanisms for the sender to identify and prevent the quench attack, that mimic how modern systems might avoid being affected by such attacks.

In this manual, we entirely understood the concept of quench attack that were executed in ns2 simulation that has generate the topology and then establish the malicious nodes to mimic the messages and then run the execution to analyse the outcome. Further details regarding the quench attack will also be provided in further manual.

We provide guidance for implementing your Quench Attack in NS2. For tailored ideas and topics, you may visit ns2project.com. Our team offers exceptional simulation support, focusing on comprehensive comparative analysis of the nodes pertinent to our project specifications. Our developers specialize in the Internet Control Message Protocol (ICMP).