Copyright (c) 2026 MindMesh Academy. All rights reserved. This content is proprietary and may not be reproduced or distributed without permission.

5.1.1. OSI and TCP/IP Models: Security Layer by Layer

💡 First Principle: The OSI model provides a universal vocabulary for describing where in the communication stack something happens. When someone says "this is a Layer 3 attack" or "this control operates at Layer 7," they are using OSI layer references to communicate precisely about the scope and nature of a security event. Without this shared vocabulary, security discussions become ambiguous.

The OSI Model — 7 Layers:
LayerNamePDUKey ProtocolsSecurity RoleAttack Examples
7ApplicationDataHTTP, HTTPS, SMTP, DNS, FTPWAF, application controlsSQL injection, XSS, phishing, buffer overflow
6PresentationDataTLS/SSL, JPEG, ASCII, MIMEEncryption/decryptionSSL stripping, certificate attacks
5SessionDataNetBIOS, RPC, SQL sessionsSession managementSession hijacking, replay attacks
4TransportSegmentTCP, UDPStateful firewall, port filteringSYN flood, port scanning, TCP hijacking
3NetworkPacketIP, ICMP, IPsec, OSPF, BGPRouter ACLs, IP filteringIP spoofing, route injection, ICMP attacks
2Data LinkFrameEthernet, Wi-Fi (802.11), ARP, STPSwitch security, VLANARP spoofing, MAC flooding, VLAN hopping
1PhysicalBitCable, fiber, radio, hubsPhysical access controlWiretapping, jamming, hardware tampering

Memory aid: "All People Seem To Need Data Processing" (Application, Presentation, Session, Transport, Network, Data Link, Physical — top to bottom) or reversed: "Please Do Not Throw Sausage Pizza Away."

TCP/IP Model vs. OSI:
TCP/IP LayerMaps to OSIKey Protocols
ApplicationLayers 5, 6, 7HTTP, DNS, SMTP, FTP, SSH, TLS
TransportLayer 4TCP, UDP
InternetLayer 3IP, ICMP, ARP
Network AccessLayers 1, 2Ethernet, Wi-Fi, PPP
TCP vs. UDP — the fundamental transport choice:
FeatureTCPUDP
ConnectionConnection-oriented (3-way handshake)Connectionless
ReliabilityGuaranteed delivery, orderedBest-effort, unordered
Error checkingChecksum + retransmissionChecksum only (optional)
Flow controlYes (windowing)No
SpeedSlower (overhead)Faster (minimal overhead)
Use casesHTTP/S, SMTP, SSH, FTP — where data integrity mattersDNS, DHCP, VoIP, streaming, SNMP — where speed > guaranteed delivery
Attack surfaceSYN flood (exhausts half-open connections)UDP flood (high volume, stateless)
TCP 3-way handshake:
Protocol Data Units (PDUs) by layer:
  • Layer 7-5: Data
  • Layer 4: Segment (TCP) / Datagram (UDP)
  • Layer 3: Packet
  • Layer 2: Frame
  • Layer 1: Bits

⚠️ Exam Trap: ARP operates at Layer 2 but resolves Layer 3 addresses (IP → MAC). ARP spoofing is therefore a Layer 2 attack — a Layer 3 firewall cannot prevent it. Defense requires Layer 2 controls: Dynamic ARP Inspection (DAI) on switches, which validates ARP replies against a trusted DHCP snooping table.

Reflection Question: An attacker is poisoning ARP tables on a switched network to intercept traffic between two hosts. Identify the OSI layer at which this attack operates, explain why traditional firewalls cannot detect it, and name the specific switch-level control that prevents it.

Alvin Varughese
Written byAlvin Varughese
Founder15 professional certifications