To simulate active attacks within OMNeT++, which encompasses making scenarios in which an attacker directly manipulates, changes, or disrupts communication among legitimate nodes in a network. Dissimilar passive attacks, where the attacker only listens to or observes the traffic, active attacks contain actions, which affect the integrity, availability, or confidentiality of the communication. Instances of active attacks comprise Denial of Service (DoS), Man-in-the-Middle (MitM) attacks, packet injection, and session hijacking. We know it is a tuff process so send us all your project details we grant you with best project topics and simulation guidance. We will guide you through simulation procedure on how we can simulate distinct types of active attacks using OMNeT++.
Steps to Simulate Active Attacks Projects in OMNeT++
- Set up OMNeT++ and INET Framework
- Install OMNeT++: We download and install OMNeT++ from the OMNeT++ official website.
- Install INET Framework: INET framework offers network protocols such as TCP, UDP, ICMP, and routing models, which are necessary for replicating active attacks. We can download INET framework from the INET GitHub page or install it using OMNeT++’s package manager.
- Understand Active Attacks
Active attacks can vary in scope and technique. Some general kinds of active attacks, which we can simulate contain:
- Denial of Service (DoS) Attack: The attacker floods a server with traffic to overwhelm it and create it unobtainable to legitimate users.
- Man-in-the-Middle (MitM) Attack: The attacker intercepts, changes, and potentially inserts new packets into a communication among two legitimate nodes.
- Packet Injection Attack: The attacker inserts forged or malicious packets into the communication stream.
- Session Hijacking Attack: The attacker takes control of an existing session among two communicating nodes.
- Define Network Topology (NED File)
Make a network in which we replicate communication among legitimate users and launch an attacker who acts one of the active attacks. The network topology may contain hosts, servers, routers, and an attacker node.
Example NED File for Active Attack Simulation:
network ActiveAttackNetwork
{
submodules:
hostA: StandardHost {
@display(“i=device/pc”);
}
hostB: StandardHost {
@display(“i=device/pc”);
}
attacker: StandardHost {
@display(“i=device/laptop”);
}
router: Router {
@display(“i=abstract/router”);
}
server: StandardHost {
@display(“i=device/server”);
}
connections:
hostA.pppg++ <–> PointToPointLink <–> router.pppg++;
hostB.pppg++ <–> PointToPointLink <–> router.pppg++;
attacker.pppg++ <–> PointToPointLink <–> router.pppg++;
server.pppg++ <–> PointToPointLink <–> router.pppg++;
}
In this topology:
- hostA and hostB are legitimate users who communicate via the router.
- server denotes a target, like a web or database server.
- attacker is a malicious node, which will perform active attacks on the network.
- Simulate Denial of Service (DoS) Attack
A DoS attack floods the target server with unnecessary traffic, overloading its resources and avoiding legitimate users from accessing the service.
Example C++ Code for DoS Attacker:
class DoSAttacker : public cSimpleModule
{
private:
simtime_t attackInterval; // Interval between attack packets
cMessage *attackTimer; // Timer to schedule the next attack packet
protected:
virtual void initialize() override;
virtual void handleMessage(cMessage *msg) override;
void sendAttackPacket();
};
void DoSAttacker::initialize()
{
attackInterval = par(“attackInterval”); // Get interval from .ini file
attackTimer = new cMessage(“attackTimer”);
scheduleAt(simTime(), attackTimer); // Start the attack immediately
}
void DoSAttacker::handleMessage(cMessage *msg)
{
if (msg == attackTimer) {
sendAttackPacket();
scheduleAt(simTime() + attackInterval, attackTimer); // Schedule next attack
}
}
void DoSAttacker::sendAttackPacket()
{
cPacket *attackPacket = new cPacket(“AttackPacket”);
// Set up the packet to simulate flooding the target
attackPacket->setByteLength(512); // Size of the attack packet
EV << “Sending DoS attack packet to the server” << endl;
send(attackPacket, “out”); // Send the attack packet towards the server
}
Configuration for DoS Attack in omnetpp.ini:
[General]
network = ActiveAttackNetwork
sim-time-limit = 100s
# Configure attacker to send flooding packets to the server
*.attacker.numApps = 1
*.attacker.app[0].typename = “DoSAttacker”
*.attacker.app[0].attackInterval = 0.02s # Send attack packets every 0.02 seconds
# Legitimate traffic from hostA to the server (HTTP-like traffic)
*.hostA.numTcpApps = 1
*.hostA.tcpApp[0].typename = “TcpBasicClientApp”
*.hostA.tcpApp[0].connectAddress = “server”
*.hostA.tcpApp[0].connectPort = 80
*.hostA.tcpApp[0].sendBytes = 500000 # Send 500KB of data
# Configure the server to respond to legitimate traffic
*.server.numTcpApps = 1
*.server.tcpApp[0].typename = “TcpBasicServerApp”
*.server.tcpApp[0].localPort = 80
In this setup:
- attacker floods the server with packets, trying to overload it.
- hostA transmits legitimate traffic to the server to replicate regular user behaviour.
- Simulate Man-in-the-Middle (MitM) Attack
In a MitM attack, the attacker intercepts traffic among two legitimate hosts that potentially changing the data or inserting new packets.
Example C++ Code for MitM Attacker:
class MitMAttacker : public cSimpleModule
{
protected:
virtual void initialize() override;
virtual void handleMessage(cMessage *msg) override;
void interceptPacket(cPacket *pkt);
};
void MitMAttacker::initialize()
{
EV << “Man-in-the-Middle Attacker initialized.\n”;
}
void MitMAttacker::handleMessage(cMessage *msg)
{
cPacket *pkt = check_and_cast<cPacket*>(msg);
interceptPacket(pkt);
// Forward the packet to the original destination
send(pkt, “out”);
}
void MitMAttacker::interceptPacket(cPacket *pkt)
{
EV << “Intercepted packet: ” << pkt->getName() << endl;
// Optionally, modify the packet’s content or log it
// pkt->setName(“ModifiedPacket”); // Example of modification
}
Configuration for MitM Attack in omnetpp.ini:
[General]
network = ActiveAttackNetwork
sim-time-limit = 100s
# Configure attacker to intercept and modify traffic between hostA and hostB
*.attacker.numApps = 1
*.attacker.app[0].typename = “MitMAttacker”
# Legitimate traffic between hostA and hostB
*.hostA.numTcpApps = 1
*.hostA.tcpApp[0].typename = “TcpBasicClientApp”
*.hostA.tcpApp[0].connectAddress = “hostB”
*.hostA.tcpApp[0].connectPort = 8080
*.hostA.tcpApp[0].sendBytes = 500000 # Send 500KB of data
# HostB acts as the server
*.hostB.numTcpApps = 1
*.hostB.tcpApp[0].typename = “TcpBasicServerApp”
*.hostB.tcpApp[0].localPort = 8080
In this setup:
- MitMAttacker intercepts traffic among hostA and hostB, with the choice to change or drop packets.
- We can record intercepted packets or adjust their content.
- Simulate Packet Injection Attack
In a packet injection attack, the attacker inserts malicious or fake packets into the network communication.
Example C++ Code for Packet Injection Attacker:
class PacketInjector : public cSimpleModule
{
private:
simtime_t injectInterval; // Interval between injected packets
cMessage *injectTimer; // Timer for scheduling injected packets
protected:
virtual void initialize() override;
virtual void handleMessage(cMessage *msg) override;
void injectPacket();
};
void PacketInjector::initialize()
{
injectInterval = par(“injectInterval”); // Interval from .ini file
injectTimer = new cMessage(“injectTimer”);
scheduleAt(simTime(), injectTimer); // Start injection immediately
}
void PacketInjector::handleMessage(cMessage *msg)
{
if (msg == injectTimer) {
injectPacket();
scheduleAt(simTime() + injectInterval, injectTimer); // Schedule next injection
}
}
void PacketInjector::injectPacket()
{
cPacket *maliciousPacket = new cPacket(“InjectedPacket”);
// Set packet parameters, like byte length, and tag it as malicious
maliciousPacket->setByteLength(128); // Example size
maliciousPacket->setName(“MaliciousPacket”);
EV << “Injecting a malicious packet into the network” << endl;
send(maliciousPacket, “out”); // Inject the packet into the network
}
Configuration for Packet Injection in omnetpp.ini:
[General]
network = ActiveAttackNetwork
sim-time-limit = 100s
# Configure attacker to inject malicious packets
*.attacker.numApps = 1
*.attacker.app[0].typename = “PacketInjector”
*.attacker.app[0].injectInterval = 0.05s # Inject packets every 0.05 seconds
- Simulate Session Hijacking Attack
In a session hijacking attack, the attacker takes over an existing session among two communicating parties. It can be mimicked by intercepting a session’s TCP connection and inserting commands or changing data.
We can change the MitMAttacker class to hijack a session by changing the TCP sequence numbers or ACK numbers that permitting the attacker to take control of an existing session.
- Run and Analyze the Simulation
When the network and attacker configurations are configure then we run the simulation in OMNeT++:
- Qtenv or Tkenv: Utilize OMNeT++’s graphical interface to monitor traffic patterns and how the attack influences network communication.
- Monitor the Results: Record the dropped or changed packets, measure delays, packet loss, and monitor how the attacks influence the network.
- Extend the Project
The followings are a few ways to expand the simulation:
- Advanced MitM Attack: Change packets according to particular content or protocol, like injecting commands in an HTTP session.
- Defense Mechanisms: Execute an intrusion detection systems (IDS), firewalls, or rate-limiting to counter active attacks.
- Coordinated Attacks: Replicate several attackers collaboration to execute DDoS or coordinated MitM attacks.
- Encryption: Mimic encrypted traffic and learn how active attacks influence encrypted communications (e.g., TLS).
Example Project Structure:
ActiveAttackSimulation/
├── src/
│ └── ActiveAttackNetwork.ned # Network topology for active attacks
│ └── DoSAttacker.cc # DoS attack implementation
│ └── MitMAttacker.cc # MitM attack implementation
│ └── PacketInjector.cc # Packet injection implementation
├── omnetpp.ini # Simulation configuration
└── Makefile # Build file for compiling the project
We had comprehended the general simulation method to simulate the different kinds of Active Attacks projects utilising the analysis tool OMNeT++. We will offer various detailed guide on this projects depending on your requests.