How to Start Quench Attack Projects Using NS3
To start quench attack in NS3 that aims congestion control mechanisms within networks by transmitting the spoofed ICMP Source Quench messages influencing or interrupting typical traffic flow. These attacks utilize the now-deprecated ICMP Source Quench mechanism controlling a transmission rate of sender.
Below is a simple guide on how to replicate a quench attack in NS3:
Steps to Start Quench Attack Projects in NS3
- Set Up NS3
- We install and build NS3 on the system:
./waf configure
./waf build
- Confirm the installation:
./waf –run hello-simulator
- Understand Quench Attacks
- Mechanism:
- ICMP Source Quench messages are transmitted to a sender to direct it to slow by reason of network congestion.
- An attacker transmits spoofed Source Quench messages to legitimate nodes to artificially adjust its interaction.
- Impact:
- It minimized the throughput and then reduced network performance for the victim.
- Define the Network Topology
- We need to make a network including:
- Sender Node: It creates typical traffic.
- Receiver Node: This node makes intended destination of the traffic.
- Attacker Node: It transmits spoofed ICMP Source Quench messages.
- Example Topology:
NodeContainer senderNode, receiverNode, attackerNode;
senderNode.Create(1); // Sender
receiverNode.Create(1); // Receiver
attackerNode.Create(1); // Attacker
PointToPointHelper p2p;
p2p.SetDeviceAttribute(“DataRate”, StringValue(“100Mbps”));
p2p.SetChannelAttribute(“Delay”, StringValue(“2ms”));
// Connect nodes
NetDeviceContainer devices1 = p2p.Install(NodeContainer(senderNode.Get(0), receiverNode.Get(0)));
NetDeviceContainer devices2 = p2p.Install(NodeContainer(attackerNode.Get(0), senderNode.Get(0)));
- Assign IP Addresses
- We can install the Internet stack and then allocate an IP addresses to the nodes.
InternetStackHelper stack;
stack.Install(senderNode);
stack.Install(receiverNode);
stack.Install(attackerNode);
Ipv4AddressHelper address;
address.SetBase(“10.1.1.0”, “255.255.255.0”);
address.Assign(devices1);
address.SetBase(“10.1.2.0”, “255.255.255.0”);
address.Assign(devices2);
- Simulate Legitimate Communication
- We insert typical traffic among the sender and receiver.
uint16_t port = 80;
UdpEchoServerHelper echoServer(port);
ApplicationContainer serverApp = echoServer.Install(receiverNode.Get(0));
serverApp.Start(Seconds(1.0));
serverApp.Stop(Seconds(10.0));
UdpEchoClientHelper echoClient(Ipv4Address(“10.1.1.2”), port);
echoClient.SetAttribute(“MaxPackets”, UintegerValue(50));
echoClient.SetAttribute(“Interval”, TimeValue(Seconds(0.1)));
echoClient.SetAttribute(“PacketSize”, UintegerValue(512));
ApplicationContainer clientApp = echoClient.Install(senderNode.Get(0));
clientApp.Start(Seconds(2.0));
clientApp.Stop(Seconds(10.0));
- Simulate the Quench Attack
6.1 Spoof ICMP Source Quench Messages
- The attacker transmits the spoofed ICMP Source Quench messages to the sender.
void QuenchAttack(Ptr<Node> attacker, Ipv4Address targetSender) {
Ptr<Socket> socket = Socket::CreateSocket(attacker, TypeId::LookupByName(“ns3::Ipv4RawSocketFactory”));
InetSocketAddress remote = InetSocketAddress(targetSender, 0); // Port 0 for ICMP
socket->Connect(remote);
for (int i = 0; i < 10; ++i) { // Send 10 spoofed ICMP Source Quench messages
Simulator::Schedule(MicroSeconds(i * 100), [=]() {
IcmpHeader icmpHeader;
icmpHeader.SetType(IcmpHeader::SOURCE_QUENCH); // ICMP Source Quench
icmpHeader.SetCode(0);
Ptr<Packet> icmpPacket = Create<Packet>();
icmpPacket->AddHeader(icmpHeader);
socket->Send(icmpPacket);
});
}
}
Simulator::Schedule(Seconds(3.0), &QuenchAttack, attackerNode.Get(0), Ipv4Address(“10.1.1.1”));
6.2 Flood Source Quench Messages
- To devastate the sender including Source Quench messages’ flood.
for (int i = 0; i < 1000; ++i) { // Flood with 1000 messages
Simulator::Schedule(MicroSeconds(i * 10), [=]() {
Ptr<Packet> icmpPacket = Create<Packet>();
icmpPacket->AddHeader(icmpHeader);
socket->Send(icmpPacket);
});
}
- Enable Packet Tracing
- Utilize PCAP to seize packets for analysis:
PointToPointHelper p2p;
p2p.EnablePcapAll(“quench-attack”);
- Run the Simulation
- Now, we compile and run the simulation:
./waf –run quench-attack
- Analyze the Attack
- Go to the .pcap files within Wireshark:
wireshark quench-attack-0-0.pcap
- Analyse the ICMP Source Quench messages using filters:
- ICMP Quench: icmp.type == 4
- Implement Detection and Mitigation
- Detection:
- We observe the ICMP traffic for unusual patterns.
- From a single source, we can identify excessive Source Quench messages.
- Mitigation:
- Inactivate processing of ICMP Source Quench messages which is the most modern systems already perform this.
- We can utilize rate limiting for ICMP messages.
We had shown comprehensive procedure with sample coding to simulate and analyse the Quench Attack Projects using NS3 simulation tool. We plan to provide more information depends on your requirements.
We handle Quench Attack Projects using the ns3 tool. If you want new project results, let our team take care of it. Send us a message for expert guidance. We focus on the ICMP Source Quench mechanism related to your project needs.