← DevSecOps← DevSecOps
DevSecOpsDevSecOps19 Th7, 2026Jul 19, 202623 phút đọc18 min read

Nền tảng Networking cho Bảo mậtNetworking Fundamentals for Security

Thuộc bộ kiến thức DevSecOps Roadmap.

Tổng quan

Mọi biện pháp bảo mật cuối cùng đều nằm trên nền của network: một firewall rule, một TLS handshake, một ranh giới segmentation, một DNS query trả về IP của service của bạn hoặc IP của server kẻ tấn công. Nếu không hiểu packet thực sự di chuyển thế nào — flag SYN nghĩa là gì, tại sao TTL bằng 1 lại quan trọng, resolver làm gì khi không tìm thấy bản ghi trong cache — bạn sẽ không thể lý giải tại sao một cuộc tấn công thành công hay tại sao một biện pháp phòng thủ lại chặn được nó. Attack surface phần lớn chính là network surface: mỗi port mở, mỗi protocol bị lộ ra ngoài, mỗi mối quan hệ tin cậy (trust) giữa các network zone đều là một nơi có thể xảy ra sự cố.

Note này là một bản refresher theo góc nhìn bảo mật, không phải một khóa học networking đầy đủ. Nó giả định bạn đã biết OSI layer và IP addressing từ trước, và diễn giải lại chúng xoay quanh câu hỏi “cái này có thể bị tấn công ở đâu, và chúng ta phòng thủ như thế nào?” Để tìm hiểu sâu hơn về networking (routing protocol, switching, wireless, QoS, network automation, chứng chỉ), xem Network Engineer knowledge base. Về mật mã học đằng sau TLS, xem Nền tảng Mật mã học. Về cách thiết kế zone và Zero Trust architecture, xem Bảo mật mạng & Zero Trust. Về công cụ packet capture thực hành, xem Công cụ kiểm thử bảo mật.

Tại sao điều này quan trọng hàng ngày với một DevSecOps engineer:

Kiến thức nền tảng

OSI và TCP/IP model, nhìn tổng quan

OSI LayerTênTCP/IP LayerVí dụÝ nghĩa bảo mật
7ApplicationApplicationHTTP, DNS, SMTP, SSHNơi phần lớn tấn công hiện đại xảy ra (injection, bypass auth, malware C2)
6PresentationApplicationTLS/SSL, encodingEncryption/decryption, xác thực chứng chỉ
5SessionApplicationSession, TLS handshakeSession hijacking, đánh cắp token
4TransportTransportTCP, UDPPort scanning, SYN flood, giả mạo segment
3NetworkInternetIP, ICMP, routingIP spoofing, tấn công routing, subnetting/segmentation
2Data LinkNetwork AccessEthernet, VLAN, ARPARP spoofing, VLAN hopping, MAC flooding
1PhysicalNetwork AccessCáp, sóng radio, cáp quangĐấu nối trộm vật lý (physical tapping), wiretapping, jamming

Thói quen liên quan đến bảo mật: khi thấy một alert hay một rule, hãy lập tức hỏi “cái này ở layer nào?” Một WAF rule hoạt động ở layer 7. Một security group rule thường ở layer 3–4 (IP + port). Một lỗi cấu hình VLAN nằm ở layer 2. Biết được layer sẽ cho bạn biết công cụ và biện pháp khắc phục nào là phù hợp.

IP addressing và subnetting, tóm tắt

Note này cố tình dừng lại ở đây — toán học subnetting đầy đủ, VLSM, routing table, và switching được trình bày chi tiết trong Network Engineer — IP Addressing and SubnettingNetwork Engineer — Network Models and Layers.

TCP vs UDP — góc nhìn bảo mật nhanh

TCPUDP
Kết nốiHướng kết nối (3-way handshake: SYN, SYN-ACK, ACK)Không kết nối (connectionless)
Độ tin cậyĐảm bảo gửi đến, đúng thứ tựBest-effort, không đảm bảo
Ứng dụng phổ biếnHTTP/HTTPS, SSH, kết nối databaseDNS, VoIP, QUIC/HTTP3, streaming
Tấn công phổ biếnSYN flood, TCP hijacking, port scanningUDP flood, amplification attack (DNS/NTP/memcached)

Vì UDP không có handshake, kẻ tấn công có thể dễ dàng giả mạo source IP và dùng các request nhỏ để buộc server gửi response lớn đến nạn nhân — đây chính là cơ chế nền tảng của phần lớn tấn công DDoS amplification (DNS amplification, NTP amplification, memcached amplification).

Khái niệm chính

DNS qua góc nhìn bảo mật

DNS là cuốn danh bạ (phonebook) của internet — và danh bạ thì có thể bị can thiệp.

Cách hoạt động (đơn giản hóa quá trình resolution):

  1. Client hỏi một recursive resolver (ví dụ resolver của ISP, 8.8.8.8, hoặc resolver nội bộ của công ty) về app.example.com.
  2. Nếu chưa có trong cache, resolver hỏi một root server → được chuyển đến TLD server của .com → được chuyển đến authoritative name server của example.com.
  3. Authoritative server trả về IP (bản ghi A/AAAA, hoặc chuỗi CNAME cuối cùng dẫn tới một IP).
  4. Resolver cache lại câu trả lời trong khoảng TTL của bản ghi rồi trả về cho client.

Các kiểu tấn công dựa trên DNS phổ biến:

Tấn côngDiễn ra như thế nàoPhòng thủ
DNS spoofing / cache poisoningKẻ tấn công chèn response giả vào cache của resolver, chuyển hướng một domain đến IP do kẻ tấn công kiểm soátDNSSEC, ngẫu nhiên hóa query ID/source port, resolver có xác thực response
DNS tunneling (exfiltration/C2)Dữ liệu được mã hóa vào trong DNS query/response (ví dụ subdomain dạng <base64-chunk>.exfil.attacker.com) để vượt qua firewall vốn mặc định cho phép outbound DNSGiám sát khối lượng query cao bất thường, độ dài/entropy query bất thường, TLD hiếm gặp, đột biến NXDOMAIN; hạn chế host nào được phép resolve ra ngoài
Domain hijacking / chiếm quyền registrarKẻ tấn công chiếm quyền kiểm soát chính việc đăng ký domain và trỏ lại DNSRegistry lock, MFA cho tài khoản registrar, giám sát WHOIS/registration
Typosquatting / homoglyph domainDomain giả dạng gần giống dùng cho phishing hoặc phát tán malwareGiám sát thương hiệu, blocklist, DMARC/SPF/DKIM chống giả mạo mail
NXDOMAIN / DNS-based DDoSFlood resolver với query cho các domain không tồn tại để làm cạn kiệt cache/CPURate limiting, response rate limiting (RRL) trên authoritative server

DNSSEC thêm một chuỗi chữ ký mật mã (RRSIG, DNSKEY, DS record) từ root xuống đến authoritative zone để resolver có thể xác minh response không bị giả mạo trong quá trình truyền. Nó bảo vệ tính toàn vẹn (integrity) và tính xác thực (authenticity), không bảo vệ tính bảo mật (confidentiality) — DNS query vẫn hiển thị dưới dạng plaintext trừ khi kết hợp với DNS over HTTPS (DoH) hoặc DNS over TLS (DoT).

Giám sát DNS log để bảo mật là một trong những kỹ thuật phát hiện có giá trị cao và chi phí thấp nhất:

HTTP qua góc nhìn bảo mật

HTTP là protocol tầng application chuyên chở phần lớn traffic web, và phần lớn tấn công vào web app đều đi qua nó.

Các method và ý nghĩa bảo mật:

MethodMục đíchLưu ý bảo mật
GETLấy resourceNên là safe/idempotent; không bao giờ dùng để thay đổi state (tránh state-changing GET, vốn cho phép CSRF qua thẻ image/link)
POSTGửi dữ liệu / tạo resourceMục tiêu chính của CSRF; cần CSRF token hoặc cookie SameSite
PUT / DELETECập nhật / xóa resourceCần yêu cầu authorization đúng đắn; thường bị bỏ sót khi review access-control
OPTIONSKhám phá method được phép/CORS preflightCấu hình CORS sai ở đây có thể làm lộ quyền truy cập cross-origin
TRACEEcho lại requestTrước đây từng bị lợi dụng cho Cross-Site Tracing (XST) để đánh cắp cookie đánh dấu HttpOnly; nên disable trên server production
HEADGiống GET nhưng không có bodyHữu ích cho reconnaissance (kiểm tra resource có tồn tại mà không cần tải về)

Các header liên quan đến bảo mật:

HeaderMục đích
Strict-Transport-Security (HSTS)Buộc trình duyệt chỉ dùng HTTPS cho domain, ngăn chặn tấn công downgrade/sslstrip
Content-Security-Policy (CSP)Hạn chế script/style/origin nào được phép thực thi, giảm thiểu XSS
X-Content-Type-Options: nosniffNgăn MIME-sniffing có thể biến một file upload thành nội dung có thể thực thi
X-Frame-Options / frame-ancestors (CSP)Ngăn clickjacking qua nhúng iframe
Set-Cookie: ... Secure; HttpOnly; SameSite=StrictGiới hạn cookie chỉ truyền qua HTTPS, chặn JS truy cập, giới hạn gửi cross-site
Referrer-PolicyKiểm soát lượng thông tin URL bị lộ ra bên thứ ba khi điều hướng
Access-Control-Allow-Origin (CORS)Kiểm soát truy cập cross-origin; * kết hợp với credentials là lỗi cấu hình phổ biến

Tại sao HTTP plaintext là một rủi ro: không có TLS, mọi thứ — header, cookie, dữ liệu form, session token — đều truyền dưới dạng cleartext qua mọi chặng giữa client và server (access point Wi-Fi, ISP, transparent proxy, router độc hại). Điều này cho phép:

Đây là lý do “HTTPS everywhere” là một chuẩn cơ bản chứ không phải một tùy chọn, và tại sao HSTS preload list tồn tại để ngăn chặn ngay cả request plaintext đầu tiên.

TLS qua góc nhìn bảo mật

TLS (Transport Layer Security, kế thừa SSL) cung cấp tính bảo mật (confidentiality), tính toàn vẹn (integrity), và tính xác thực (authentication) cho dữ liệu khi truyền. Cơ chế mật mã học chi tiết (thuật toán symmetric/asymmetric, toán học key exchange, hashing) được trình bày trong Nền tảng Mật mã học; ở đây ta tập trung vào góc nhìn ở tầng network.

TLS thực sự bảo vệ điều gì:

TLS 1.3 handshake đơn giản hóa:

  1. ClientHello — client gửi các phiên bản TLS hỗ trợ, cipher suite, và một key share.
  2. ServerHello — server chọn một cipher suite, gửi key share của mình, chứng chỉ, và một chữ ký chứng minh nó nắm giữ private key tương ứng với chứng chỉ đó.
  3. Cả hai bên tự tính ra một shared symmetric session key (qua Diffie-Hellman key exchange) mà không bao giờ truyền key đó qua mạng.
  4. Xác thực chứng chỉ (phía client): chứng chỉ có được ký bởi một CA đáng tin cậy không? Có nằm trong thời hạn hiệu lực không? Hostname có khớp với Subject Alternative Name (SAN) không? Đã bị thu hồi (revoke) chưa (kiểm tra qua CRL hoặc OCSP)?
  5. Sau khi xác thực xong, dữ liệu application được truyền dưới dạng mã hóa bằng session key đã tính ra (symmetric encryption, vì nhanh hơn nhiều so với asymmetric cho dữ liệu lớn).

TLS 1.3 (RFC 8446) đơn giản hóa so với TLS 1.2 — ít round trip hơn, loại bỏ hỗ trợ các cipher yếu đã lỗi thời, và bắt buộc forward secrecy (key của mỗi session không thể khôi phục được ngay cả khi private key dài hạn của server sau này bị lộ).

Các lỗi cấu hình TLS thường gặp cần phát hiện khi review:

Lỗi cấu hìnhRủi roCách khắc phục
Chứng chỉ hết hạn hoặc sắp hết hạnTrình duyệt/client từ chối kết nối; gây outageTự động hóa gia hạn (ví dụ ACME/Let’s Encrypt, cert-manager trong Kubernetes), giám sát ngày hết hạn với alert
Chứng chỉ self-signed trên productionKhông có chain tin cậy; tập cho người dùng/hệ thống thói quen bỏ qua cảnh báoDùng CA hợp lệ; CA nội bộ cho service chỉ dùng nội bộ với trust anchor được phân phối đúng cách
Bật các phiên bản protocol cũ/yếu (SSLv3, TLS 1.0/1.1)Dễ bị tấn công đã biết (POODLE, BEAST)Tắt mọi thứ dưới TLS 1.2, ưu tiên TLS 1.3
Cipher suite yếu (RC4, export cipher, NULL cipher)Mã hóa yếu hoặc không mã hóa dù đã dùng “HTTPS”Giới hạn ở các cipher suite AEAD hiện đại (AES-GCM, ChaCha20-Poly1305)
Thiếu certificate chain (không phục vụ intermediate cert)Một số client không xác thực được dù leaf cert hợp lệPhục vụ đầy đủ chain (leaf + intermediate)
Sai hostname / thiếu entry trong SANXác thực thất bại, hoặc tệ hơn, tắt xác thực để “sửa” lỗiĐảm bảo SAN bao phủ mọi hostname được phục vụ, kể cả wildcard nếu cần
Dùng sai certificate pinning / không pin khi cầnHoặc quá dễ vỡ (pin cert xoay vòng → app hỏng) hoặc mobile app dễ bị MITMDùng pinning cẩn trọng với backup pin, hoặc dựa vào CA trust + giám sát Certificate Transparency
Không kiểm tra revocation (hoặc OCSP soft-fail)Chứng chỉ đã bị compromise vẫn tiếp tục được tin tưởngDùng OCSP stapling, giám sát log Certificate Transparency

Traffic capture và analysis, nhìn tổng quan

Khả năng đọc traffic mạng là thiết yếu trong incident response, debug, và threat hunting:

Đây chỉ là điểm tham chiếu nhanh — cách sử dụng thực hành, cú pháp filter, và bài lab nằm trong Công cụ kiểm thử bảo mật.

VLAN và network segmentation

Tại sao segmentation quan trọng

Mạng phẳng (flat network) — nơi mọi host có thể tiếp cận mọi host khác — nghĩa là chỉ cần compromise bất kỳ một máy nào là kẻ tấn công có bàn đạp để tiếp cận mọi thứ. Segmentation giới hạn blast radius: nếu một workstation trong VLAN marketing bị compromise, nó không nên có đường đi trực tiếp đến VLAN database hay domain controller.

VLAN (Virtual LAN) cho phép một hạ tầng switch vật lý duy nhất được phân vùng logic thành nhiều broadcast domain. Traffic giữa các VLAN phải đi qua router hoặc switch Layer 3, và đó chính xác là nơi bạn có thể áp dụng ACL/firewall rule.

Cơ chế segmentationLayerTrường hợp sử dụng
VLAN2Tách biệt broadcast domain trong cùng một LAN vật lý (ví dụ corp / guest / IoT / server)
Subnet/CIDR block3Tách biệt dải IP theo môi trường hoặc tầng (ví dụ 10.0.1.0/24 cho web tier, 10.0.2.0/24 cho data tier)
Security group / firewall rule3–4Allow-list chi tiết giữa các subnet hoặc instance (segmentation kiểu cloud-native)
Network namespace / CNI policy3–4 (ảo hóa)Segmentation giữa các container/pod trong Kubernetes
Micro-segmentation / service mesh mTLS4–7Segmentation theo identity của từng workload, bất kể IP/subnet, nền tảng cốt lõi của Zero Trust

VLAN hopping — rủi ro, và cách phòng ngừa

VLAN hopping là một kiểu tấn công trong đó một host thuộc một VLAN chiếm được quyền truy cập trái phép vào traffic của một VLAN khác mà lẽ ra nó không thể tiếp cận. Nội dung này được mô tả thuần túy để phục vụ phòng thủ, không nhằm cung cấp playbook tấn công.

Hai cơ chế kinh điển:

  1. Switch spoofing: host của kẻ tấn công đàm phán một trunk link với switch bằng cách giả dạng một switch (lợi dụng các giao thức auto-trunking như Dynamic Trunking Protocol). Sau khi trở thành trunk, host của kẻ tấn công thấy được traffic đã tag của tất cả VLAN trên trunk đó.
  2. Double tagging: kẻ tấn công gắn thêm hai tag VLAN 802.1Q vào một frame. Switch đầu tiên bóc lớp tag ngoài (khớp với native VLAN) rồi forward frame, mà tag thứ hai của nó giờ đây định tuyến frame vào một VLAN khác với dự định ban đầu — cách này chỉ hoạt động khi port của kẻ tấn công chia sẻ chung native VLAN với trunk.

Biện pháp phòng thủ:

Network zone — góc nhìn liên quan đến bảo mật

ZoneMô tảNội dung điển hìnhMức độ tin cậy
PerimeterRanh giới giữa mạng của bạn và internetEdge router, firewall perimeter, DDoS scrubbingKhông tin cậy bên ngoài, kiểm soát bên trong
DMZ (Demilitarized Zone)Một segment đệm, lộ ra internet nhưng cách ly khỏi mạng nội bộWeb server public, reverse proxy, mail relay, VPN endpointBán tin cậy; giả định bị tấn công trực tiếp
Internal / trusted networkNơi các service nội bộ, workstation nhân viên, và hệ thống back-office hoạt độngApp server, internal API, endpoint doanh nghiệpTin cậy, nhưng không tin tuyệt đối (xem Zero Trust bên dưới)
Restricted / data tierSegment nhạy cảm cao nhấtDatabase, secrets store, HSM, domain controllerRất tin cậy, hạn chế truy cập trực tiếp, audit kỹ lưỡng

Kiến trúc kinh điển đặt các service hướng ra internet trong DMZ, với firewall giữa internet↔DMZ và DMZ↔internal, để một host DMZ bị compromise không thể trực tiếp tiếp cận mạng nội bộ hay data tier. Thực tiễn hiện đại ngày càng thay thế mô hình tin cậy dựa trên perimeter (“nếu bạn ở trong mạng, bạn được tin cậy”) bằng Zero Trust — xác minh mọi request bất kể vị trí mạng, dựa trên identity và tình trạng thiết bị (device posture) thay vì bạn đang ở subnet nào. Nội dung đầy đủ về thiết kế zone, micro-segmentation, và kiến trúc Zero Trust nằm trong Bảo mật mạng & Zero Trust.

Best Practices

Tài liệu tham khảo

Xem thêm: Network Engineer knowledge base · Nền tảng Mật mã học · Bảo mật mạng & Zero Trust · Công cụ kiểm thử bảo mật

Part of the DevSecOps Roadmap knowledge base.

Overview

Every security control eventually sits on top of a network: a firewall rule, a TLS handshake, a segmentation boundary, a DNS query that either resolves to your service or to an attacker’s server. If you don’t understand how packets actually move — what a SYN flag means, why a TTL of 1 matters, what a resolver does when it can’t find a cached record — you cannot reason about why an attack works or why a control stops it. Attack surface is, in large part, network surface: every open port, every exposed protocol, every trust relationship between network zones is a place where something can go wrong.

This note is a security-lens refresher, not a full networking course. It assumes you’ve seen OSI layers and IP addressing before and re-frames them around the question “where can this be attacked, and how do we defend it?” For networking depth (routing protocols, switching, wireless, QoS, network automation, certifications), see Network Engineer knowledge base. For the cryptography behind TLS, see Cryptography Fundamentals. For designing zones and Zero Trust architectures, see Network Security & Zero Trust. For hands-on packet capture tools, see Security Testing Tools.

Why this matters day-to-day for a DevSecOps engineer:

Fundamentals

OSI and TCP/IP models, at a glance

OSI LayerNameTCP/IP LayerExamplesSecurity relevance
7ApplicationApplicationHTTP, DNS, SMTP, SSHWhere most modern attacks live (injection, auth bypass, malware C2)
6PresentationApplicationTLS/SSL, encodingEncryption/decryption, certificate validation
5SessionApplicationSessions, TLS handshakeSession hijacking, token theft
4TransportTransportTCP, UDPPort scanning, SYN floods, segment spoofing
3NetworkInternetIP, ICMP, routingIP spoofing, routing attacks, subnetting/segmentation
2Data LinkNetwork AccessEthernet, VLAN, ARPARP spoofing, VLAN hopping, MAC flooding
1PhysicalNetwork AccessCables, radio, fiberPhysical tapping, wiretapping, jamming

Security-relevant habit: when you see an alert or a rule, immediately ask “which layer is this?” A WAF rule operates at layer 7. A security group rule is usually layers 3–4 (IP + port). A VLAN misconfiguration is layer 2. Knowing the layer tells you which tool and which mitigation is relevant.

IP addressing and subnetting, in brief

This note deliberately stops here — full subnetting math, VLSM, routing tables, and switching are covered in depth in Network Engineer — IP Addressing and Subnetting and Network Engineer — Network Models and Layers.

TCP vs UDP — quick security framing

TCPUDP
ConnectionConnection-oriented (3-way handshake: SYN, SYN-ACK, ACK)Connectionless
ReliabilityGuaranteed delivery, orderingBest-effort, no guarantees
Common usesHTTP/HTTPS, SSH, database connectionsDNS, VoIP, QUIC/HTTP3, streaming
Common attacksSYN flood, TCP hijacking, port scanningUDP flood, amplification attacks (DNS/NTP/memcached)

Because UDP has no handshake, an attacker can trivially spoof the source IP and use tiny requests to make a server send large responses to a victim — this is the basis of most DDoS amplification attacks (DNS amplification, NTP amplification, memcached amplification).

Key Concepts

DNS through a security lens

DNS is the phonebook of the internet — and phonebooks can be tampered with.

How it works (simplified resolution path):

  1. Client asks a recursive resolver (e.g., an ISP resolver, 8.8.8.8, or an internal corporate resolver) for app.example.com.
  2. If not cached, the resolver asks a root server → gets referred to the .com TLD server → gets referred to example.com’s authoritative name server.
  3. The authoritative server returns the IP (an A/AAAA record, or a CNAME chain that eventually resolves to one).
  4. The resolver caches the answer for the record’s TTL and returns it to the client.

Common DNS-based attacks:

AttackWhat happensDefense
DNS spoofing / cache poisoningAttacker injects a forged response into a resolver’s cache, redirecting a domain to an attacker-controlled IPDNSSEC, randomized query IDs/source ports, resolvers that validate responses
DNS tunneling (exfiltration/C2)Data is encoded into DNS queries/responses (e.g., subdomains like <base64-chunk>.exfil.attacker.com) to bypass firewalls that allow outbound DNS by defaultMonitor for high query volume, unusual query length/entropy, rare TLDs, NXDOMAIN spikes; restrict which hosts may resolve externally
Domain hijacking / registrar takeoverAttacker gains control of the domain registration itself and repoints DNSRegistry lock, MFA on registrar accounts, WHOIS/registration monitoring
Typosquatting / homoglyph domainsLook-alike domains used for phishing or malware distributionBrand monitoring, blocklists, DMARC/SPF/DKIM for mail spoofing
NXDOMAIN / DNS-based DDoSFlooding resolvers with queries for non-existent domains to exhaust cache/CPURate limiting, response rate limiting (RRL) on authoritative servers

DNSSEC adds a chain of cryptographic signatures (RRSIG, DNSKEY, DS records) from the root down to the authoritative zone so a resolver can verify a response wasn’t forged in transit. It protects integrity and authenticity, not confidentiality — DNS queries are still visible in plaintext unless combined with DNS over HTTPS (DoH) or DNS over TLS (DoT).

Monitoring DNS logs for security is one of the highest-value, lowest-cost detections available:

HTTP through a security lens

HTTP is the application-layer protocol carrying most web traffic, and most attacks against web apps ride on top of it.

Methods and their security implications:

MethodPurposeSecurity note
GETRetrieve a resourceShould be safe/idempotent; never used to mutate state (avoid state-changing GETs, which enable CSRF via image tags/links)
POSTSubmit data / create resourcePrimary CSRF target; needs CSRF tokens or SameSite cookies
PUT / DELETEUpdate / remove resourceShould require proper authorization; often forgotten in access-control reviews
OPTIONSDiscover allowed methods/CORS preflightMisconfigured CORS here can leak cross-origin access
TRACEEchoes the request backHistorically enabled Cross-Site Tracing (XST) to steal cookies marked HttpOnly; should be disabled on production servers
HEADLike GET, no bodyUseful for reconnaissance (checking resource existence without downloading it)

Security-relevant headers:

HeaderPurpose
Strict-Transport-Security (HSTS)Forces browsers to only use HTTPS for the domain, preventing downgrade/sslstrip attacks
Content-Security-Policy (CSP)Restricts which scripts/styles/origins can execute, mitigating XSS
X-Content-Type-Options: nosniffPrevents MIME-sniffing that can turn a data upload into executable content
X-Frame-Options / frame-ancestors (CSP)Prevents clickjacking via iframe embedding
Set-Cookie: ... Secure; HttpOnly; SameSite=StrictRestricts cookie transmission to HTTPS, blocks JS access, limits cross-site sending
Referrer-PolicyControls how much URL information leaks to third parties on navigation
Access-Control-Allow-Origin (CORS)Controls cross-origin access; * combined with credentials is a common misconfiguration

Why plaintext HTTP is a risk: without TLS, everything — headers, cookies, form data, session tokens — travels as cleartext over every hop between client and server (Wi-Fi access points, ISPs, transparent proxies, malicious routers). This enables:

This is why “HTTPS everywhere” is a baseline, not a nice-to-have, and why HSTS preload lists exist to prevent even the very first plaintext request.

TLS through a security lens

TLS (Transport Layer Security, successor to SSL) provides confidentiality, integrity, and authentication for data in transit. Deep cryptographic mechanics (symmetric/asymmetric algorithms, key exchange math, hashing) are covered in Cryptography Fundamentals; here we focus on the network-level view.

What TLS actually protects:

Simplified TLS 1.3 handshake:

  1. ClientHello — client sends supported TLS versions, cipher suites, and a key share.
  2. ServerHello — server picks a cipher suite, sends its key share, certificate, and a signature proving it holds the private key for that certificate.
  3. Both sides derive a shared symmetric session key (via Diffie-Hellman key exchange) without ever transmitting it.
  4. Certificate validation (client-side): is the cert signed by a trusted CA? Is it within its validity window? Does the hostname match the Subject Alternative Name (SAN)? Has it been revoked (checked via CRL or OCSP)?
  5. Once validated, application data flows encrypted using the derived session key (symmetric encryption, since it’s much faster than asymmetric for bulk data).

TLS 1.3 (RFC 8446) simplified this compared to TLS 1.2 — fewer round trips, removed support for legacy weak ciphers, and made forward secrecy mandatory (each session’s key can’t be recovered even if the server’s long-term private key is later compromised).

Common TLS misconfigurations to catch in review:

MisconfigurationRiskFix
Expired or soon-to-expire certificateBrowsers/clients reject connections; outagesAutomate renewal (e.g., ACME/Let’s Encrypt, cert-manager in Kubernetes), monitor expiry with alerts
Self-signed cert in productionNo trust chain; trains users/systems to ignore warningsUse a proper CA; internal CA for internal-only services with distributed trust anchors
Weak/legacy protocol versions enabled (SSLv3, TLS 1.0/1.1)Vulnerable to known attacks (POODLE, BEAST)Disable everything below TLS 1.2, prefer TLS 1.3
Weak cipher suites (RC4, export ciphers, NULL ciphers)Weak or no encryption despite “HTTPS”Restrict to modern AEAD cipher suites (AES-GCM, ChaCha20-Poly1305)
Missing certificate chain (intermediate cert not served)Some clients fail to validate even though the leaf cert is validServe the full chain (leaf + intermediates)
Hostname mismatch / missing SAN entriesValidation failures, or worse, disabled validation to “fix” itEnsure SAN covers all served hostnames, including wildcards where needed
Certificate pinning misuse / no pinning where neededEither overly brittle (pinned cert rotates → app breaks) or MITM-susceptible mobile appsUse pinning judiciously with backup pins, or rely on CA trust + CT monitoring
No revocation checking (or soft-fail OCSP)A compromised cert continues to be trustedUse OCSP stapling, monitor Certificate Transparency logs

Traffic capture and analysis, at a glance

Being able to read network traffic is essential during incident response, debugging, and threat hunting:

This is only an at-a-glance pointer — hands-on usage, filter syntax, and lab exercises live in Security Testing Tools.

VLANs and network segmentation

Why segmentation matters

Flat networks — where every host can reach every other host — mean that compromising any single machine gives an attacker a launching pad to reach everything. Segmentation limits blast radius: if a workstation in the marketing VLAN is compromised, it should not have a direct path to the database VLAN or the domain controller.

VLANs (Virtual LANs) let a single physical switch infrastructure be logically partitioned into multiple broadcast domains. Traffic between VLANs must pass through a router or Layer 3 switch, which is exactly where you can enforce ACLs/firewall rules.

Segmentation mechanismLayerUse case
VLAN2Separate broadcast domains within the same physical LAN (e.g., corp / guest / IoT / servers)
Subnet/CIDR block3Separate IP ranges per environment or tier (e.g., 10.0.1.0/24 for web tier, 10.0.2.0/24 for data tier)
Security group / firewall rule3–4Fine-grained allow-lists between subnets or instances (cloud-native segmentation)
Network namespace / CNI policy3–4 (virtualized)Segmentation between containers/pods in Kubernetes
Micro-segmentation / service mesh mTLS4–7Per-workload identity-based segmentation regardless of IP/subnet, core to Zero Trust

VLAN hopping — the risk, and how to prevent it

VLAN hopping is an attack where a host on one VLAN gains unauthorized access to traffic on another VLAN it should not be able to reach. It is described here purely to inform defense, not to provide an attack playbook.

The two classic mechanisms:

  1. Switch spoofing: an attacker’s host negotiates a trunk link with a switch by mimicking a switch (abusing auto-trunking protocols like Dynamic Trunking Protocol). Once trunked, the attacker’s host sees tagged traffic for all VLANs on that trunk.
  2. Double tagging: an attacker prepends two 802.1Q VLAN tags to a frame. The first switch strips the outer tag (matching the native VLAN) and forwards the frame, whose second tag now routes it into a different VLAN than intended — this only works when the attacker’s port shares a native VLAN with the trunk.

Defensive measures:

Network zones — a security-relevant view

ZoneDescriptionTypical contentsTrust level
PerimeterThe boundary between your network and the internetEdge routers, perimeter firewalls, DDoS scrubbingUntrusted outside, controlled inside
DMZ (Demilitarized Zone)A buffer segment exposed to the internet but isolated from the internal networkPublic-facing web servers, reverse proxies, mail relays, VPN endpointsSemi-trusted; assumed to be attacked directly
Internal / trusted networkWhere internal services, employee workstations, and back-office systems liveApp servers, internal APIs, corporate endpointsTrusted, but not blindly (see Zero Trust below)
Restricted / data tierHighest-sensitivity segmentDatabases, secrets stores, HSMs, domain controllersHighly trusted, minimal direct access, heavily audited

The classic architecture places internet-facing services in the DMZ, with firewalls between internet↔DMZ and DMZ↔internal, so that a compromised DMZ host cannot directly reach the internal network or data tier. Modern practice increasingly replaces perimeter-based trust (“if you’re inside the network, you’re trusted”) with Zero Trust — verify every request regardless of network location, based on identity and device posture rather than which subnet you’re sitting in. Full coverage of zone design, micro-segmentation, and Zero Trust architecture is in Network Security & Zero Trust.

Best Practices

References

See also: Network Engineer knowledge base · Cryptography Fundamentals · Network Security & Zero Trust · Security Testing Tools