Module 02 / 05
Networking and Ports for SOC Analysts
You do not need to be a network engineer to work in a SOC, but you do need to read a firewall log, a packet summary or a web server log and know what is normal. This module covers the networking questions that come up in almost every L1 interview, each tied to how it looks in real logs.
Topic 1
TCP Three-Way Handshake and SYN Scans
Concept
TCP sets up a connection with three packets: the client sends SYN, the server replies SYN-ACK if the port is open, and the client sends ACK. Only after that does data flow. If the port is closed the server answers with RST (reset). If a firewall silently drops the packet, the client gets nothing and times out.
A SYN scan (Nmap's default -sS when run with privileges) abuses this. The scanner sends SYN to many ports, notes which ones reply SYN-ACK, and then sends RST instead of completing the handshake. Because the connection never fully opens, older applications never log it, which is why it is called a half-open or stealth scan. Firewalls, IDS and NetFlow still see it.
In logs a scan looks like one source touching many destination ports (vertical scan) or the same port across many hosts (horizontal scan) in a short window, with lots of resets or drops and almost no data transferred. Connection teardown uses FIN/ACK; an abrupt RST mid-session is also worth noticing.
- Open port: SYN, SYN-ACK, ACK. Closed: SYN, RST-ACK. Filtered: SYN, no reply (or ICMP unreachable).
- SYN scan: SYN, SYN-ACK, then the scanner sends RST. Handshake never completes.
- Full connect scan (
-sT) completes the handshake, so the application may log it. - Vertical scan = one host, many ports. Horizontal scan = one port, many hosts (often worm or recon for a specific service).
- Scans from the internet are constant background noise; an internal host scanning the network is far more interesting.
Real log example
02:31:07.101 IP 203.0.113.77.51522 > 10.10.1.20.22: Flags [S], seq 1804289383, win 1024, length 0
02:31:07.101 IP 10.10.1.20.22 > 203.0.113.77.51522: Flags [S.], seq 846930886, ack 1804289384, win 64240, length 0
02:31:07.102 IP 203.0.113.77.51522 > 10.10.1.20.22: Flags [R], seq 1804289384, win 0, length 0
02:31:07.102 IP 203.0.113.77.51522 > 10.10.1.20.23: Flags [S], seq 1804289383, win 1024, length 0
02:31:07.102 IP 10.10.1.20.23 > 203.0.113.77.51522: Flags [R.], seq 0, ack 1804289384, win 0, length 0
02:31:07.103 IP 203.0.113.77.51522 > 10.10.1.20.443: Flags [S], seq 1804289383, win 1024, length 0
02:31:07.103 IP 10.10.1.20.443 > 203.0.113.77.51522: Flags [S.], seq 1681692777, ack 1804289384, win 64240, length 0
02:31:07.104 IP 203.0.113.77.51522 > 10.10.1.20.443: Flags [R], seq 1804289384, win 0, length 0
02:31:07.104 IP 203.0.113.77.51522 > 10.10.1.20.3389: Flags [S], seq 1804289383, win 1024, length 0Same source port, same sequence number, window 1024, many destination ports in milliseconds: classic Nmap SYN scan. Port 22 and 443 answer [S.] (open) and the scanner immediately sends [R]; port 23 answers [R.] (closed).
Interview question
“Explain the TCP three-way handshake. How would a SYN scan look in your logs?”
Weak answer
The client sends SYN, the server sends ACK and then the client sends SYN-ACK. A SYN scan is when someone scans with SYN packets.
Why it loses points: The order of flags is wrong and the scan explanation says nothing about what makes it distinctive in logs.
Strong answer sketch
The client sends SYN, the server answers SYN-ACK if the port is open or RST if it is closed, and the client completes with ACK. In a SYN scan the scanner sends SYN, and when it gets SYN-ACK it sends RST instead of ACK, so the session never fully opens. In logs I would see one source hitting many ports in seconds, lots of resets or firewall drops, and near-zero bytes per connection. Next I would check whether the source is external noise or an internal host, whether any of the open ports it found then received real traffic like login attempts, and whether the source is our own authorised scanner.
Common mistakes
- Getting the flag order wrong (SYN, SYN-ACK, ACK).
- Treating every internet scan as an incident; external scanning is constant.
- Ignoring an internal host that starts scanning, which often indicates a compromised machine.
Topic 2
TCP vs UDP
Concept
TCP is connection-oriented: it uses a handshake, sequence numbers, acknowledgements and retransmission, so data arrives complete and in order. It is used for HTTP/HTTPS, SSH, SMB, RDP, SMTP and most things where correctness matters. UDP is connectionless: it sends datagrams with no handshake and no delivery guarantee, which makes it faster and lighter. It is used for DNS queries, DHCP, NTP, SNMP, syslog (traditionally), VoIP and many streaming and gaming protocols. QUIC (HTTP/3) runs over UDP 443.
For a SOC this matters in three ways. Spoofing: UDP source IPs are easy to forge because no handshake confirms them, which is why UDP is used in reflection and amplification DDoS (DNS, NTP, memcached). Logging: a firewall 'allow' for UDP does not prove a conversation happened in the way a completed TCP session does. Scanning: UDP scans are slow and ambiguous, because silence can mean open or filtered.
- TCP: reliable, ordered, handshake, slower. HTTP(S), SSH, SMB, RDP, SMTP.
- UDP: no handshake, no guarantee, fast. DNS, DHCP (67/68), NTP (123), SNMP (161), syslog (514).
- DNS uses UDP 53 for most queries and TCP 53 for zone transfers and large responses.
- UDP source IPs are easily spoofed, enabling reflection/amplification DDoS.
- QUIC/HTTP3 uses UDP 443, so some web traffic will not appear as TCP 443.
Real log example
2026-11-18T03:02:11Z action=allow proto=UDP src=10.10.2.53 spt=53 dst=192.0.2.200 dpt=40211 bytes=3912 query=ANY northwind-logistics.com
2026-11-18T03:02:11Z action=allow proto=UDP src=10.10.2.53 spt=53 dst=192.0.2.200 dpt=51877 bytes=3912 query=ANY northwind-logistics.com
2026-11-18T03:02:11Z action=allow proto=UDP src=10.10.2.53 spt=53 dst=192.0.2.200 dpt=33102 bytes=3912 query=ANY northwind-logistics.com
2026-11-18T03:02:12Z action=allow proto=UDP src=10.10.2.53 spt=53 dst=192.0.2.200 dpt=60419 bytes=3912 query=ANY northwind-logistics.comLarge DNS ANY responses going to one external address that never really asked: the requests were spoofed with 192.0.2.200 as the source. Our DNS server is being used as an amplifier and should not answer open recursive or ANY queries from the internet.
Interview question
“What is the difference between TCP and UDP? Give examples of protocols that use each.”
Weak answer
TCP is reliable and UDP is unreliable. TCP is used for websites and UDP for videos.
Why it loses points: Too shallow: no mention of handshake, no SOC-relevant protocols and no security implication.
Strong answer sketch
TCP is connection-oriented: a three-way handshake, sequencing and retransmission, so it is used where data must arrive intact, like HTTPS, SSH, SMB and RDP. UDP has no handshake or delivery guarantee, which makes it lighter, so it is used for DNS queries, DHCP, NTP, SNMP and VoIP. From a security angle, UDP source addresses are easy to spoof, which is why DNS and NTP are abused for amplification DDoS. Also, DNS is mostly UDP 53 but uses TCP 53 for zone transfers, so an unexpected TCP 53 connection to an internal DNS server from a workstation is worth a look.
Common mistakes
- Saying DNS only uses UDP.
- Calling UDP "insecure" rather than explaining what it lacks (handshake, delivery guarantee).
- Not connecting UDP to spoofing and amplification attacks.
Topic 3
DNS and HTTP in Investigations
Concept
DNS maps names to addresses. Records you should know: A (IPv4), AAAA (IPv6), CNAME (alias), MX (mail server), TXT (free text, used by SPF/DKIM/DMARC), NS (name server), PTR (reverse lookup). Almost all malware needs DNS to find its C2, so DNS logs (resolver logs, Sysmon 22, Zeek dns.log) are one of the best places to hunt.
Two DNS patterns come up in interviews. Beaconing: a host contacting the same domain at regular intervals (for example every 60 seconds with small jitter) around the clock, often to a newly registered or low-reputation domain. DNS tunnelling: data encoded into query names, so you see very long, high-entropy subdomains, a large number of unique subdomains under one parent domain, and heavy use of TXT or NULL records.
HTTP methods: GET retrieves, POST submits data, PUT/DELETE modify resources, HEAD and OPTIONS are often seen in scanning. Status codes: 2xx success (200 OK), 3xx redirect (301, 302), 4xx client error (400 bad request, 401 unauthenticated, 403 forbidden, 404 not found, 429 too many requests), 5xx server error (500, 503). In web logs, a burst of 404s from one IP is usually directory brute-forcing, and a 500 after an odd parameter can mean an injection attempt broke a query.
The status code tells you how the server responded, not whether an attack succeeded. A SQL injection that returns 200 with a larger-than-normal response size is more worrying than one that returns 500.
- DNS records: A, AAAA, CNAME, MX, TXT, NS, PTR.
- Beaconing: regular intervals, small consistent sizes, 24x7, often a rare or young domain.
- DNS tunnelling: long random-looking subdomains, many unique names under one domain, TXT-heavy.
- HTTP codes: 200 OK, 301/302 redirect, 401 auth needed, 403 forbidden, 404 not found, 500 server error.
- In web logs, also check response size and user agent (e.g.
sqlmap,Nikto,python-requests).
Real log example
198.51.100.14 - - [18/Nov/2026:04:10:02 +0000] "GET /track.php?id=10045 HTTP/1.1" 200 2311 "-" "Mozilla/5.0"
198.51.100.14 - - [18/Nov/2026:04:10:09 +0000] "GET /track.php?id=10045%27 HTTP/1.1" 500 612 "-" "sqlmap/1.8.2#stable (https://sqlmap.org)"
198.51.100.14 - - [18/Nov/2026:04:10:10 +0000] "GET /track.php?id=10045%20AND%201%3D1 HTTP/1.1" 200 2311 "-" "sqlmap/1.8.2#stable (https://sqlmap.org)"
198.51.100.14 - - [18/Nov/2026:04:10:10 +0000] "GET /track.php?id=10045%20AND%201%3D2 HTTP/1.1" 200 388 "-" "sqlmap/1.8.2#stable (https://sqlmap.org)"
198.51.100.14 - - [18/Nov/2026:04:10:31 +0000] "GET /track.php?id=-1%20UNION%20SELECT%20username,password,3%20FROM%20users--%20- HTTP/1.1" 200 48211 "-" "sqlmap/1.8.2#stable (https://sqlmap.org)"The single quote (%27) causes a 500, then 1=1 vs 1=2 return different sizes (boolean-based SQLi confirmed), then a UNION SELECT returns 48 KB instead of 2 KB. Status 200 plus that size jump suggests data was actually returned.
Interview question
“How would you identify DNS tunnelling or C2 beaconing in logs?”
Weak answer
I would check the domain on VirusTotal and if it is malicious I would block it.
Why it loses points: New C2 and tunnelling domains often have no reputation yet, and the answer shows no understanding of the traffic patterns.
Strong answer sketch
For beaconing I look for one host querying or connecting to the same domain at a regular interval, say every 60 seconds with a little jitter, all day and night, with similar small payload sizes. For tunnelling I look at the query names themselves: very long, random-looking subdomains, a high count of unique subdomains under one parent domain, and a lot of TXT queries. In a SIEM I would group DNS logs by parent domain and count distinct subdomains and average query length per host. Then I check the domain's age and registrar, which process made the queries using Sysmon 22 or EDR, and whether other hosts talk to it, before escalating.
Common mistakes
- Assuming a 200 status code means the request was harmless, or a 404 means the attack failed everywhere.
- Relying only on reputation lookups for C2 detection.
- Forgetting that the user agent and response size are as useful as the status code.
Topic 4
Ports Every SOC Analyst Should Know
Concept
Interviewers ask about ports because firewall, IDS and NetFlow alerts are full of them, and knowing what a port normally carries tells you whether traffic is expected. The point is not to recite a list but to know which ports are high-risk when exposed to the internet and which internal connections suggest lateral movement.
Exposed management ports (22 SSH, 23 Telnet, 3389 RDP, 5985/5986 WinRM, 1433/3306 databases, 445 SMB) are top targets for brute force and exploitation. Internally, a workstation making SMB, RDP or WinRM connections to many other workstations is a lateral movement pattern, because users normally talk to servers, not to each other's PCs.
Remember that port numbers are conventions. Attackers run C2 over 443 to blend in, and anything can listen on any port, so confirm with the process (Sysmon 3, EDR network events) and the protocol where you can.
- 22 SSH / SFTP. 23 Telnet (cleartext, should not exist). 25 SMTP (mail relay; 587 submission, 465 SMTPS).
- 53 DNS. 80 HTTP. 443 HTTPS (and QUIC over UDP). 445 SMB (EternalBlue/WannaCry, lateral movement, file shares).
- 3389 RDP: brute force and ransomware entry point when internet-exposed.
- 1433 MS SQL, 3306 MySQL: should never be open to the internet.
- 5985/5986 WinRM HTTP/HTTPS: PowerShell remoting, a common lateral movement channel.
- 4444: Metasploit default listener; a connection to an external 4444 is a classic reverse-shell red flag.
Real log example
2026-11-18T05:00:12Z action=allow proto=TCP src=10.10.30.41 spt=49812 dst=198.51.100.66 dpt=4444 bytes_out=1204 bytes_in=88213
2026-11-18T05:03:40Z action=allow proto=TCP src=10.10.30.41 spt=49830 dst=10.10.30.12 dpt=445 bytes_out=5112 bytes_in=3001
2026-11-18T05:03:41Z action=allow proto=TCP src=10.10.30.41 spt=49831 dst=10.10.30.13 dpt=445 bytes_out=5108 bytes_in=2987
2026-11-18T05:03:41Z action=allow proto=TCP src=10.10.30.41 spt=49832 dst=10.10.30.14 dpt=5985 bytes_out=8820 bytes_in=4410
2026-11-18T05:10:02Z action=deny proto=TCP src=203.0.113.9 spt=40112 dst=10.10.1.25 dpt=3389 rule=block-inbound-rdpA workstation connects out to 4444 and receives 88 KB, then fans out over SMB and WinRM to peer workstations. That is a likely reverse shell followed by lateral movement. The blocked inbound RDP is internet noise by comparison.
Interview question
“Which ports would worry you most if you saw them open to the internet, and why?”
Weak answer
Port 80 and 443 because hackers can attack websites. Also 21 FTP.
Why it loses points: Web ports are usually intentionally exposed; the answer misses the management and database ports that drive real breaches.
Strong answer sketch
RDP on 3389 is top of my list because exposed RDP is a common ransomware entry point through brute force and credential stuffing. SMB on 445 should never face the internet; it was the WannaCry propagation vector. Databases like 1433 and 3306, WinRM on 5985/5986, and Telnet on 23 are all management or data services with no reason to be public. SSH on 22 is sometimes legitimately exposed but should use keys and be monitored for brute force. If I saw one of these in an alert I would check whether the exposure is new, look for authentication attempts against it, and check for any successful logon from external IPs.
Common mistakes
- Reciting port numbers without saying why they matter.
- Assuming traffic on 443 is safe because it is "HTTPS".
- Missing that workstation-to-workstation SMB/RDP/WinRM is a lateral movement signal.
Topic 5
IDS vs IPS vs WAF
Concept
An IDS (Intrusion Detection System) monitors traffic (usually a copy from a SPAN port or tap) and raises alerts. It is passive: it cannot stop the packet. An IPS (Intrusion Prevention System) sits inline, so it can drop or reset malicious traffic in real time. The trade-off is that a false positive on an IPS blocks legitimate business traffic, so new signatures are often run in alert-only mode first. Snort and Suricata can run in either mode.
A WAF (Web Application Firewall) is specialised for HTTP/HTTPS. It understands application-layer requests and blocks attacks like SQL injection, XSS and path traversal, usually in front of a web server or as a cloud service. A traditional network firewall filters on IP, port and protocol (and next-gen firewalls add application awareness), but it does not inspect a URL parameter for SQL syntax the way a WAF does.
Detection methods: signature-based matches known patterns (precise, misses new attacks), anomaly-based flags deviation from a baseline (catches novel activity, noisier). For an analyst the key question on any IDS/IPS/WAF alert is: was it blocked or only detected, and did the target actually respond?
- IDS: out-of-band, detect and alert only.
- IPS: inline, detect and block; false positives break things.
- WAF: layer 7, protects web apps from SQLi, XSS, LFI and similar.
- Signature-based vs anomaly-based detection.
- Always check the action field (alert vs drop/block) and whether the attack reached the server.
Real log example
11/18/2026-04:10:31.552 [**] [1:2006446:14] ET WEB_SERVER Possible SQL Injection Attempt UNION SELECT [**] [Classification: Web Application Attack] [Priority: 1] {TCP} 198.51.100.14:52110 -> 10.10.1.20:80
2026-11-18T04:12:05Z waf action=BLOCK rule=942100 msg="SQL Injection Attack Detected via libinjection" client=198.51.100.14 uri=/track.php?id=-1%20UNION%20SELECT... host=portal.northwind-logistics.comThe Suricata line only says an attack was seen; in IDS mode the packet still reached the server, so you must check the web logs for the response. The WAF line explicitly shows BLOCK, so that particular request never hit the app.
Interview question
“What is the difference between an IDS and an IPS? Where does a WAF fit in?”
Weak answer
IDS detects attacks and IPS prevents attacks. A WAF is a firewall for websites.
Why it loses points: Technically right but gives no deployment detail, no trade-offs and no impact on triage.
Strong answer sketch
An IDS gets a copy of traffic and only alerts, so when I see an IDS alert I have to assume the traffic reached the target and verify the outcome myself. An IPS sits inline and can drop the traffic, but a bad signature can block legitimate traffic, so teams usually test rules in detect mode first. A WAF is an application-layer control in front of web servers that understands HTTP and blocks things like SQL injection and XSS that a port-based firewall would let through. On any of these alerts I first check the action field, then the server-side logs, for example the Apache response code and size, to see whether the attack worked.
Common mistakes
- Assuming an IDS alert means the attack was stopped.
- Thinking a network firewall stops SQL injection on an allowed port 443.
- Forgetting the false-positive cost of inline blocking.
More interview questions on this topic
- Explain the TCP three-way handshake.L1
- What is the difference between TCP and UDP? Give examples of each.L1
- How does DNS work, and when does DNS use TCP port 53?L1
- Tell me the common ports you need to know as a SOC analyst.L1
- What is the difference between an IDS and an IPS?L1
- What is the difference between a network firewall and a WAF?L1
- What is a proxy, and how do proxy logs help a SOC?L1
- What is NAT, and why does it complicate investigations?L1
Knowledge check · Networking and Ports for SOC Analysts
0 / 5 answeredFinished this module?
Mark it complete to update your progress (saved in this browser only), then prove it in the simulator.
Frequently asked questions
What does a SYN scan look like in firewall logs?
One source IP sending connection attempts to many destination ports or hosts within seconds, with very few bytes per connection and many resets or drops. Open ports reply with SYN-ACK, after which the scanner sends RST instead of completing the handshake.
Which ports should a SOC analyst memorise for interviews?
At minimum 22 SSH, 23 Telnet, 25 SMTP, 53 DNS, 80 HTTP, 443 HTTPS, 445 SMB, 3389 RDP, 1433 MS SQL, 3306 MySQL, 5985/5986 WinRM, and 4444 as the Metasploit default listener. Know why each is risky, not just its number.
Does DNS use TCP or UDP?
Both. Standard queries use UDP 53. TCP 53 is used for zone transfers and for responses too large for UDP, and DNS over HTTPS uses TCP or QUIC on 443.
What is the difference between an IDS and an IPS?
An IDS monitors a copy of traffic and alerts without blocking. An IPS sits inline in the traffic path and can drop or reset malicious connections in real time, at the risk of blocking legitimate traffic on a false positive.
How can you detect DNS tunnelling?
Look for unusually long, high-entropy subdomains, a large number of unique subdomains under one parent domain from a single host, high query volume, and heavy TXT or NULL record usage. Then identify which process is generating the queries.