Network Security — segmentation, TLS, firewalls, DNS, VPNs, and the TCP/IP attack surface
Control who can reach what, encrypt what crosses the wire, and watch for abuse — the network is one layer of defense in depth, never the whole defense.
ON THIS PAGE
Why Defend at the Network Layer
Network security controls reachability, observes traffic, and protects data in transit — one layer of defense in depth, not a substitute for host, identity, or app security.
KEY POINTS
- Network security is about controlling who can reach what, observing traffic, and ensuring confidentiality/integrity of data in transit — it is one layer of defense in depth, not a replacement for host, identity, or application security.
- The network is where reconnaissance and lateral movement happen: attackers map services (ATT&CK T1046 Network Service Discovery, T1018 Remote System Discovery) and pivot between hosts after initial access.
- Core defensive levers covered in this lesson: segmentation, encrypted transport (TLS 1.3), perimeter and internal filtering (firewalls / NGFW / WAF), DNS hardening, encrypted tunnels (VPN), and detection of TCP/IP-layer abuse.
- Boundary protection is a formal control objective: NIST SP 800-53 Rev. 5 control SC-7 (Boundary Protection) and ISO/IEC 27001:2022 Annex A 8.20 (Network Security) / 8.22 (Segregation of Networks).
REFERENCES
MITRE ATT&CK
Standards & RFCs
Segmentation, VLANs, and Microsegmentation
Dividing the network into zones constrains lateral movement; VLANs give Layer-2 separation, and microsegmentation applies default-deny policy to east-west traffic under Zero Trust.
KEY POINTS
- Segmentation divides a network into zones so a compromise in one zone cannot freely reach others; it directly constrains lateral movement (ATT&CK tactic Lateral Movement, TA0008) and remote-service pivoting (T1021 Remote Services).
- VLANs (IEEE 802.1Q tagging) provide Layer-2 logical separation on shared switching hardware; segments are isolated unless a router or firewall bridges them.
- VLAN weaknesses: VLAN hopping via switch spoofing (abusing DTP auto-trunking) and double-tagging (nested 802.1Q tags escaping the native VLAN); mitigations are disabling DTP / auto-trunk, hardcoding access ports, and changing the native VLAN off VLAN 1.
- North-south traffic = flows crossing the perimeter (client to data center / internet); east-west traffic = lateral flows between internal workloads. Classic perimeter firewalls only see north-south, leaving east-west largely unfiltered.
- Microsegmentation applies fine-grained, identity/workload-aware policy to east-west traffic (default-deny per workload), aligning with Zero Trust Architecture (NIST SP 800-207) — never trust position on the network as authorization.
- Segmentation maps to ISO/IEC 27001:2022 Annex A 8.22 (Segregation of Networks) and NIST SP 800-53 SC-7 (Boundary Protection).
REFERENCES
MITRE ATT&CK
Standards & RFCs
TLS 1.3 Handshake Mechanics and What It Protects
TLS 1.3 mandates forward secrecy, encrypts the certificate, allows only AEAD suites, and removes whole vulnerability classes — but protects only data confidentiality/integrity and server identity, not metadata or endpoints.
KEY POINTS
- TLS 1.3 is specified in RFC 8446 (2018); TLS 1.2 is RFC 5246. TLS 1.3 reduces the full handshake from 2 round trips (TLS 1.2) to 1-RTT, with an optional 0-RTT resumption mode.
- Handshake flow: ClientHello carries supported_versions plus a key_share (ephemeral (EC)DHE public key) for the client’s guessed group; ServerHello returns the server’s key_share, after which both derive shared secrets and everything that follows is encrypted.
- TLS 1.3 mandates forward secrecy: static RSA key transport and static Diffie-Hellman are removed, so every session uses ephemeral (EC)DHE keys — capturing the server’s private key later does not decrypt past sessions.
- Server identity (and the Certificate, CertificateVerify, and Finished messages) is sent inside the encrypted handshake in TLS 1.3, whereas in TLS 1.2 the certificate is transmitted in cleartext.
- TLS 1.3 allows only 5 AEAD cipher suites (e.g., TLS_AES_128_GCM_SHA256, TLS_CHACHA20_POLY1305_SHA256) and removes CBC modes, RC4, SHA-1/MD5, export-grade and static-RSA suites, renegotiation, and TLS-level compression — eliminating whole vulnerability classes that hit TLS 1.2 (Logjam CVE-2015-4000 downgrade, FREAK CVE-2015-0204 export RSA, POODLE CVE-2014-3566 on SSL3/CBC, Sweet32 CVE-2016-2183 on 64-bit-block ciphers).
- TLS protects confidentiality + integrity of application data and authenticates the server (PKI); it does NOT hide traffic metadata (packet sizes, timing, destination IP), does NOT protect endpoints from compromise, and does NOT stop application-layer attacks. Memory-safety bugs in TLS stacks (Heartbleed CVE-2014-0160) bypass the protocol entirely.
- Configuration guidance: NIST SP 800-52 Rev. 2 (Guidelines for TLS Implementations). Cleartext fallback / weak crypto map to CWE-319 (Cleartext Transmission), CWE-326 (Inadequate Encryption Strength), CWE-327 (Risky Cryptographic Algorithm), and OWASP A02:2021 Cryptographic Failures.
REFERENCES
OWASP
CWE
CVE
Standards & RFCs
Firewalls: Stateful vs NGFW vs WAF — and What Each Does NOT Do
A stateful firewall controls reachability at L3/L4, an NGFW adds app/threat awareness on the wire, and a WAF defends specific web apps at L7 — complementary controls with different blind spots.
KEY POINTS
- Stateful firewall: tracks connection state in a TCP/IP state table and filters on Layer 3/4 attributes (source/dest IP, port, protocol, connection state). It does NOT inspect application content, so malware or attacks riding an allowed port (e.g., 443) pass through. Reference policy guidance: NIST SP 800-41 Rev. 1.
- Next-Generation Firewall (NGFW): adds application identification (App-ID), deep packet inspection, integrated IPS, user-identity awareness, and optional TLS interception. It does NOT understand web-application business logic and is blind to encrypted payloads unless it terminates/decrypts TLS (which adds risk and breaks pinning).
- Web Application Firewall (WAF): a Layer-7 HTTP/HTTPS-aware filter that detects/blocks web attacks such as injection and XSS (OWASP Top 10 A03:2021 Injection). It does NOT protect non-HTTP protocols, can be bypassed by encoding / parser differentials, and is not a substitute for secure code (CWE-693 Protection Mechanism Failure if relied upon alone).
- Key teaching point: these are complementary, not interchangeable. A stateful firewall controls reachability, an NGFW adds app/threat awareness on the wire, a WAF defends specific web apps — defense in depth uses all three with different blind spots.
- Firewall / boundary controls satisfy NIST SP 800-53 SC-7 and ISO/IEC 27001:2022 Annex A 8.20 (Network Security) / 8.21 (Security of Network Services).
REFERENCES
OWASP
CWE
Standards & RFCs
DNS Security: DNSSEC, DoH/DoT, and DNS Tunneling/Exfiltration
DNSSEC adds integrity/authentication (not confidentiality); DoH/DoT add confidentiality (not origin authentication); and rarely-blocked outbound DNS is heavily abused as a covert C2 and exfiltration channel.
KEY POINTS
- DNSSEC adds origin authentication and integrity to DNS answers via a chain of cryptographic signatures (DNSKEY, RRSIG, DS records, NSEC/NSEC3 for authenticated denial). Specified in RFC 4033, RFC 4034, RFC 4035; deployment guidance in NIST SP 800-81-2.
- DNSSEC defends against cache poisoning / answer forgery such as the Kaminsky attack (CVE-2008-1447) and off-path attacks like SAD DNS (CVE-2020-25705). Crucially, DNSSEC provides integrity/authentication only — it does NOT encrypt queries, so it gives no confidentiality.
- Confidentiality of DNS comes from encrypted transport: DNS over TLS (DoT, RFC 7858, TCP port 853) and DNS over HTTPS (DoH, RFC 8484, port 443). These hide query content from on-path observers but do NOT authenticate the record origin — DoH/DoT and DNSSEC are complementary, solving different problems.
- DNS is heavily abused as a covert channel because outbound DNS is rarely blocked: command-and-control over DNS (ATT&CK T1071.004 Application Layer Protocol: DNS), exfiltration encoding data into queries (T1048 Exfiltration Over Alternative Protocol), and generic protocol tunneling (T1572 Protocol Tunneling); tooling includes iodine and dnscat2.
- Related DNS abuse: Domain Generation Algorithms for resilient C2 rendezvous (ATT&CK T1568.002 Dynamic Resolution: Domain Generation Algorithms). Detection relies on monitoring query volume / entropy and unusually long or encoded labels.
- Cleartext, unvalidated DNS reliance maps to CWE-350 (Reliance on Reverse DNS Resolution of a Trusted Host) and the broader CWE-345 (Insufficient Verification of Data Authenticity).
REFERENCES
MITRE ATT&CK
CWE
CVE
Standards & RFCs
VPNs: IPsec vs WireGuard
IPsec is a crypto-agile suite (ESP/AH/IKEv2) flexible but with a larger attack surface; WireGuard is a minimal, fixed-crypto design — both replace exposed services with an authenticated encrypted tunnel.
KEY POINTS
- IPsec is a suite, not a single protocol: the architecture is RFC 4301; ESP (encryption + integrity) is RFC 4303, AH (integrity only) is RFC 4302, and key exchange uses IKEv2 (RFC 7296). Deployment guidance: NIST SP 800-77 Rev. 1.
- IPsec has two modes: transport mode (protects the payload between two hosts) and tunnel mode (encapsulates the whole IP packet, used for site-to-site and remote-access gateways). It is cryptographically agile — algorithms are negotiated — which is flexible but historically a downgrade/misconfiguration surface.
- WireGuard is a modern, minimal VPN (~4,000 lines of code) using a fixed, opinionated crypto set: Curve25519/X25519 key agreement (RFC 7748), ChaCha20-Poly1305 AEAD (RFC 8439), BLAKE2s hashing, and the Noise protocol framework. It merged into the Linux kernel in version 5.6 (2020).
- Crypto-agility tradeoff to teach: WireGuard’s lack of negotiation removes whole downgrade-attack and misconfiguration classes, but rotating a broken algorithm requires a new protocol version rather than a config change. IPsec’s negotiation is more flexible but a larger attack surface.
- WireGuard is NOT defined by an IETF RFC — it is a published design / whitepaper that reuses RFC-standardized primitives. Note this so learners do not cite a nonexistent "WireGuard RFC".
- Both replace exposed services with an authenticated encrypted tunnel, reducing the External Remote Services attack surface (ATT&CK T1133); confidentiality failures of a VPN map to CWE-319 (Cleartext Transmission) and CWE-300 (Channel Accessible by Non-Endpoint).
REFERENCES
MITRE ATT&CK
CWE
Standards & RFCs
The TCP/IP Attack Surface: ARP Spoofing, Adversary-in-the-Middle, Tunneling
Unauthenticated protocols like ARP let an attacker position between parties (AiTM, T1557) to sniff, hijack, or downgrade traffic; tunneling and proxying hide malicious flows inside allowed channels, so filtering alone is insufficient.
KEY POINTS
- Adversary-in-the-Middle is the umbrella technique ATT&CK T1557: positioning between two parties to intercept, relay, or alter traffic; it enables credential capture, session hijacking, and downgrade attacks.
- ARP has no authentication (RFC 826), so an attacker can poison the ARP cache to redirect LAN traffic — ATT&CK T1557.002 ARP Cache Poisoning; the design weakness maps to CWE-940 (Improper Verification of Source of a Communication Channel). Mitigations: Dynamic ARP Inspection, DHCP snooping, and static ARP for critical hosts.
- Related on-LAN AiTM variants: LLMNR/NBT-NS poisoning and SMB relay (T1557.001, e.g., Responder), DHCP spoofing (T1557.003), and rogue / Evil-Twin wireless access points (T1557.004).
- Passive interception: Network Sniffing (ATT&CK T1040) captures cleartext credentials and tokens — the reason encryption everywhere matters; cleartext transport is CWE-319.
- TLS stripping (downgrading HTTPS to HTTP on the wire) is defeated by HTTP Strict Transport Security (HSTS, RFC 6797), which forces clients to use HTTPS.
- Evasion of network controls: Protocol Tunneling (T1572), Non-Application Layer Protocol C2 (T1095), Application Layer Protocol C2 over web (T1071.001), Proxy / Multi-hop Proxy (T1090, T1090.003), and Network Boundary Bridging (T1599) all hide malicious traffic inside or around allowed channels — which is why filtering alone is insufficient and egress monitoring is required.
- MITM design weakness maps to CWE-300 (Channel Accessible by Non-Endpoint) and CWE-290 (Authentication Bypass by Spoofing); failure to validate certificates (CWE-295) re-enables AiTM even when TLS is present.
REFERENCES
MITRE ATT&CK
CWE
Standards & RFCs
Defense in Depth at the Network Layer
No single control is sufficient: layer segmentation, encryption everywhere, multi-tier filtering, DNS hardening, and detection so a bypass of one layer is caught by another — formalized as Zero Trust.
KEY POINTS
- No single control is sufficient: layer segmentation (limit blast radius), encryption everywhere (TLS 1.3, VPN), filtering at multiple tiers (stateful + NGFW + WAF), DNS hardening (DNSSEC + encrypted transport), and detection (IDS / NetFlow / egress monitoring) so that a bypass of one layer is caught by another.
- Adopt default-deny and least-privilege reachability between zones, and assume-breach for east-west traffic — formalized as Zero Trust Architecture (NIST SP 800-207).
- Egress filtering and DNS / flow monitoring are critical because most modern C2 and exfiltration hides in allowed outbound channels (T1071 Application Layer Protocol, T1048 Exfiltration Over Alternative Protocol).
- Recon detection: alert on internal scanning behavior (ATT&CK T1046 Network Service Discovery, T1018 Remote System Discovery) which often precedes lateral movement.
- Map controls to standards for auditability: NIST SP 800-53 Rev. 5 SC-7 (Boundary Protection), ISO/IEC 27001:2022 Annex A 8.20–8.22, and Zero Trust under NIST SP 800-207 — giving learners a defensible, reference-backed network security posture.