Network Security Fundamentals
Every attack crosses a network, and much of what decides whether it works is addressing, ports and prefixes. This section covers those, from the frame on the wire to the way a capture is read.
Why This Matters
OSI Attack Surface Map
Quick Legend
Attack Focus
🔴 Red ports = High-value targets
🟡 Yellow ports = Common services
🟢 Green ports = Encrypted/Secure
🟣 Purple ports = Auth-critical
View Exploitation Techniques →
The Two Models You Must Know
OSI Model (7 Layers)
The theoretical framework. Used for discussing attacks.
TCP/IP Model (4 Layers)
The practical implementation. What actually runs.
Mnemonic: "All Traffic Is Not Perfect" (Application, Transport, Internet, Network Access). ARP sits at Data Link in OSI and at the Internet layer here; both describe the same frame.
Attack Surface by Layer
Every layer presents unique attack opportunities. Knowing where an attack occurs helps you understand how to execute and defend against it.
| Layer | Attack Type | Example Techniques | MITRE ATT&CK |
|---|---|---|---|
| L7 - Application | Web/App Exploits | SQL Injection, XSS, API Abuse, RCE | T1190 | Exploit Public-Facing Application |
| L6 - Presentation | Encryption Attacks | SSL Stripping, Padding Oracle, Downgrade Attacks | T1557 | Adversary-in-the-Middle |
| L5 - Session | Session Hijacking | Cookie Theft, Session Fixation, Token Replay | T1539 | Steal Web Session Cookie |
| L4 - Transport | Connection Attacks | SYN Flood, Port Scanning, TCP Sequence Prediction | T1046 | Network Service Discovery |
| L3 - Network | Routing Attacks | IP Spoofing, ICMP Redirect, BGP Hijacking | T1599 | Network Boundary Bridging |
| L2 - Data Link | LAN Attacks | ARP Spoofing, MAC Flooding, VLAN Hopping | T1557.002 | ARP Cache Poisoning |
| L1 - Physical | Hardware Attacks | Cable Tapping, Rogue Devices, Jamming | T1200 | Hardware Additions |
Deep Dive Available
Quick Reference: Critical Ports
These are the ports most first-contact work runs into. The colour is a prompt: red is where to look first, yellow is cleartext, green is encrypted, blue is infrastructure.
The chips are a short list. Service names and risk notes for the wider set are in the Port Reference tool, and Protocols & Ports covers what actually answers on each one.
Learning Modules
Networking Basics
The foundation: OSI Model, IP Addressing, and MAC Addresses.
Protocols & Ports
Understanding TCP/UDP, the 3-Way Handshake, and common services.
Subnetting
Dividing an address space: CIDR notation, host counts and special-use ranges.
Firewalls & Defense
Understanding network defenses: firewalls, IDS/IPS, and segmentation.
Packet Analysis
Frame, IP and TCP header fields, read one packet at a time.
Network Traffic
Capturing, analyzing, and interpreting network communications.
Modern Protocols
QUIC, HTTP/3, gRPC, WebSockets, and encrypted DNS (DoH/DoT).
Essential Recon Commands
Scanning a network you neither own nor hold written permission to test is unlawful in most jurisdictions, and a ping sweep or port scan is enough to qualify in several of them. The examples below assume a lab or a signed engagement scope.
Discover Live Hosts (Ping Sweep)
nmap -sn 192.168.1.0/24Quick Port Scan (Top 1000)
nmap -sT -T4 <target_ip>View Your Network Interfaces
ip addr show # Linux
ipconfig /all # Windows
ifconfig # macOSCheck ARP Table (Local Neighbors)
arp -a # Windows and macOS
ip neigh show # LinuxTrace the Route to a Target
traceroute <target> # Linux/macOS
tracert <target> # WindowsFull Service Scan with Scripts (all ports)
nmap -sC -sV -p- <target_ip> # unprivileged; -p- is all 65,535 ports
sudo nmap -sC -sV -O -p- <target_ip> # adds OS detection, which needs rootRelated Tools
Subnet Calculator
Calculate network ranges, broadcast addresses, and host counts.
Port Reference
Comprehensive list of common and uncommon service ports.
Nmap Command Builder
Interactively build Nmap commands for your scans.
Wireshark Cheatsheet
Filter expressions and analysis tips for packet capture.
Related Topics
Internal Network Pentest
Apply networking knowledge to real assessments.
API Pentesting
Testing REST, GraphQL, gRPC and WebSocket APIs.
DFIR
Digital forensics and incident response.
Cheatsheets
Quick reference for scanning and enumeration tools.
Wireless Security
WiFi protocols and wireless network attacks.
Lab Setup
Build practice networks for safe learning.