Network Security and Defense Questions
Securing networks at the infrastructure layer. Covers firewalls, ACLs and rule design, network device hardening and secure configuration, intrusion detection and prevention systems, VPN and remote-access encryption, network protocols and their security properties, and packet-level traffic analysis. The hands-on network-defense layer, distinct from zero-trust architecture strategy.
Describe the TCP three-way handshake in detail (SYN, SYN-ACK, ACK). Include which TCP flags and sequence/acknowledgement behaviors are used. As an analyst, how does understanding the handshake help you detect a SYN flood or suspicious connection patterns? Describe one mitigation and how it defends against the attack.
Sample Answer
The three-way handshake is how TCP establishes a connection before any data flows. The client sends a SYN (synchronize) segment proposing an initial sequence number, the server replies with a SYN-ACK (synchronize-acknowledge) segment proposing its own sequence number while acknowledging the client's, and the client finishes with an ACK (acknowledge) segment. Only after all three steps is the connection considered established.
The three steps
- Client to server: SYN flag set, sequence number
x(a locally chosen initial value). - Server to client: SYN and ACK flags both set, sequence number
y(the server's own initial value), acknowledgment numberx+1(confirming the client's SYN). - Client to server: ACK flag set, sequence number
x+1, acknowledgment numbery+1(confirming the server's SYN-ACK). The connection is now established.
The server allocates a small amount of state, a "half-open" entry in its connection backlog, the moment it sends the SYN-ACK in step 2, before it has any proof the client is real. That allocation is exactly what a SYN flood targets.
How this helps detect a SYN flood
Normal traffic shows roughly matched counts of SYNs and completed connections. A flood shows a large, sustained excess of SYNs with few or no matching final ACKs, meaning many connections stuck half-open, which shows up as backlog growth and an elevated SYN-to-established ratio in connection-tracking telemetry. Attackers also commonly spoof the source address of flood SYNs so the traffic cannot easily be traced or blocked, which means the real attacker never receives the SYN-ACK and so never legitimately completes step 3.
Mitigation: SYN cookies
Instead of storing state after step 2, the server encodes the connection details, a cryptographic function of the source and destination address and port plus a timestamp, directly into the sequence number it sends in the SYN-ACK, allocating no memory yet. Only when the final ACK returns with the corresponding acknowledgment number does the server reconstruct and verify the connection was legitimate before allocating real state. This defends against a flood because spoofed or abandoned half-open connections cost the server nothing, so no volume of unanswered SYNs can exhaust the connection table.
Worked example
A normal handshake trace: client sends sequence 1000 (SYN); server replies sequence 5000, acknowledgment 1001 (SYN-ACK); client replies sequence 1001, acknowledgment 5001 (ACK), connection established. During a flood, connection-tracking telemetry might show 50,000 SYNs per second arriving with a source-address pattern that looks spoofed (many one-off addresses never seen again), against fewer than 50 completed handshakes per second, a SYN-to-established ratio around 1000 to 1. A healthy baseline ratio sits close to 1 to 1, and that ratio, not raw SYN volume alone, is the real tell, since a genuine flash crowd also raises SYN volume but keeps the ratio near 1 to 1 because real clients complete the handshake.
Trade-offs and pitfalls
SYN cookies stop backend connection-table exhaustion, but they do not stop the SYN packets themselves from consuming link bandwidth or router CPU, so a large enough flood still needs upstream volumetric mitigation as well. A few legacy TCP options can be dropped when cookies engage, which is mostly a non-issue on modern implementations but worth knowing it is not perfectly transparent.
Explain NAT traversal problems for peer-to-peer applications (VoIP, WebRTC) and describe how STUN, TURN, and ICE work together to establish connectivity. Include an explanation of the security considerations for running a TURN server and how you would authenticate and limit abuse.
Sample Answer
Devices behind Network Address Translation (NAT) don't have a stable, publicly reachable address, which breaks peer-to-peer (P2P) protocols like Voice over IP (VoIP) and Web Real-Time Communication (WebRTC) that need two endpoints to connect to each other directly. Session Traversal Utilities for NAT (STUN), Traversal Using Relays around NAT (TURN), and Interactive Connectivity Establishment (ICE) work together to solve this.
How they work together
- STUN lets a client ask a public server "what address and port does the outside world see when I send from here," discovering its own NAT-mapped public address so it can share it with the other peer.
- TURN provides a fallback relay: when direct connectivity genuinely isn't possible, both peers send their traffic through a TURN server, which forwards it between them. This costs bandwidth and adds latency but always works.
- ICE is the framework that ties both together: each peer gathers every candidate address it has (its local address, its STUN-discovered public address, and a TURN-relayed address), exchanges the full candidate list with the other peer, and tries them in priority order (direct paths first, relay last) until one actually connects.
Worked example
Peer A and peer B both sit behind "symmetric" NATs, each of which assigns a different external IP and port mapping for every distinct destination. Peer A discovers a public mapping by talking to the STUN server, but that mapping was created for the STUN server's address specifically; when A later tries to reach B, A's NAT allocates a fresh, different mapping, so the address A advertised from STUN is not one B's packets are allowed to use. The same is true in reverse for B. Because neither side can predict the per-destination port the other's NAT will assign, every server-reflexive (STUN) candidate pair fails its connectivity check in both directions. ICE exhausts the direct candidates and falls back to the TURN-relayed candidate, so media between A and B flows through the TURN server, which has a stable public address both peers can always reach. A full-cone NAT would not force this: a full-cone mapping accepts inbound packets from any source once it has been opened by any outbound packet, so even a symmetric peer could initiate directly to a full-cone peer's STUN-discovered address, and the full-cone side would simply reply to the per-destination mapping the symmetric side just created. That is why the case that genuinely requires a relay is symmetric-to-symmetric, not full-cone-to-symmetric.
TURN server security
Because a TURN server relays arbitrary traffic on behalf of clients, it can be abused as an open relay/proxy if left unauthenticated, similar in spirit to an open mail relay. Authenticate with short-lived, time-limited credentials rather than a static shared password: a common approach (used by the long-term-credential mechanism in the TURN specification) derives a username/password pair from a server-side secret and a timestamp, so credentials expire automatically and a leaked credential has a short useful window. Limit abuse further by capping per-user bandwidth and concurrent relay allocations, restricting which destination ports/protocols the relay will forward, and rate-limiting new allocation requests per source IP, combined with monitoring for any single client sustaining unusually high relay volume.
List and explain at least five observable DNS query/response patterns in packet captures or DNS logs that should raise suspicion for data exfiltration or command-and-control activity. Include examples such as high-entropy labels, long or repetitive subdomains, many TXT queries, unusually frequent NXDOMAIN responses, and bursts of unique subdomains.
Sample Answer
Direct answer
DNS was designed to move small amounts of lookup traffic in predictable patterns, so most exfiltration and command-and-control (C2) techniques that abuse it as a covert channel leave statistical fingerprints that look different from normal, browsing-driven DNS traffic, even without inspecting the record content directly.
Observable patterns
- High-entropy labels: subdomains that look like random character strings, for example
x7q9zpq2vv8k.baddomain.com, rather than human-readable names, because data being exfiltrated or a command being encoded is typically encoded, often in base32 or base64, into the subdomain itself. - Long or repetitive subdomains: unusually long domain names, or the same base domain queried with a slowly changing prefix over and over, consistent with chunked data being smuggled out one query at a time.
- Many TXT queries: TXT record queries and responses are unusually well suited to carrying arbitrary text payloads compared to address records, so a spike in TXT query volume to one domain, especially from a host that does not normally do so, is a common signal.
- Unusually frequent NXDOMAIN responses: a non-existent-domain response is what you get if an encoding scheme or a command-and-control protocol generates a domain name for a command that has not yet been registered, or if a domain-generation algorithm is in use and most generated names are unregistered; a high NXDOMAIN rate from one host is a strong anomaly signal.
- Bursts of unique subdomains: a sudden spike in distinct subdomains under the same base domain from one host, again consistent with encoding many small chunks of data as separate lookups in a short window.
- Beaconing intervals: regular, fixed-interval DNS queries to the same domain, for example once every 60 seconds, consistent with a C2 client checking in on a schedule, a pattern legitimate applications rarely produce that precisely.
Trade-offs and pitfalls
None of these signals is individually conclusive; a content delivery network's legitimate subdomain rotation can also look high-entropy, and a misconfigured application can also generate NXDOMAIN bursts. These are best used together, since multiple correlated signals from the same host raise confidence, and as inputs to a deeper investigation procedure rather than as standalone alerts to act on immediately.
Compare IPv4 and IPv6 packet headers from the perspective of a network traffic analyst. Identify which fields differ and which fields provide equivalent investigative value (such as source/destination addresses). Describe operational challenges introduced by IPv6 (extension headers, fragmentation, neighbor discovery) and how they affect IDS/flow collection.
Sample Answer
From an investigative standpoint, most of IPv4's core value carries over directly to IPv6 (both give you source and destination addresses, a protocol/next-header field, a hop-count field, and size information), but IPv6 removes or restructures several fields analysts rely on, and adds a genuinely new mechanism, extension headers, that changes how you even find where the transport-layer header starts.
Field-by-field comparison
| Field or property | IPv4 | IPv6 | Investigative note |
|---|---|---|---|
| Header length | Variable, 20-60 bytes (options) | Fixed, 40 bytes always | IPv4's length must be computed before reading the transport header; IPv6's fixed base header is simpler, but you must then walk the Next Header chain |
| Addresses | 32-bit | 128-bit | Equivalent identity value, but IPv6 hosts can legitimately hold multiple simultaneous addresses (privacy extensions, addresses that rotate over time), complicating "one address equals one host" attribution |
| TTL / Hop Limit | Time To Live, decrements per hop | Hop Limit, decrements per hop | Functionally identical; both support traceroute-style path analysis and spotting anomalous, possibly spoofed, values |
| Fragmentation | Routers can fragment in-flight; fields live in the base header | Only the originating host fragments, via a separate Fragment extension header | An IPv6 fragment you observe means the source chose to fragment, a stronger and less ambiguous signal than IPv4's path-dependent fragmentation |
| Header checksum | Present, recalculated on any header rewrite (e.g., by NAT) | Removed entirely | IPv6 gives one less basic integrity signal at the IP layer itself, though TCP/UDP checksums still apply |
| Address resolution | Address Resolution Protocol (ARP) | Neighbor Discovery Protocol (NDP), running over Internet Control Message Protocol version 6 (ICMPv6) | NDP is the IPv6-native analogue of ARP, and abuse of it (spoofed neighbor or router advertisements) is the IPv6 equivalent of ARP spoofing |
Operational challenges for intrusion detection and flow collection
- Extension-header walking. An intrusion detection system or flow collector has to parse a variable-length chain of optional headers (Hop-by-Hop, Routing, Fragment, Destination Options) to reach the real transport header. A hostile actor can chain many small or unusual extension headers specifically to make that parsing expensive, or to push meaningful payload past what a lazy parser bothers to inspect, a known IPv6-specific evasion technique.
- Fragmentation handling differs structurally. Since fragmentation is end-host-only and carried in its own extension header, a flow collector reassembling IPv6 fragments works from that header's identification field rather than IPv4's simpler in-header fragment-offset scheme.
- Neighbor Discovery abuse has thinner rule coverage. Rogue router advertisements and neighbor spoofing are the IPv6-native analogue of ARP spoofing, but many detection rule sets tuned over years for ARP anomalies simply don't have equivalent NDP coverage unless it was explicitly added.
- Multiple simultaneous addresses per host break simple identity assumptions. Flow-based metrics like "unique host count" that assume IPv4's typical one-host-one-address norm need to be re-derived for IPv6 traffic, usually by correlating on something more stable than the address alone, such as the interface identifier when present, or account and lease-style bindings from Dynamic Host Configuration Protocol version 6 (DHCPv6).
Trade-offs and pitfalls
The single most common analyst mistake moving from IPv4 to IPv6 investigations is treating an IPv6 address the way an IPv4 address was always treated, as a stable proxy for "this one physical host." Privacy-extension addresses rotate by design, so identity attribution built on IPv4-era assumptions will systematically undercount how many connections actually came from the same device, unless the analysis is explicitly redesigned around a more stable identifier.
Your organization wants better IDS visibility into HTTPS traffic but must balance privacy and performance. Compare architectural approaches: (1) TLS termination/proxy with decryption, (2) passive metadata-based detection (JA3/JA3S, certificate analytics), (3) server-side instrumentation (application logs), and (4) endpoint telemetry. For a medium-sized enterprise recommend a phased approach and explain trade-offs for privacy, CPU cost, and detection value.
Sample Answer
Direct answer
Getting intrusion detection visibility into HTTPS, meaning HTTP carried over TLS (Transport Layer Security, the encryption layer that makes most modern web traffic opaque to a network sensor), means either decrypting the traffic somewhere you control, or using signals that survive encryption instead. There is no free option; each approach trades some combination of privacy, CPU cost, and detection depth.
Comparing the four approaches
- TLS termination or proxy with decryption: a forward or reverse proxy terminates the TLS session, inspects the plaintext, then re-encrypts to the destination. Highest detection value, full payload visibility, the same as unencrypted traffic. Highest privacy cost, the organization sees everything, including personal traffic like banking or health sites if outbound browsing is decrypted. Highest CPU and latency cost, since decrypting and re-encrypting happens on every connection, plus real operational complexity: a trusted root certificate has to be managed on every client, and sites using certificate pinning (where an app or site is hard-coded to trust only its own specific certificate, so the substitute certificate a decrypting proxy presents is rejected and the connection fails) will simply break.
- Passive metadata-based detection, JA3 and JA3S: these are fingerprinting techniques that hash properties of the TLS handshake itself, the cipher suites offered, extensions, and their order, to identify what client or server software is on each end, without decrypting anything. You can flag a fingerprint known to belong to a specific malware family's TLS library, or flag an anomalous or self-signed certificate. Low privacy cost, since the payload is untouched, and low CPU cost, but limited and evadable detection value: any tool can imitate a common browser's handshake to blend in, and this method only reveals what kind of client this looks like, not what the client actually sent.
- Server-side instrumentation, application logs: if you control the destination service, its application logs already show the plaintext request, response, and application-level outcome, at the cost of only covering traffic to services you own; it is useless against an attacker's outbound command-and-control traffic to an external server.
- Endpoint telemetry: a host-based agent sees the plaintext before it is encrypted, or after it is decrypted, on the endpoint itself. This closes the network-blindness gap without touching the wire, at the cost of needing an agent deployed everywhere and depending on that agent not being disabled.
Recommended phased approach
Start with passive metadata (JA3 and JA3S plus certificate analytics) and endpoint telemetry, since both are comparatively cheap to deploy and carry low privacy risk; use them to build a baseline and catch the more obvious signals, known-bad fingerprints and self-signed or newly issued certificates on outbound connections. Reserve full TLS termination and decryption for narrower, higher-risk traffic categories, for example outbound traffic from especially sensitive network segments, or categories the organization has a documented policy right to inspect, rather than blanket decryption of all user traffic. This keeps the privacy cost proportionate to the risk being addressed and pays the CPU and latency cost only where it is worth it.
Trade-offs and pitfalls
Decrypting everything as a first move without policy or legal review is a common mistake with real privacy exposure, and in some jurisdictions legal exposure, for example inspecting personal healthcare or banking sessions. JA3 alone is not sufficient for high-confidence blocking, since it fingerprints software behavior rather than proving intent, and a motivated attacker can trivially spoof a common browser's fingerprint.
Unlock Full Question Bank
Get access to all Network Security and Defense interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.