TCP/IP, DNS and HTTP for analysts
The protocol knowledge an analyst actually uses: the TCP handshake and what failed connections look like, ports and NAT, DNS queries and response codes as evidence, and HTTP methods, status codes and headers as they appear in proxy and firewall logs.
01The layers you will actually see
- Read a 5-tuple and the TCP flags in a firewall or flow record
- Tell a scan, a refused connection and a completed session apart
- Use DNS queries and response codes as evidence of what a host tried to reach
- Read HTTP methods, status codes and headers in proxy and web logs
Analysts rarely see raw packets. You see records about traffic: firewall allow and deny lines, NetFlow or Zeek connection summaries, DNS resolver logs, proxy logs. Each of those is a compression of the same few protocol facts, so knowing the protocols tells you what a record can and cannot prove.
| Layer | What it carries | Where you see it in a SOC |
|---|---|---|
| Network (IP) | Source and destination address, TTL, protocol number (6 TCP, 17 UDP, 1 ICMP) | Every firewall, flow and EDR network record |
| Transport (TCP/UDP) | Ports, TCP flags, sequence numbers, bytes | Firewall state, Zeek conn.log, NetFlow |
| Application (DNS, HTTP, TLS) | Names, URLs, methods, status codes, certificates, SNI | Resolver logs, proxy logs, web server logs, Zeek dns.log / http.log / ssl.log |
The unit of network evidence is the 5-tuple: source IP, source port, destination IP, destination port, protocol. Most correlation is joining two data sources on some part of it, and most mistakes come from forgetting that NAT rewrites it. Behind a NAT gateway, a firewall's outside log shows the gateway's public address, not the workstation; you need the NAT translation log (or the inside interface log) to get back to the host.
02TCP: handshakes, flags and failed connections
A TCP session opens with the three-way handshake: the client sends SYN, the server answers SYN-ACK, the client sends ACK. It closes with FIN from each side, or is torn down abruptly with RST. What happened to the handshake tells you most of what you need about a connection.
| What the sensor saw | Zeek conn_state | Meaning |
|---|---|---|
| SYN, no reply | S0 | Nothing answered: filtered port, dead host, or a firewall dropping silently. Many S0s to many ports is a scan |
| SYN, then RST from the server | REJ | Host is up, port is closed (or a firewall sent a reset) |
| Full handshake, normal FIN close | SF | A completed session; bytes in both directions are meaningful |
| Handshake, then RST from the client | RSTO | Client aborted; common for scanners that grab a banner and leave |
| Traffic seen mid-stream, no handshake | OTH | Sensor started late or saw only one direction (asymmetric routing) |
ts uid id.orig_h id.orig_p id.resp_h id.resp_p proto service duration orig_bytes resp_bytes conn_state
2026-11-14T02:11:04 CmX1a2 10.20.8.31 51544 10.20.1.10 445 tcp - 0.000 0 0 S0
2026-11-14T02:11:04 CmX1a3 10.20.8.31 51545 10.20.1.11 445 tcp - 0.000 0 0 S0
2026-11-14T02:11:04 CmX1a4 10.20.8.31 51546 10.20.1.12 445 tcp smb 0.412 1288 4412 SF
2026-11-14T02:11:05 CmX1a5 10.20.8.31 51547 10.20.1.13 445 tcp - 0.001 0 0 REJRead that as an analyst: a single workstation touched port 445 on consecutive addresses within a second. Most attempts failed (S0, REJ), one completed with a few kilobytes each way. A user does not browse file shares in address order. This is the shape of lateral movement discovery or a worm, and the one SF row is the host to look at next.
- Common ports to know cold: 22 SSH, 25 SMTP, 53 DNS, 80/443 HTTP/HTTPS, 88 Kerberos, 135 RPC, 139/445 SMB, 389/636 LDAP/LDAPS, 3389 RDP, 5985/5986 WinRM. A port is a convention, not proof: anything can listen on 443.
- Ephemeral ports: the client side of a connection uses a high, short-lived port (49152-65535 on modern Windows). The destination port tells you the service; the source port almost never matters except for matching NAT and sensor records.
- Bytes and direction: a large
orig_bytesfrom an internal host to an external one is upload, the direction exfiltration takes. Most normal browsing is small requests and large responses.
03DNS as evidence
Almost every connection starts with a name lookup, so DNS logs are the cheapest map of what a host tried to reach, even when the connection was later blocked. A query carries a name and a record type; the answer carries records and a response code (RCODE).
| Item | Values you will meet | Why an analyst cares |
|---|---|---|
| Record type | A (IPv4), AAAA (IPv6), CNAME (alias), MX (mail), TXT (free text), NS, PTR (reverse), SRV | Long or frequent TXT queries are a classic tunnelling and C2 channel |
| RCODE | NOERROR (0), SERVFAIL (2), NXDOMAIN (3), REFUSED (5) | Bursts of NXDOMAIN for random-looking names suggest a domain generation algorithm (DGA) |
| TTL | Seconds an answer may be cached | Very low TTLs with changing answers fit fast-flux infrastructure, or just a CDN |
| Transport | UDP/53 normally, TCP/53 for large answers and zone transfers, DoH on 443, DoT on 853 | DoH from a browser bypasses your resolver logs entirely |
14-Nov-2026 02:14:51.204 client @0x7f 10.20.8.31#53122 (q7x2kd9a1.example-cdn.net): query: q7x2kd9a1.example-cdn.net IN A + (10.20.0.53)
14-Nov-2026 02:14:51.311 client @0x7f 10.20.8.31#53123 (mf02lzpqv.example-cdn.net): query: mf02lzpqv.example-cdn.net IN A + (10.20.0.53)
14-Nov-2026 02:14:52.018 client @0x7f 10.20.8.31#53124 (aGVsbG8gd29ybGQ.t.badexample.org): query: aGVsbG8gd29ybGQ.t.badexample.org IN TXT + (10.20.0.53)// Sentinel / Defender: hosts generating many unique subdomains under one parent
DnsEvents
| where TimeGenerated > ago(1d)
| extend parent = strcat_array(array_slice(split(Name, "."), -2, -1), ".")
| summarize uniq = dcount(Name), qtypes = make_set(QueryType, 5), sample = take_any(Name)
by ClientIP, parent
| where uniq > 200
| order by uniq descIf workstations query an internal resolver that forwards to the internet, perimeter logs show only the resolver as the source of every lookup. Log at the internal resolver (Windows DNS analytical logging, BIND query logs, or Sysmon event 22 on the endpoint), or you cannot say which host asked.
04HTTP in proxy and web logs
HTTP is a request and a response. The request has a method, a path with optional query string, and headers such as Host, User-Agent, Referer and Cookie. The response has a status code and its own headers. With TLS, a proxy that does not decrypt sees only the destination name (from SNI) and byte counts; one that does sees all of it.
| Status | Meaning | Analyst reading |
|---|---|---|
| 200 OK | Served | The request worked; for a web shell path, a 200 is bad news |
| 301 / 302 | Redirect | Phishing kits and malvertising chain several of these |
| 401 / 403 | Not authenticated / forbidden | Bursts against a login path are brute force or credential stuffing |
| 404 | Not found | Hundreds from one client across many paths is content discovery (a scanner) |
| 500 | Server error | Injection attempts often trip errors; a 500 after a payload deserves a look |
10.20.8.31 - - [14/Nov/2026:02:20:17 +0000] "GET http://updates.badexample.org/a/ps.txt HTTP/1.1" 200 4096 "-" "Mozilla/5.0 (Windows NT; Windows NT 10.0; en-GB) WindowsPowerShell/5.1.19041.4648"
10.20.8.31 - - [14/Nov/2026:02:20:19 +0000] "POST http://updates.badexample.org/a/r HTTP/1.1" 200 118 "-" "Mozilla/5.0 (Windows NT; Windows NT 10.0; en-GB) WindowsPowerShell/5.1.19041.4648"Two clues stand out. The user agent is PowerShell's default (WindowsPowerShell/5.1...), which normal browsing never sends. And the pattern is GET a small text file, then POST a short body back: a download cradle followed by a check-in. Either alone is a lead; together they justify isolating the host.
05Putting it together
Network records answer the questions endpoint logs cannot: did the payload actually call out, which other hosts talked to the same destination, and how much left the network. Combine them in a fixed order so nothing is skipped.
- Start from the alert's IP or name and pull DNS for it: which internal clients resolved it, and when first.
- Pull connections to the resolved addresses: completed or failed, bytes each way, interval between sessions.
- Pull proxy or HTTP records for the completed sessions: methods, paths, user agents, status codes.
- Map every internal source back to a host and user through DHCP, NAT and authentication logs.
- Widen: any other host that touched the same name, address or user agent in the last 30 days.
Zeek shows 2,000 connections from one internal host to 2,000 different internal addresses on port 3389, almost all with conn_state S0. What is the best reading?
"I read network records in the order DNS, connection, application. DNS tells me who tried to reach a name, connection state tells me whether it worked and how much moved, and proxy or HTTP fields tell me what was actually said. Then I map every source back to a host through NAT and DHCP before I name anyone."
Expect "walk me through the TCP handshake" and "what does an NXDOMAIN storm suggest?" in L1 interviews. Strong answers tie each protocol fact to a log you would check: S0 rows for scans, NXDOMAIN bursts for DGA, odd user agents in proxy logs for scripted downloads.
Q1Why might a firewall log show an allowed connection that never completed?+
Many firewalls log the allow decision on the first SYN. Whether the server answered is a separate fact; check session end logs, byte counts or a flow record.
Q2How do you detect beaconing?+
Group connections by source and destination, compute the interval between sessions, and look for low variance (a steady 60 seconds with small jitter) over hours. Rita and similar tools automate this over Zeek logs.
Q3What does SNI give you without decryption?+
The hostname the client asked for in the TLS ClientHello. It is visible to a passive sensor unless Encrypted Client Hello is in use, and it can differ from the HTTP Host header in domain fronting.