How to Start Fragmentation Attack Projects Using OMNeT++
To start Fragmentation Attack using OMNeT++ which needs to replicate network scenarios in which an attacker utilises the network packet fragmentation process to either consume resources, avoid firewalls, or implement denial-of-service (DoS) attacks. This attack influences how packets are divided and rebuilt within a network.
Following is a basic approach on how to start a Fragmentation Attack Simulation Project in OMNeT++:
Steps to Start Fragmentation Attack Simulation Project in OMNeT++
- Understand Fragmentation Attacks
- Definition:
- Fragmentation attacks include inappropriately transmitting fragmented packets to utilise how the target manages the packet reassembly.
- Common goals:
- Security bypass by crafting overlapping fragments.
- Denial of Service (DoS).
- Resource exhaustion like fragment buffer overflows.
- Examples:
- Teardrop Attack: It transmits overlapping fragmented packets for dropping the target system.
- Tiny Fragment Attack: Forwardly very small fragments to avoid firewalls.
- Set Up OMNeT++ and INET Framework
- Install OMNeT++: We should download and install the new version of OMNeT++ on the system.
- Install INET Framework:
- INET framework offers modules for network protocols with IP, TCP, and UDP that are crucial for fragmentation.
- Define Project Scope
Step 3.1: Goals
- Mimic a fragmentation attack like a Teardrop attack or a Tiny Fragment attack.
- Estimate their influence over:
- Network performance like latency, packet loss.
- Target system behavior such as crashes or resource depletion.
Step 3.2: Metrics
- Fragment Reassembly Success Rate: Estimate how frequently target properly reassembles fragmented packets.
- Packet Delivery Ratio (PDR): Assess the legitimate traffic’s success rate.
- Impact on Network Performance: Examine the network performance parameters such as latency, throughput, and packet loss.
- Design Network Topology
We need to create a network topology including client, server, and an attacker. It contains a router for replicating a real-world network.
Example .ned File:
network FragmentationAttackNetwork {
submodules:
attacker: StandardHost; // Attacker node
client: StandardHost; // Legitimate client
server: StandardHost; // Target server
router: Router; // Router connecting all nodes
connections allowunconnected:
attacker.ethg++ <–> EthernetLink <–> router.ethg++;
client.ethg++ <–> EthernetLink <–> router.ethg++;
router.ethg++ <–> EthernetLink <–> server.ethg++;
}
- Implement the Fragmentation Attack
Step 5.1: Create an Attacker Module
Inscribe a custom module for making fragmented packets inappropriately.
Example Code: Teardrop Attack
#include <omnetpp.h>
#include “inet/common/packet/Packet.h”
#include “inet/networklayer/ipv4/Ipv4Header_m.h”
using namespace omnetpp;
using namespace inet;
class FragmentationAttacker : public cSimpleModule {
protected:
virtual void initialize() override;
virtual void handleMessage(cMessage *msg) override;
void sendFragmentedPacket();
};
Define_Module(FragmentationAttacker);
void FragmentationAttacker::initialize() {
// Schedule the first fragmented packet
scheduleAt(simTime() + uniform(0.1, 0.2), new cMessage(“startAttack”));
}
void FragmentationAttacker::handleMessage(cMessage *msg) {
if (strcmp(msg->getName(), “startAttack”) == 0) {
sendFragmentedPacket();
// Schedule the next attack
scheduleAt(simTime() + uniform(0.1, 0.3), msg);
}
}
void FragmentationAttacker::sendFragmentedPacket() {
EV << “Sending fragmented packets\n”;
// Create overlapping fragments
auto pkt1 = new Packet(“Fragment1”);
auto pkt2 = new Packet(“Fragment2”);
auto ipv4Header1 = makeShared<Ipv4Header>();
ipv4Header1->setFragmentOffset(0); // First fragment
ipv4Header1->setMoreFragments(true); // Indicate more fragments
ipv4Header1->setIdentification(12345); // Same ID for all fragments
pkt1->insertAtFront(ipv4Header1);
auto ipv4Header2 = makeShared<Ipv4Header>();
ipv4Header2->setFragmentOffset(8); // Overlapping fragment offset
ipv4Header2->setMoreFragments(false); // Last fragment
ipv4Header2->setIdentification(12345); // Same ID
pkt2->insertAtFront(ipv4Header2);
send(pkt1, “out”);
send(pkt2, “out”);
}
Step 5.2: Legitimate Traffic
Replicate typical traffic among the client and server to utilise INET’s UdpBasicApp.
- Configure the Simulation
Example .ini File Configuration:
[Config FragmentationAttackSimulation]
network = FragmentationAttackNetwork
# Legitimate client configuration
**.client.numApps = 1
**.client.app[0].typename = “UdpBasicApp”
**.client.app[0].destAddress = “server”
**.client.app[0].startTime = 1s
**.client.app[0].sendInterval = 2s
# Target server configuration
**.server.numApps = 1
**.server.app[0].typename = “UdpSink”
# Attacker configuration
**.attacker.numApps = 1
**.attacker.app[0].typename = “FragmentationAttacker”
# Simulation time
sim-time-limit = 100s
- Run and Visualize the Simulation
- Run the Simulation: Execute the simulation using OMNeT++ IDE.
- Monitor Behavior:
- Records of fragmented packets that are transmitted by the attacker.
- Observe the target node behavior like reassembly errors, packet drops.
- Analyze Results
Metrics to Evaluate:
- Fragment Reassembly Success Rate:
- Calculate the rate of fragmented packets which are effectively reassembled by the server.
- Packet Delivery Ratio (PDR):
- Measure the legitimate traffic’s success rate to attain the server.
- Network Performance:
- Examine the network performance metrics like latency and throughput for legitimate traffic.
- Target Resource Utilization:
- Confirm for target resource utilization on the server such as memory or CPU usage.
- Enhance the Project
Step 9.1: Advanced Attack Variants
- Tiny Fragment Attack:
- Make fragments, which are smaller than the protocol’s minimum size for avoiding firewalls.
- Fragment Flooding:
- Transmit a high volume of fragmented packets utilising the resources of server.
Step 9.2: Implement Defenses
- Reassembly Validation:
- Integrate the logic for identifying overlapping or invalid fragments.
- Fragmentation Limits:
- Execute rules to eliminate the excessive fragmentation or malformed fragments.
Step 9.3: Add Realism
- Mimic larger networks including several legitimate clients and attackers.
- Launch mobility to utilise the mobility components of INET.
We had demonstrated the significant method to Fragmentation Attack projects with example coding, simulated and analysed using OMNeT++ environment. More specific details will also follow.