The 7-Layer Security Reference Matrix
When architecting a resilient defense, security teams cannot deploy controls exclusively at the perimeter. Each layer of the Open Systems Interconnection (OSI) model carries specific protocol primitives, distinct vulnerability classes, and specialized defensive telemetry:
| Tier & Name | PDU | Core Protocols | Representative Attacks | Primary Defensive Controls | Telemetry Sources |
|---|---|---|---|---|---|
| L7 // Application | Data | HTTP, HTTPS, DNS, SSH, SMTP | SQLi, XSS, SSRF, Deserialization, API abuse | WAF, Input Validation, Schema Enforcement | Web Access Logs, WAF Alerts, APM |
| L6 // Presentation | Data | TLS, MIME, ASN.1, XML, JSON | TLS Downgrade, POODLE, Homoglyphs, Parser exploits | Strict TLS 1.3, HSTS, Secure Parsers | TLS Handshake Logs, Zeek ssl.log |
| L5 // Session | Data | RPC, NetBIOS, PPTP, SMB Session | Session Fixation, Token Theft, RPC Hijacking | HttpOnly / SameSite cookies, Short TTLs | Auth Logs, Kerberos TGT logs (EID 4769) |
| L4 // Transport | Segment / Datagram | TCP, UDP, SCTP, QUIC | SYN Floods, UDP Amplification, Port Scanning | SYN Cookies, Stateful Firewalls, Rate Limiting | NetFlow / IPFIX, Firewall Drops |
| L3 // Network | Packet | IPv4, IPv6, ICMP, BGP, OSPF | IP Spoofing, BGP Hijacking, ICMP Tunneling | uRPF, BGP RPKI ROA, Route Filtering | Router Syslog, BGP Monitors, Zeek conn.log |
| L2 // Data Link | Frame | Ethernet, ARP, 802.1Q, 802.11 | ARP Poisoning, MAC Flooding, VLAN Hopping | Dynamic ARP Inspection (DAI), Port Security, 802.1X | Switch MAC tables, DHCP Snooping DB |
| L1 // Physical | Bit | Copper, Fiber, Radio RF, USB | Hardware Keyloggers, Rogue Implants, Console Boot | Locked Racks, 802.1X NAC, USB Endpoint Blocking | Badge Readers, Link State Traps |
Layer 7 - Application Layer (Exploits & Business Logic)
Layer 7 is where users, web browsers, and application runtimes interact directly with software services. Because it processes untrusted user input, it accounts for the majority of Internet-facing vulnerabilities:
- SQL Injection (SQLi): Inputting malicious SQL fragments into input fields or headers to bypass authentication gates or exfiltrate database contents.
- Cross-Site Scripting (XSS): Injecting client-side JavaScript that executes within victim browser contexts, stealing session cookies and DOM state.
- Server-Side Request Forgery (SSRF): Coercing internal cloud servers into requesting metadata endpoints (e.g.
http://169.254.169.254/) to dump temporary instance credentials. - Insecure Deserialization: Passing weaponized byte streams that spawn arbitrary remote code execution (e.g. Log4j, Apache Struts, Java RMI).
Layer 6 - Presentation Layer (Encoding & Cryptographic Downgrades)
The Presentation Layer handles syntax translation, data compression, serialization, and encryption negotiation:
- Cryptographic Downgrade Attacks: Intercepting handshake negotiations to force servers into legacy protocols (such as SSLv3 or TLS 1.0) vulnerable to known attacks like POODLE or BEAST.
- Homoglyph & Punycode Deceptions: Exploiting Unicode lookalike characters (e.g. Cyrillic "а" replacing Latin "a") to construct deceptive phishing domains that appear identical in URL bars.
- Malformed Parser Exploitation: Sending deliberately corrupted PDF, TIFF, or gzip compression bombs that trigger buffer overflows within system decompression libraries.
Layer 5 - Session Layer (State Interception & Token Fixation)
The Session Layer establishes, manages, and terminates connections between cooperative applications:
- Session Token Hijacking: Stealing active authentication cookies or JWT bearer tokens via network eavesdropping or cross-site scripting, allowing an adversary to impersonate authenticated operators without possessing passwords.
- Session Fixation: Forcing a target client to authenticate with a pre-allocated session identifier known to the adversary.
- RPC & DCOM Abuse: Abusing unauthenticated remote procedure calls to hijack remote session contexts on Windows domain members.
Layer 4 - Transport Layer (State Exhaustion & Port Sweeping)
Layer 4 provides end-to-end communication services via connection-oriented (TCP) or connectionless (UDP) channels:
- TCP SYN Floods: Transmitting millions of SYN packets with spoofed source addresses, causing the target operating system to allocate half-open connection slots until kernel backlog memory is exhausted.
- UDP Reflection Amplification: Sending spoofed UDP queries to misconfigured DNS, NTP, or Memcached servers, directing massive amplified reply bursts at victim IP addresses.
- High-Speed Port Scanning: Rapidly probing port states (using tools like Nmap or Masscan) using half-open SYN handshakes to enumerate active listening services without completing the 3-way handshake.
Layer 3 - Network Layer (Routing Abuse & Packet Spoofing)
Layer 3 manages packet forwarding, routing decisions, and addressing across distinct logical networks:
- IP Address Spoofing: Forging source IP addresses in packet headers to bypass primitive packet-filter firewalls or frame another host for an attack.
- BGP Route Hijacking: Rogue autonomous systems (AS) announcing illegitimate IP prefixes over Border Gateway Protocol, rerouting international transit traffic through adversary surveillance points.
- ICMP Redirect Attacks: Injecting forged ICMP type 5 redirect messages to deceive host routing tables into sending egress packets through an adversary-controlled gateway.
Layer 2 - Data Link Layer (Switched Fabric & ARP Poisoning)
Layer 2 governs node-to-node frame transfer within the local broadcast domain using MAC hardware addresses:
- ARP Cache Poisoning: Transmitting unsolicited ARP replies to poison local subnet mapping tables, redirecting all local workstation traffic through the adversary's machine (Man-in-the-Middle).
- MAC Table Flooding (CAM Overflow): Flooding switch memory with bogus MAC addresses until the switch enters fail-open hub mode, broadcasting all traffic to every physical port.
- 802.1Q VLAN Hopping: Exploiting switch trunk autonegotiation (DTP) or injecting double-tagged 802.1Q frames to leak packets across isolated security VLANs.
Layer 1 - Physical Layer (Hardware Implants & Console Interception)
The Physical Layer consists of raw electrical, optical, or radio transmissions across physical media:
- Inline Hardware Keyloggers: Physical pass-through adapters inserted between keyboards and USB ports that silently record keystrokes regardless of OS encryption.
- Rogue Dropboxes & Taps: Installing covert Raspberry Pi implants or optical fiber splitters directly inside wiring closets to capture unencrypted local transit.
- Direct Console Extraction: Booting physical machines from Linux live media to bypass operating system login controls when full-disk encryption (BitLocker) is absent.
Attack Chaining: Tracing a Multi-Layer Intrusion
In modern threat scenarios, adversaries rarely restrict their activities to a single tier. Sophisticated campaigns chain across multiple OSI boundaries in sequence:
# Phase 1: Ingress at Layer 7 (Application)
[L7] Phishing email delivers weaponized macro attachment via SMTP/HTTPS.
User executes payload; dropper contacts C2 server.
# Phase 2: Staging at Layer 4 (Transport)
[L4] Implant establishes encrypted outbound TCP socket on port 443.
Bypasses inbound firewall restrictions via egress polling.
# Phase 3: Discovery & Pivoting at Layer 2 & 3 (Data Link & Network)
[L2] Attacker executes ARP sweep on local /24 segment to map neighbors.
[L3] Exploits unsegmented routing to reach internal domain controllers.
# Phase 4: Credential Theft at Layer 5 & 7 (Session & Application)
[L5] Attacker hijacks cached Kerberos service tickets via Pass-the-Ticket.
[L7] Dumps database records through internal administrative web portal.
Defensive Telemetry & Architecture Checklist
- Layer 7 Defense: Deploy Web Application Firewalls (WAF), enforce strict input validation, and use parameterized queries.
- Layer 6 Defense: Mandate TLS 1.3, configure HTTP Strict Transport Security (HSTS), and sanitize file parsing libraries.
- Layer 5 Defense: Implement secure, HttpOnly, SameSite session cookies and short authorization token lifetimes.
- Layer 4 Defense: Enable TCP SYN cookies on border gateways and configure dynamic rate-limiting thresholds.
- Layer 3 Defense: Configure Unicast Reverse Path Forwarding (uRPF) to drop spoofed source IPs and validate BGP RPKI ROAs.
- Layer 2 Defense: Enable Dynamic ARP Inspection (DAI), DHCP Snooping, and 802.1X Port Security on all managed access switches.
- Layer 1 Defense: Enforce BitLocker/LUKS full-disk encryption with TPM pins, disable unused physical ports, and lock server enclosures.
Defensive Takeaway
Security is not a single barrier; it is an interlocking defense-in-depth mesh. When you evaluate an attack through the OSI lens, you immediately discover the appropriate tier to place preventative controls, inspect telemetry logs, and sever adversary kill chains.
Educational and Defensive Scope: Published for network engineering reference, threat modeling, and defensive architecture design.