Network Security Fundamentals: OSI & TCP/IP Vulnerabilities across Layers

Computer networks were originally designed in academic and military environments (ARPANET) where interconnected nodes fundamentally trusted one another. As a consequence, core foundational networking protocols—including IP, TCP, UDP, ARP, and DNS—were engineered without built-in encryption or cryptographic authentication. Understanding how modern adversaries exploit these protocol weaknesses across the OSI 7-layer model is essential for every network defender.

The OSI 7-Layer Model: Threats & Defensive Controls

Every network communication transits through the Open Systems Interconnection (OSI) stack. Security engineers examine vulnerabilities at each specific layer:

OSI 7-Layer Model Security Weaknesses and Defensive Protocols

Figure 8.1: Comprehensive OSI 7-Layer Protocol Stack, Vulnerabilities, and Defensive Hardening

Layer 2 Data Link Vulnerabilities: ARP Cache Poisoning

The Address Resolution Protocol (ARP) translates Layer 3 IP addresses into Layer 2 physical MAC addresses. Crucially, ARP is entirely stateless and unauthenticated: any computer can send a forged ARP reply claiming ownership of an IP address!

How Man-in-the-Middle (MitM) ARP Spoofing Works

  1. Attacker sends gratuitous ARP replies to Victim: "192.168.1.1 (Default Gateway) is at Attacker's MAC [AA:BB:CC:DD:EE:FF]".
  2. Attacker sends gratuitous ARP replies to Gateway: "192.168.1.50 (Victim PC) is at Attacker's MAC [AA:BB:CC:DD:EE:FF]".
  3. Both machines update their ARP tables. All victim network traffic now flows straight through the attacker's machine before reaching the internet!

Defenses against ARP Spoofing: Deploying Dynamic ARP Inspection (DAI) on managed enterprise switches, pairing with DHCP Snooping, or utilizing static ARP bindings.

Layer 4 Transport Vulnerabilities: The TCP 3-Way Handshake

Transmission Control Protocol (TCP) establishes reliable connection-oriented sessions via a synchronized 3-way handshake:

Client                          Server
  |                               |
  | -------- SYN (Seq=x) -------> |   1. Client requests connection
  |                               |
  | <---- SYN-ACK (Seq=y,Ack=x+1) |   2. Server allocates memory & responds
  |                               |
  | -------- ACK (Ack=y+1) -----> |   3. Client acknowledges; session ESTABLISHED
  |                               |

The SYN Flood Exploit: In a classic SYN flood attack, an adversary sends millions of spoofed SYN packets with forged source IP addresses and deliberately never sends the final ACK. The victim server keeps half-open connection slots allocated in its backlog queue until memory resources are completely exhausted, crashing legitimate traffic.

Defensive Fix: Enabling TCP SYN Cookies

Linux kernels defeat SYN floods using SYN Cookies. Instead of allocating memory state in the backlog queue upon receiving a SYN, the server encodes session state directly into the initial sequence number (ISN). Memory is only allocated when the client returns a valid ACK!

# Check if SYN Cookies are enabled on Linux (1 = Enabled)
sysctl net.ipv4.tcp_syncookies

# Permanently enable SYN Cookies
echo "net.ipv4.tcp_syncookies = 1" | sudo tee -a /etc/sysctl.conf
sudo sysctl -p

Frequently Asked Questions (FAQ) - Student & Interview Review

Q1. What is IP Spoofing and why is it possible in IPv4?

IPv4 packets contain a 'Source IP' field in their header that is not verified by standard routers during transit. An attacker can craft raw sockets inserting any arbitrary IP address in the source field, leading to blind connection spoofing or denial of service.

Q2. How does Dynamic ARP Inspection (DAI) prevent ARP poisoning?

Enterprise network switches running DAI inspect all ARP requests and responses, validating IP-to-MAC bindings against a trusted DHCP Snooping database. Any invalid or spoofed ARP packet is dropped instantly at the switch port.

Explore Related Cybersecurity Tutorials & Next Steps

Broaden your defensive and offensive security knowledge across our curriculum:

Port Scanning & Nmap Command Mastery

Perform active network reconnaissance to identify open ports and services.

Wireshark Packet Analysis Guide

Inspect TCP handshakes, ARP traffic, and unencrypted credentials in transit.

Firewall Architecture & Filtering

Block malicious network traffic with packet filtering and stateful rules.

DoS/DDoS Attacks & Mitigation

Protecting Layer 4 transport protocols from volumetric SYN floods.

Share Share on Facebook Share on Twitter Share on LinkedIn Pin on Pinterest Share on Reddit

You may also like this!