OSI layers and cybersecurity attacks: what hits each layer and how to defend

Learn how each layer of the OSI model is targeted by cyber attackers. Explore common attacks from Layer 1 (Physical) to Layer 7 (Application) and how to defend against them effectively.

May 12, 2025 - 09:42
Updated: 
104.7k

Network Security in Cybersecurity & Ethical Hacking · Tutorial

Cybersecurity Foundations

OSI layers and cybersecurity attacks: what hits each layer and how to defend

Quick answer: Each OSI layer has its own typical attacks: phishing and injection at the application layer, session hijacking at layer 5, SYN floods at transport, IP spoofing at network, ARP spoofing at data link, and cable tapping or jamming at the physical layer. Defences are matched per layer, and Wireshark filters help you spot the traffic.

Key takeaways

  • Attacks and defences are easier to remember when mapped to the seven OSI layers.
  • ARP spoofing sits at layer 2, IP spoofing at layer 3, SYN flood at layer 4, and web attacks at layer 7.
  • Layered defence means a control at each layer, not one firewall.
  • Wireshark display filters make several of these attacks visible in a capture.
  • Practise only on your own lab network.

How does the OSI model help in security?

The OSI model splits network communication into seven layers. Security teams use it as a map: when an incident happens, you ask which layer is affected and which control belongs there. If you need a refresher, read what the OSI model is and how it differs from the TCP/IP model.

Which attacks and defences belong to each layer?

LayerTypical attacksDefences
7 ApplicationPhishing, SQL injection, XSSInput validation, WAF, patching
6 PresentationWeak or stripped encryption, malformed dataStrong TLS settings, safe parsers
5 SessionSession hijacking, token theftSecure cookies, short sessions, MFA
4 TransportSYN flood, port scanningRate limiting, SYN cookies, firewalls
3 NetworkIP spoofing, ICMP abuseIngress filtering, ACLs, IPsec
2 Data linkARP spoofing, MAC floodingPort security, dynamic ARP inspection
1 PhysicalCable tapping, jamming, device theftLocked racks, cabling controls

Our deeper article on cyberattacks at each OSI layer covers each one.

What does this look like in Wireshark?

Wireshark shows packets from the data link layer upward, so you can see signs of several attacks. Practise on your own lab VMs. The Wireshark documentation explains capture and display filters. These display filters are for spotting problems, not causing them.

  • Layer 2, ARP anomalies: arp.duplicate-address-detected flags an IP claimed by two MAC addresses. Compare the MAC against your known device list.
  • Layer 4, SYN flood signs: tcp.flags.syn == 1 && tcp.flags.ack == 0 shows connection attempts. A huge count from many addresses with no completed handshakes is the pattern.
  • Layer 3, odd ICMP: icmp shows ping and unreachable messages. Bursts can indicate scanning or abuse.
  • Layer 7, DNS: dns lists lookups. Unusual names or very long ones may point to tunnelling.
  • Layer 6, TLS: tls.handshake shows the negotiated versions, so you can spot outdated protocol use.

How do you run a simple exercise?

  1. Build two or three VMs on a host-only network.
  2. Start a capture on one VM.
  3. Generate normal traffic: ping, browse a local web page, resolve a name.
  4. Apply each filter and note what normal looks like.
  5. Write down what a deviation would look like. That baseline is what a defender uses.

Never capture or test on a network you do not own or have written permission to monitor.

What is layered defence?

No single control covers every layer. A firewall helps at layers 3 and 4 but does not stop an SQL injection at layer 7. Port security helps at layer 2 but not against stolen credentials. Combine controls and log at each layer.

Common mistakes

  • Treating the OSI model as a strict reality. Real protocols blur layers, and TCP/IP is what is actually deployed.
  • Putting all trust in one perimeter device.
  • Forgetting layer 1 and 2 on internal networks.

Next steps

To practise packet analysis, see our Computer Network course and the CCNA course. For the attack side by layer, read cyberattacks at each OSI layer.

Frequently Asked Questions

From top to bottom: application, presentation, session, transport, network, data link and physical. Each layer has a defined job in moving data, and each has its own typical attacks and defences.

ARP spoofing and MAC flooding are common layer 2 attacks. Defences include port security and dynamic ARP inspection on switches, and monitoring for duplicate IP-to-MAC mappings.

A SYN flood is a transport layer denial-of-service attack that sends many connection requests without completing the handshake. Defences include SYN cookies, rate limiting and firewall protections.

They are application layer attacks (layer 7) because they abuse how web applications handle input. Defences include input validation, parameterised queries, output encoding and a web application firewall.

Yes, to a degree. Display filters can reveal duplicate ARP addresses, many unanswered SYN packets, odd DNS names or old TLS versions. It shows evidence but does not block attacks.

It is mainly a teaching and troubleshooting model. Real networks use the TCP/IP stack, but OSI layer names remain the common language for describing where a problem or attack sits.

What's Your Reaction?

Like Like 0
Dislike Dislike 0
Love Love 0
Funny Funny 0
Wow Wow 0
Sad Sad 0
Angry Angry 0
Vaishnavi

Vaishnavi is a skilled tech professional at the Ethical Hacking Training Institute in Pune, responsible for managing and optimizing the technical infrastructure that supports advanced cybersecurity education. With deep expertise in network security, backend operations, and system performance, she ensures that practical labs, online modules, and assessments run smoothly and securely. Her behind-the-scenes contributions play a vital role in delivering a seamless and secure learning experience for aspiring ethical hackers.