Network Security Measures
Open in the Padhaiko app3.1 Transport Layer Security (TLS/SSL)
Transport Layer Security (TLS)—the modern successor to Secure Sockets Layer (SSL)—provides end-to-end confidentiality, integrity, and endpoint authentication over TCP (e.g., HTTPS on port , SMTPS, IMAPS). All SSL versions (SSL 2.0/3.0) and early TLS (TLS 1.0/1.1) are deprecated due to attacks such as POODLE, BEAST, and weak ciphers; TLS 1.2 and TLS 1.3 (RFC 8446) are the current standards.
Architecture of TLS
- TLS Record Protocol: Fragments application data, applies AEAD (Authenticated Encryption with Associated Data, such as AES-GCM or ChaCha20-Poly1305) using the negotiated symmetric session keys, and prepends a TLS record header.
- TLS Handshake Protocol: Runs before encrypted application traffic to:
- Negotiate protocol version and cipher suite.
- Authenticate the server (and optionally the client in mTLS) via X.509 certificates.
- Establish shared session secrets using Ephemeral Diffie–Hellman (ECDHE) key exchange.
Key Improvements in TLS 1.3
- 1-RTT Handshake: The client sends its
ClientHelloalong with an initialkey_share(ECDHE public parameters) in the first flight; the server replies withServerHello, itskey_share, encryptedCertificate,CertificateVerify, andFinished, cutting latency in half compared to TLS 1.2's 2-RTT handshake. - Mandatory Forward Secrecy (PFS): Static RSA key transport is removed. Because every session generates fresh ephemeral ECDHE keys that are discarded afterward, compromising the server's long-term private key later cannot decrypt past recorded traffic.
- Lean Cipher Suites: Weak primitives (RC4, DES, 3DES, MD5, SHA-1, CBC-mode encryption, and static Diffie–Hellman) are completely removed.
3.2 Virtual Private Networks (VPNs)
A Virtual Private Network (VPN) creates an encrypted, authenticated tunnel across an untrusted public network (such as the Internet) so remote users or branch offices can communicate as if connected directly to a private LAN.
- Site-to-Site VPN: Connects two fixed networks (e.g., branch office router to headquarters gateway) transparently to end hosts.
- Remote-Access VPN: Connects an individual laptop or mobile device via a VPN client to a corporate VPN concentrator.
IPsec Architecture
IPsec operates at the Network Layer (Layer 3) to protect IP packets natively:
- Authentication Header (AH, IP protocol 51): Provides connectionless data integrity, data origin authentication, and anti-replay protection, without encryption (rarely used alone today).
- Encapsulating Security Payload (ESP, IP protocol 50): Provides confidentiality (encryption), data integrity, origin authentication, and anti-replay protection.
- IKEv2 (Internet Key Exchange): UDP-based protocol (ports ) that authenticates peers (via certificates or pre-shared keys) and establishes Security Associations (SAs) holding algorithms, SPIs, and session keys.
| Aspect | IPsec Transport Mode | IPsec Tunnel Mode |
|---|---|---|
| Header Encapsulation | Protects only the IP payload (TCP/UDP segment); keeps the original IP header | Encrypts and encapsulates the entire original IP packet inside a new outer IP header |
| Endpoint Type | End-to-end between two hosts (Host ↔ Host) | Gateway-to-gateway or remote client-to-gateway (Gateway ↔ Gateway / Host ↔ Gateway) |
| Address Hiding | Original source/destination IPs remain visible in transit | Private internal IPs are hidden behind public gateway IPs |
| Typical Use | Host-level encrypted traffic inside an already-routable network | Site-to-site and remote-access VPNs |
SSL/TLS VPNs and WireGuard
- SSL/TLS VPNs (e.g., OpenVPN, AnyConnect in TLS mode) encapsulate traffic over TCP/443 or UDP, easily traversing restrictive NATs and hotel/campus firewalls that block IPsec ESP/UDP 500.
- WireGuard is a lightweight modern Layer 3 VPN using fixed, audited cryptography (Curve25519, ChaCha20-Poly1305, BLAKE2s) with minimal code size and fast roaming.
3.3 Network Traffic Analysis, Packet Capture
Network Traffic Analysis (NTA) inspects captured packets and flow metadata to troubleshoot connectivity, baseline normal behavior, and detect intrusions or data exfiltration.
Packet Capture Mechanics
- Capture Tools:
tcpdump(CLI, lightweight, scriptable) and Wireshark /tshark(GUI/CLI deep protocol dissectors), built onlibpcap(Linux/macOS) orNpcap(Windows). - Access Points on Switched Networks: Ethernet switches forward unicast frames only to the target port. Analysts capture full traffic using a SPAN / Port Mirror (switch copies frames to a monitor port) or a passive hardware Network TAP, with the capture NIC placed in promiscuous mode (or monitor mode for Wi-Fi).
- Capture Filters (BPF) vs. Display Filters: Berkeley Packet Filters (
tcp port 443 and host 10.0.1.5) discard irrelevant packets at capture time to save RAM/disk; Wireshark display filters (http.request.method == "POST"ortcp.flags.syn == 1 && tcp.flags.ack == 0) narrow down captured traces interactively.
# Capture TCP SYN packets on interface eth0 to spot port scans
tcpdump -i eth0 -n 'tcp[tcpflags] & (tcp-syn) != 0 and tcp[tcpflags] & (tcp-ack) == 0'
# Save all DNS and HTTP traffic for host 192.168.10.25 to a pcap file
tcpdump -i eth0 -w incident.pcap 'host 192.168.10.25 and (port 53 or port 80)'Security Indicators in Traffic Analysis
Analysts inspect captures for cleartext credentials (Telnet, FTP, HTTP Basic Auth), half-open SYN flood storms, sequential port probes (RST replies), DNS tunneling (unusually long subdomains/TXT payloads), and periodic outbound C2 beaconing.
3.4 DNS Security
Standard DNS (port , mostly UDP) translates domain names into IP addresses without encryption or cryptographic authentication. This exposes users to:
- DNS Spoofing / Cache Poisoning: An attacker injects forged DNS responses (e.g., matching Transaction ID/source port in a Kaminsky-style race) into a recursive resolver's cache, redirecting all clients of that resolver to a malicious IP.
- Eavesdropping & Censorship: On-path observers (ISPs, public Wi-Fi operators) can log every domain a user visits.
- DNS Amplification DDoS: Attackers send small spoofed
ANYorDNSSECqueries with the victim's IP as source, reflecting much larger responses toward the victim.
Defensive Extensions
- DNSSEC (DNS Security Extensions): Authenticates DNS records using public-key digital signatures (
RRSIGsigns each RRset, verified by the zone'sDNSKEY, whose hash is vouched for by the parent zone'sDSrecord all the way up to the root.). Prevents cache poisoning and spoofing, but provides no privacy (queries remain plaintext). - DoT (DNS over TLS, TCP port ): Wraps stub-to-recursive DNS queries inside a dedicated TLS tunnel for confidentiality and server authentication.
- DoH (DNS over HTTPS, TCP port ): Sends DNS queries inside standard HTTPS requests, providing encryption while blending into normal web traffic.
| Standard | Primary Security Goal | Transport / Port | Protects Against |
|---|---|---|---|
| DNSSEC | Data integrity & origin authentication | UDP/TCP 53 | Cache poisoning, forged DNS records (no confidentiality) |
| DoT (DNS over TLS) | Confidentiality of DNS queries/responses | TLS over TCP 853 | Passive sniffing and on-path injection between stub and resolver |
| DoH (DNS over HTTPS) | Confidentiality + firewall traversal | HTTPS over TCP 443 | Sniffing, local manipulation; blends with HTTPS web traffic |
3.5 Network Access Control (NAC), Router Access Control List (ACLs)
1. Network Access Control (NAC)
NAC enforces security policy before or as a device joins a wired or wireless network:
- Authentication: Integrates with IEEE 802.1X and RADIUS to verify user/device identity.
- Posture Assessment: Inspects endpoint health (OS patch status, active antivirus/EDR, disk encryption, corporate certificate) via an agent or agentless scan.
- Enforcement: Healthy compliant devices receive their production VLAN; non-compliant or unknown devices are placed into a quarantine/remediation VLAN or blocked completely.
2. Router Access Control Lists (ACLs)
A Router ACL is an ordered list of permit and deny rules applied inbound or outbound on a router interface to filter packets at Layer 3/4.
- Processing Rules: Rules are evaluated sequentially from top to bottom. Execution stops on the first matching rule (first-match). Every ACL ends with an invisible implicit
deny anyrule (so an ACL with onlydenyrules drops all traffic unless followed by an explicitpermit). - Wildcard Masks: Unlike subnet masks (
1= network,0= host), a wildcard mask uses0for "bit must match exactly" and1for "don't care". For a mask , wildcard (per octet: ).
| Aspect | Standard ACL | Extended ACL |
|---|---|---|
| Filter Criteria | Source IP address only | Source IP, Destination IP, Protocol (tcp, udp, icmp, ip), and TCP/UDP port numbers |
| Granularity | Coarse (all-or-nothing per source host/subnet) | Fine-grained (e.g., allow HTTPS but block Telnet) |
| Best Placement | Close to the destination (to avoid blocking legitimate traffic to other subnets) | Close to the source (to drop unwanted traffic before it consumes backbone bandwidth) |
Designing an Extended Router ACL with Wildcard Masks
A campus engineering subnet 192.168.16.0/22 accesses a web server at 10.10.5.20. Write an Extended ACL (access-list 110) to:
- Deny Telnet (TCP port ) from any host in
192.168.16.0/22to10.10.5.20. - Permit HTTPS (TCP port ) from
192.168.16.0/22to10.10.5.20. - Deny all other IP traffic between that subnet and
10.10.5.20, while permitting other general traffic (permit ip any any).
Compute the wildcard mask for /22 and state where the ACL should be applied.
Convert the /22 prefix mask to a wildcard mask: A /22 subnet mask has leading 1 bits: 255.255.252.0. Subtract each octet from 255:
(This spans addresses: 192.168.16.0 through 192.168.19.255.) For a single host 10.10.5.20, use keyword host 10.10.5.20 (equivalent to wildcard 0.0.0.0).
Order the Extended ACL rules from most specific to most general:
access-list 110 deny tcp 192.168.16.0 0.0.3.255 host 10.10.5.20 eq 23
access-list 110 permit tcp 192.168.16.0 0.0.3.255 host 10.10.5.20 eq 443
access-list 110 deny ip 192.168.16.0 0.0.3.255 host 10.10.5.20
access-list 110 permit ip any anyPlacing deny tcp ... eq 23 before any broader permit ensures Telnet is blocked on first match, and permit ip any any prevents the implicit deny any from blocking unrelated campus traffic.
Determine optimal placement: Because this is an Extended ACL, place it inbound on the router interface closest to the source (192.168.16.0/22) so blocked Telnet and unauthorized packets are dropped immediately before crossing the core network.
Wildcard mask for /22: 0.0.3.255. Apply access-list 110 inbound on the interface closest to 192.168.16.0/22 with the explicit Telnet deny, HTTPS permit, server-specific deny, and permit ip any any.
3.6 Firewalls and Proxy Servers
1. Evolution of Firewalls
A firewall enforces an access-control boundary between trusted internal networks and untrusted external networks (or between segmented internal zones):
| Firewall Type | OSI Layer(s) | Mechanism | Strength / Limitation |
|---|---|---|---|
| Stateless Packet Filter | Network / Transport (L3–L4) | Evaluates each packet independently against static IP/port rules | Very fast; cannot track connection state or handle dynamic return ports safely |
| Stateful Inspection Firewall | Network / Transport (L3–L4 + state) | Maintains a state table of active TCP/UDP connections (SYN, ESTABLISHED) | Automatically permits valid return packets for outbound sessions; blocks unsolicited inbound traffic |
| Application-Layer (Proxy) Firewall | Application (L7) | Terminates client TCP session and opens a separate session to the server; inspects HTTP/SMTP/DNS payloads | Strong payload validation and IP hiding; higher latency and per-protocol complexity |
| Next-Generation Firewall (NGFW) | L3–L7 | Stateful firewall + Deep Packet Inspection (DPI), application identity, TLS inspection, and integrated IPS | Granular control (e.g., allow Slack chat but block file uploads); heavier CPU cost |
2. DMZ (Demilitarized Zone) Architecture
Publicly reachable services (web, mail, public DNS) should never reside on the internal corporate LAN. Instead, they sit in a DMZ (screened subnet) between an external perimeter firewall and an internal firewall:
- External Internet DMZ: restricted to specific service ports (e.g.,
443/tcp). - DMZ Internal LAN: strictly blocked (or restricted to narrow database queries initiated via an internal broker) so compromising a public web server does not grant direct access to internal workstations or HR databases.
3. Forward vs. Reverse Proxy Servers
- Forward Proxy: Sits on the client side, mediating outbound requests from internal users to the Internet. Provides URL filtering, malware scanning, content caching, and hides internal client IPs.
- Reverse Proxy: Sits in front of backend origin servers, receiving inbound Internet requests on their behalf. Provides TLS termination, load balancing, DDoS buffering, caching, and Web Application Firewall (WAF) inspection.
3.7 Intrusion Detection and Prevention Systems (IDS/IPS)
While firewalls enforce who may connect, an IDS/IPS inspects packet payloads and host activity to identify malicious behavior (exploits, malware callbacks, privilege escalation).
| Aspect | IDS (Intrusion Detection System) | IPS (Intrusion Prevention System) |
|---|---|---|
| Placement | Out-of-band (passive) via SPAN/TAP | Inline (active) directly in the traffic path |
| Action | Monitors, logs, and generates alerts | Actively drops/blocks malicious packets, resets TCP connections, or updates firewall rules |
| Failure Impact | If IDS crashes, network traffic continues uninterrupted | Misconfiguration or failure can drop legitimate traffic (requires fail-open/bypass design) |
Deployment & Detection Methods
- NIDS / NIPS (Network-based): Deployed at network chokepoints (e.g., Snort, Suricata) inspecting packet flows across many hosts; blind to encrypted payloads unless TLS inspection is enabled.
- HIDS / HIPS (Host-based): Installed as an endpoint agent (e.g., Wazuh, OSSEC) monitoring system logs, file integrity, process trees, and system calls—even seeing encrypted traffic after decryption on the host.
- Signature-Based Detection: Matches traffic against known attack byte sequences/IOCs. Very low false positives, fast, but cannot detect novel zero-day exploits or heavily obfuscated variants.
- Anomaly-Based Detection: Builds a statistical or behavioral baseline of normal traffic and flags deviations. Can detect new/zero-day attacks, but suffers from higher false positive rates when normal user behavior shifts.
Alert Metrics (Confusion Matrix)
In evaluating an IDS, events fall into four outcomes: True Positive () (attack alerted), False Positive () (benign flagged as attack), True Negative () (benign ignored), and False Negative () (missed attack):
Evaluating IDS Alert Accuracy, Precision, Recall, and FPR
During a -flow test, a NIDS raises alerts, of which correspond to real attacks () and are benign false alarms (). It misses real attacks () and correctly ignores benign flows (). Compute the Accuracy, Precision, Detection Rate (Recall), and False Positive Rate (FPR), and explain why accuracy alone can mislead a SOC analyst.
Compute Accuracy:
Compute Precision and Detection Rate (Recall):
Compute False Positive Rate (FPR) and interpret Accuracy:
Because benign flows vastly outnumber attacks ( vs. ), a trivial IDS that alerts on nothing would still score accuracy while missing of attacks. Therefore Precision, Recall, and FPR are far more informative than raw accuracy.
, , , . Class imbalance makes accuracy misleading compared to Precision/Recall/FPR.
3.8 System Protection (User Accounts, Access Permissions, Least Privilege, Multifactor Authentication, Secure Configuration and Patch Management)
Perimeter controls alone fail if internal hosts remain misconfigured or unpatched. System protection (host hardening) secures the operating system, identities, and software stack.
- User Accounts & Access Permissions:
- Remove or disable unused default/guest accounts, enforce unique individual accounts (never shared
root/adminlogins), and store password verifiers using salted adaptive hashes (Argon2id, bcrypt). - Enforce OS-level permissions using Discretionary Access Control (DAC) (e.g., POSIX
rwxbits for owner/group/other), Role-Based Access Control (RBAC), or Mandatory Access Control (MAC) (SELinux/AppArmor).
- Remove or disable unused default/guest accounts, enforce unique individual accounts (never shared
- Principle of Least Privilege (PoLP):
- Every user, service account, and process receives only the minimum privileges and access duration strictly required to perform its job. Running web daemons as an unprivileged service user rather than
rootlimits blast radius if the service is exploited.
- Every user, service account, and process receives only the minimum privileges and access duration strictly required to perform its job. Running web daemons as an unprivileged service user rather than
- Multifactor Authentication (MFA):
- Requires at least two independent authentication factors from different categories:
- Knowledge: Something you know (password, PIN).
- Possession: Something you have (FIDO2/WebAuthn hardware key, TOTP app, smartcard).
- Inherence: Something you are (fingerprint, facial geometry).
- Hardware-bound FIDO2/WebAuthn resists phishing, unlike SMS OTPs which are vulnerable to SIM swapping.
- Requires at least two independent authentication factors from different categories:
- Secure Configuration (Hardening):
- Apply vendor/CIS hardening baselines: disable unnecessary daemons and open ports, disable insecure legacy protocols (Telnet, SMBv1, SSH password auth where keys are required), enable host-based firewalls, and configure centralized audit logging.
- Patch Management:
- A structured lifecycle: Asset Inventory Vulnerability Monitoring Risk Prioritization (CVSS + exposure) Staging/Regression Testing Scheduled/Emergency Rollout Verification Scan. Timely patching closes known CVEs before automated exploit kits weaponize them.
Hardening a Public Web Application Infrastructure (Exam Model)
A startup hosts a customer web portal and an internal finance database on a cloud network. Explain how to layer DMZ segmentation, TLS 1.3, Least Privilege, MFA, and Patch Management to protect the system end-to-end.
Segment the network with a DMZ and Reverse Proxy: Place the public web server (behind a reverse proxy/WAF) inside a DMZ subnet. Configure the internal firewall so the DMZ can reach the finance database only on the specific database port from the app server's IP, denying direct Internet-to-database connections.
Secure data in transit and access paths: Enforce TLS 1.3 on the public reverse proxy for HTTPS confidentiality and forward secrecy, and require an IPsec/WireGuard VPN plus MFA (e.g., FIDO2 hardware key) for administrators connecting over SSH.
Harden hosts with Least Privilege and Patch Management: Run the web server under a non-privileged system account (www-data) with read-only permissions on static assets, restrict the database user to only the required SQL schema permissions (PoLP), disable unused OS ports, and run a weekly patch management cycle prioritizing critical remote-code-execution CVEs.
Layering DMZ isolation, TLS 1.3 encryption, VPN + MFA admin access, Least Privilege service/DB accounts, and prioritized patching prevents both external eavesdropping and lateral movement from a compromised web tier.
Exercises
Compute the wildcard mask for subnet 172.16.40.128/26 and write Extended ACL 120 rules to permit HTTP (port ) and HTTPS (port ) from that subnet to server 172.16.10.50, deny SSH (port ) from that subnet to 172.16.10.50, and allow all other IP traffic.
Compute the subnet mask and wildcard mask for /26: A /26 prefix has network bits: subnet mask 255.255.255.192 ( addresses per subnet: 172.16.40.128 to 172.16.40.191). Subtract from 255.255.255.255:
Write Extended ACL 120 in top-down evaluation order:
access-list 120 permit tcp 172.16.40.128 0.0.0.63 host 172.16.10.50 eq 80
access-list 120 permit tcp 172.16.40.128 0.0.0.63 host 172.16.10.50 eq 443
access-list 120 deny tcp 172.16.40.128 0.0.0.63 host 172.16.10.50 eq 22
access-list 120 permit ip any anyWildcard mask is 0.0.0.63; ACL 120 permits ports 80 and 443, denies port 22 to host 172.16.10.50, and ends with permit ip any any.
An inline IPS evaluates network connections and records , , , and . Calculate Precision, Detection Rate (Recall), and False Positive Rate.
Compute Precision and Detection Rate (Recall):
Compute False Positive Rate (FPR):
Precision , Detection Rate (Recall) , False Positive Rate .
Explain how TLS 1.3 improves both performance and security over TLS 1.2, and define Perfect Forward Secrecy (PFS).
Performance and security improvements in TLS 1.3:
- Faster Handshake (1-RTT): By bundling the client's ECDHE
key_sharedirectly inClientHello, TLS 1.3 completes key agreement and server authentication in one round trip instead of TLS 1.2's two round trips. - Hardened Cryptography: TLS 1.3 removes legacy weak ciphers (RC4, 3DES, SHA-1, CBC-mode encryption) and mandates modern AEAD cipher suites (AES-GCM, ChaCha20-Poly1305) while encrypting handshake certificates after
ServerHello.
Define Perfect Forward Secrecy (PFS): PFS guarantees that compromising a server's long-term private signing key cannot decrypt past recorded TLS sessions, because each session derives its symmetric encryption key from fresh, ephemeral Diffie–Hellman (ECDHE) parameters that are erased once the session ends.
TLS 1.3 reduces handshake latency to 1-RTT, eliminates legacy weak ciphers in favor of AEAD suites, and mandates ephemeral ECDHE for Perfect Forward Secrecy so past captured traffic remains safe even if the server's private key leaks later.
Compare IPsec AH vs. ESP, and explain the structural difference between IPsec Transport Mode and Tunnel Mode.
Compare AH and ESP:
- AH (Authentication Header): Authenticates and protects integrity of the IP payload and immutable IP header fields, but provides no confidentiality (encryption) and breaks across NAT because it signs outer IP addresses.
- ESP (Encapsulating Security Payload): Encrypts the payload (confidentiality) and provides integrity/authentication (excluding the outer IP header in tunnel mode), working cleanly with NAT-Traversal (UDP 4500).
Compare Transport vs. Tunnel Mode: In Transport Mode, only the upper-layer payload is protected and the original IP header remains intact (used host-to-host). In Tunnel Mode, the entire original IP packet (header + payload) is encrypted and encapsulated inside a brand-new outer IP header between VPN gateways, concealing internal private IP addresses.
AH authenticates without encryption; ESP provides both encryption and authentication. Transport mode protects only the IP payload between end hosts, while Tunnel mode encapsulates the entire original IP packet inside a new outer header for gateway-to-gateway VPNs.
Why does DNSSEC not replace DoT or DoH? Also explain how Least Privilege, Multifactor Authentication, and Patch Management work together in system protection.
Distinguish DNSSEC from DoT/DoH: DNSSEC cryptographically signs DNS records so resolvers can detect forged or poisoned responses (integrity and origin authentication), but queries and answers still travel in plaintext. DoT (TCP 853) and DoH (TCP 443) encrypt the transport channel between client and resolver to provide confidentiality against eavesdropping, without themselves validating zone-wide cryptographic chains unless the resolver performs DNSSEC. Together, they cover both authenticity and privacy.
Explain Least Privilege, MFA, and Patch Management:
- MFA blocks stolen-password logins by requiring an independent possession or biometric factor.
- Least Privilege ensures that even if a user account or daemon is compromised, it holds minimal permissions and cannot access administrative resources or unrelated files.
- Patch Management systematically discovers, prioritizes, tests, and applies vendor security updates to close software vulnerabilities before attackers exploit them.
DNSSEC authenticates DNS data (integrity) in plaintext, whereas DoT/DoH encrypt the transport channel (confidentiality). In system protection, MFA hardens authentication, Least Privilege limits blast radius after compromise, and Patch Management eliminates known exploitable flaws.