Security Engineering / Fundamentals / Networking
Fundamental 01

Networking Every security product you own is a machine that watches, blocks or rewrites traffic. If you can trace one HTTPS request from a laptop to a server and name every hop, header and handshake on the way, most of Netskope, most of a SIEM and half of email security stop being mysterious.

prerequisite for everything 5 tiers · 18 modules feeds → Netskope, SecOps, Email
Tier 0 · Groundno assumptions

What a network actually is

A network moves small labelled boxes of bytes between machines that have no idea about each other's business. Everything else — websites, email, SaaS, your VPN — is convention layered on top of that one primitive.

Module 0.1

Encapsulation: the envelope inside an envelope

Why one click produces five nested headers

Data is wrapped repeatedly on the way out and unwrapped on the way in. Posting a letter is the right mental image: your words go in a page, the page in an envelope with a street address, the envelope in a mail sack with a depot address, the sack on a lorry.

[ Ethernet header | IP header | TCP header | TLS record | HTTP request ] MAC addresses IP addresses ports+seq encryption GET /login who's next hop? who's the which app is it what am I endpoint? socket? readable? asking for?

Each layer only reads its own header. A switch reads Ethernet. A router reads IP. A firewall usually reads IP + TCP. A SWG like Netskope has to break TLS to read the HTTP layer at all — which is the entire reason TLS inspection exists as a product feature.

Why security people care

  • Your visibility is capped by the outermost layer you can decrypt. Everything below is just metadata.
  • An attacker hiding inside an allowed layer (DNS queries, HTTPS to a legitimate CDN) is invisible to controls that only inspect the layer above.
  • Log sources map to layers: firewall/flow logs = IP+TCP, proxy logs = HTTP, EDR = process that opened the socket. Correlating them is the job.
Module 0.2

OSI and TCP/IP models — and how people really use them

"It's a layer 7 problem" translated
LayerUnitExamplesWhat sees it
7 ApplicationDataHTTP, SMTP, DNS, TLS-wrapped APIsProxy, SWG, CASB, email gateway
6/5 Present/SessionDataTLS, cookies, sessionsTLS inspection, session hijack detection
4 TransportSegmentTCP, UDP, QUIC (on UDP)Firewall rules, flow logs, port scans
3 NetworkPacketIP, ICMP, routingRouters, VPC flow logs, geo-IP
2 Data linkFrameEthernet, ARP, Wi-Fi, VLANsSwitches, NAC, ARP spoof detection
1 PhysicalBitsCopper, fibre, radioNobody, until someone unplugs it

In conversation, "layer 3/4" means IP-and-port decisions (fast, blunt) and "layer 7" means content-aware decisions (slow, rich). "Layer 8" is a joke about the user.

Interview-grade nuance: the real stack is TCP/IP's four layers (Link, Internet, Transport, Application). OSI's seven are a teaching model that never matched implementations. Use OSI numbers as shared vocabulary, not as gospel.
Module 0.3

Addresses: MAC, IP, port, name

Four identifiers, four different lifetimes
  • MAC address — burned into the network card, e.g. a4:83:e7:1c:9d:02. Only meaningful on the local segment; rewritten at every router hop. Modern OSes randomise it on Wi-Fi for privacy, which quietly breaks MAC-based NAC.
  • IP address — the routable address, e.g. 10.4.2.17 or 2a00:1450::200e. Changes when you move networks.
  • Port — which program on that host, e.g. 443. Server ports are conventional (80, 443, 25, 53, 3389); client ports are ephemeral and random.
  • Domain name — human layer, resolved to IP by DNS. The only identifier an attacker can buy for £8.

A socket is the 5-tuple that uniquely identifies one conversation: protocol + src IP + src port + dst IP + dst port. Every firewall rule, flow log and connection table is built on this tuple — memorise it.

Private (RFC 1918) vs public

# private ranges — never routed on the internet
10.0.0.0/8          16.7M addresses — corporate/VPC default
172.16.0.0/12       1M — Docker likes 172.17.x
192.168.0.0/16      65k — home routers
169.254.0.0/16      link-local; 169.254.169.254 = cloud metadata!
127.0.0.0/8         loopback
Remember 169.254.169.254. That link-local address is the cloud instance metadata service on AWS/Azure/GCP. Server-side request forgery that reaches it can hand an attacker cloud credentials. It shows up again in the AWS path.
Tier 1 · Mechanicshow it works

One request, end to end

We now follow a single request — a laptop on the office Wi-Fi loading https://app.example.com/login — and stop at every mechanism it touches.

Module 1.1

Getting off the laptop: ARP, switching, VLANs

The local segment, and why it is trivially spoofable

The laptop knows the destination IP but must address the frame to a local MAC — the default gateway's. It shouts ARP: "who has 10.4.2.1?" Any machine on the segment can answer. There is no authentication in ARP at all.

1ARP request broadcast to ff:ff:ff:ff:ff:ff — who has the gateway IP?
2ARP reply from the router with its MAC. Cached for minutes.
3Frame sent to that MAC; the switch forwards it using its MAC address table.

VLANs slice one physical switch into isolated broadcast domains — the classic segmentation tool (guest Wi-Fi, card-data VLAN for PCI scope reduction, OT networks). Traffic between VLANs must cross a router or firewall, which is where you get to inspect and log it.

ARP spoofing: an attacker on the same segment answers ARP faster and becomes the gateway, seeing all traffic. Defences: dynamic ARP inspection on switches, 802.1X port authentication, and — critically — TLS everywhere so that intercepted traffic is still ciphertext. This is one reason "the office network is trusted" is a dead idea.
Module 1.2

Subnetting, CIDR and routing

Reading /24, /16, /32 fluently

CIDR notation splits an IP into network and host parts. The number after the slash is how many leading bits are fixed.

CIDRAddressesTypical use
/321A single host — allow-list entries, route targets
/298Tiny point-to-point / appliance block
/24256One office subnet or VPC subnet
/1665,536A whole VPC or site
/0everythingDefault route, and the scariest firewall rule you can write

Routing is a lookup: for each packet the host or router picks the most specific matching route. A /32 beats a /24 beats 0.0.0.0/0 (the default route, usually pointing at the internet gateway). Split-tunnel VPNs work exactly by injecting more specific routes for corporate ranges while leaving the default route alone.

# quick sanity checks you should be able to do mentally
10.4.2.17/24   -> network 10.4.2.0, hosts .1-.254, broadcast .255
is 10.4.3.9 in 10.4.2.0/24 ?  no  (third octet differs)
is 10.4.3.9 in 10.4.0.0/16 ?  yes
Module 1.3

NAT — and why your logs show one IP for 400 people

The attribution problem, explained

NAT rewrites source addresses so many private hosts share one public IP, keeping a translation table keyed on ports. Your office of 400 laptops appears to every SaaS provider as a handful of public IPs.

Why this matters in this stack: when a SaaS audit log says "login from 203.0.113.40", that is the office egress or the Netskope POP, not a person. Attribution has to come from an identity-aware layer — the proxy log with the username, the IdP sign-in log, or the EDR telling you which process on which host opened the socket. Never build a detection whose only pivot is a NATed source IP.

Consequences worth knowing: inbound connections need explicit port-forwarding or a reverse tunnel (which is why ZTNA uses outbound-only connectors); and CGNAT at ISPs means consumer IPs are shared too, so geo-IP and IP reputation are weak signals on their own.

Module 1.4

TCP, UDP and QUIC

Handshakes, flags, states — the vocabulary of every flow log

TCP: reliable, ordered, stateful

SYN →client proposes a connection with an initial sequence number
← SYN/ACKserver agrees and proposes its own
ACK →connection ESTABLISHED — data can flow
FIN / RSTgraceful close, or abrupt reset (blocked, crashed, or firewall drop)

Recognising these in tooling: a burst of SYNs with no completion = port scan or SYN flood. A connection that ends in RST immediately after the handshake often means a proxy or firewall killed it — useful when debugging why an app "randomly" fails behind Netskope.

UDP: fire and forget

No handshake, no ordering, no state. Used by DNS, DHCP, NTP, VoIP, and QUIC. Because it is stateless it is trivially spoofable, which is why UDP services are the favourites for amplification DDoS.

QUIC / HTTP/3

Google-originated, now standard: TLS 1.3 built into a UDP transport on port 443, with connection migration and faster handshakes. Security relevance is huge — many proxies and TLS-inspection engines cannot parse QUIC, so the standard practice is to block UDP/443 at the egress firewall, forcing browsers to fall back to TCP-based HTTP/2 where your SWG can see them. If someone reports "Netskope isn't logging Chrome traffic to that site", QUIC is suspect number one.

Module 1.5

DNS in depth

The most security-relevant protocol on the internet
1Check local caches: browser → OS stub resolver → hosts file
2Ask the configured recursive resolver (DHCP-provided, or corporate/Umbrella/Quad9)
3Resolver walks the hierarchy: root.com TLDexample.com authoritative
4Answer returns with a TTL; everyone caches it until it expires

Record types you must know

TypePurposeSecurity angle
A / AAAAName → IPv4 / IPv6Fast-flux malware rotates these constantly
CNAMEAlias to another nameDangling CNAMEs → subdomain takeover
MXMail servers for a domainTells you who really handles a target's mail
TXTFree textHome of SPF, DKIM, DMARC — and of DNS exfil
NS / SOADelegation and zone authorityHijacked NS = total domain control
PTRIP → name (reverse)Weak evidence; anyone can set their own

DoH / DoT — encrypted DNS

DNS over HTTPS hides queries inside ordinary HTTPS to a resolver like 1.1.1.1 or dns.google. Great for privacy on hostile networks, awful for corporate visibility: it bypasses your DNS logging and DNS-layer blocking entirely. Standard enterprise posture is to disable browser DoH via policy and block known DoH endpoints, so that name resolution stays inspectable.

DNS is a detection goldmine. It is low-volume, high-signal, and precedes almost every connection. Newly-registered domains, high-entropy subdomains, abnormally long TXT queries and rare-in-your-org names are all cheap, durable detections. In Google SecOps these land as NETWORK_DNS events.
Module 1.6

TLS, certificates and the handshake

What "the padlock" proves, and what it doesn't
1ClientHello — supported ciphers, TLS versions, and the SNI field naming the host in cleartext
2ServerHello + Certificate — server picks a cipher and presents its chain
3Validation — client checks signature chain to a trusted root, hostname match, expiry, revocation
4Key exchange (ECDHE) → session keys → encrypted application data

The chain is: leaf certificate → intermediate CA → root CA in the OS/browser trust store. Trust is transitive and entirely dependent on that store — which is precisely the hook TLS inspection uses.

What the padlock proves

  • Yes: the traffic is encrypted in transit, and the server holds the private key for the name you typed.
  • No: that the site is honest. paypa1-secure.com gets a free valid certificate in 90 seconds. Roughly all modern phishing is HTTPS.

SNI, ESNI/ECH

SNI is why a firewall with no decryption can still see which site you visited (but not the URL path or content). Encrypted Client Hello (ECH) hides even that — another erosion of network-only visibility, and another argument for endpoint and API-based controls.

TLS inspection, honestly

A forward proxy that inspects TLS terminates the client's session, opens its own session to the server, and re-signs certificates with a private CA that you push to every managed device. Consequences you will meet in production: certificate-pinned apps break (mobile apps, Dropbox, some updaters, many API clients), so every SWG ships a bypass list; and your proxy now holds plaintext for everything, making it a top-tier asset for both compliance scope and attacker interest.

Module 1.7

HTTP: methods, status codes, headers, cookies

The layer where CASB and DLP decisions happen
POST /api/v2/files/upload HTTP/2
Host: app.example.com          which site (also in SNI)
Authorization: Bearer eyJhbGci…  the token worth stealing
Cookie: session=abc123          the other thing worth stealing
User-Agent: Mozilla/5.0 …       client claim, trivially forged
Content-Type: multipart/form-data a file is being uploaded
Referer: https://app.example.com/drive

Status classes: 2xx success, 3xx redirect (watch open redirects in phishing), 4xx client error (401 unauthenticated, 403 forbidden, 429 rate-limited — a burst of 401s is credential stuffing), 5xx server error.

A CASB inline policy such as "allow personal Gmail but block file uploads" is implemented exactly here: match the host, match the method and content type, inspect the body, decide. That is only possible with decryption — which ties this module back to the previous one.

Module 1.8

Proxies, VPNs and tunnels

Forward vs reverse, IPsec vs TLS vs WireGuard
ThingSitsProtectsExample
Forward proxyIn front of usersThe organisation, from the internetNetskope SWG, Zscaler
Reverse proxyIn front of serversThe app, from the internetCloudflare, nginx, WAF
Site-to-site VPNBetween networksTraffic across the internetIPsec/IKEv2 tunnel to a branch
Remote-access VPNLaptop → networkThe whole network, badlyLegacy SSL VPN appliance
ZTNALaptop → one appIndividual applicationsNetskope Private Access

Traffic steering — how you force endpoints through a proxy — is worth knowing because Netskope offers all of it: an OS-level agent/client, a PAC file, explicit proxy settings, GRE/IPsec tunnels from a branch router, or reverse-proxy interception via the IdP for unmanaged devices.

The classic VPN failure: a remote-access VPN grants network-level reach, so one compromised laptop can scan and attack everything routable. ZTNA replaces "you are on the network" with "you may reach exactly this app, after this identity and posture check", and the connector dials outbound so nothing is exposed inbound.
Drill 1

A user complains that a specific SaaS app breaks only when they are on the corporate laptop with the SWG client enabled. Everything else works. Most likely cause?

Certificate pinning. The app ships with the expected server certificate baked in, so when the SWG presents its own re-signed cert the app refuses the connection — usually with a vague network error rather than a TLS warning. The fix is a targeted bypass/do-not-decrypt entry for that app's domains, which you should record as an accepted visibility gap rather than a silent exception.
Tier 2 · Operatehands on keyboard

The toolkit

Six commands cover most real investigations. Learn to reach for them before opening a vendor console — they tell you ground truth.

Module 2.1

dig, curl, openssl, ss, traceroute

Copy-paste-able, with what to look for

DNS

# what does this name resolve to, and who says so?
dig app.example.com A +short
dig example.com MX
dig example.com TXT              # SPF lives here
dig _dmarc.example.com TXT       # DMARC policy
dig selector1._domainkey.example.com TXT   # DKIM public key
dig @8.8.8.8 example.com +trace  # bypass local resolver, walk the hierarchy

HTTP

curl -v https://app.example.com/login        # full handshake + headers
curl -I https://app.example.com              # headers only
curl -sS -o /dev/null -w "%{http_code} %{time_total}s\n" https://x
curl --resolve app.example.com:443:203.0.113.9 https://app.example.com
                                             # test a specific backend IP

TLS

openssl s_client -connect app.example.com:443 -servername app.example.com
# look for: issuer chain, SANs, notAfter, protocol/cipher chosen
# if the issuer is your own proxy CA, you are being inspected — expected on-prem

echo | openssl s_client -connect host:443 2>/dev/null | openssl x509 -noout -dates -subject -issuer

Sockets and path

ss -tunap            # Linux: sockets + owning process (the pivot to EDR)
netstat -ano         # Windows equivalent; pair with tasklist /svc
lsof -i -P           # macOS: who has this port open
traceroute -T -p 443 app.example.com   # TCP traceroute; ICMP is often blocked
mtr app.example.com  # continuous path + loss, best for flaky links
Investigation habit: when triaging a suspicious outbound connection, always chase it back to a process. ss -tunap or the EDR's process tree turns "a connection to 45.x.x.x" into "Chrome's renderer" or "a scheduled task running curl from a temp folder" — a completely different verdict.
Module 2.2

tcpdump and Wireshark

Capture filters vs display filters — the thing everyone confuses

Capture filters (BPF syntax) decide what gets written to disk. Display filters (Wireshark syntax) decide what you see afterwards. Different languages; using the wrong one is the classic beginner error.

# tcpdump — capture filter syntax
tcpdump -i any -nn host 203.0.113.9 and port 443 -w out.pcap
tcpdump -i any -nn 'tcp[tcpflags] & tcp-syn != 0 and tcp[tcpflags] & tcp-ack == 0'
   # bare SYNs = scanning
tcpdump -i any -nn -A port 53   # watch DNS in cleartext

# Wireshark — display filter syntax
tls.handshake.extensions_server_name == "app.example.com"
http.request.method == "POST" && http.content_type contains "multipart"
dns.qry.name contains "dropbox"
tcp.flags.reset == 1            # who is killing connections?
frame contains "password"

Useful Wireshark moves: Statistics → Conversations to find the top talkers, Follow → TCP Stream to read a whole exchange, and the Expert Information panel for retransmissions and resets.

Module 2.3

Reading network logs: flow, proxy, DNS

What each source can and cannot tell you
SourceGives youBlind to
VPC / firewall flow logs5-tuple, bytes, allow/deny, durationHostname, URL, content, user
DNS logsQueried name, type, response, clientWhat was actually done at that host
Proxy / SWG logsUser, URL, method, bytes, category, verdictAnything bypassed or non-HTTP
EDR network telemetryProcess ↔ connection, on and off VPNUnmanaged devices, network gear
SaaS API logsActions inside the app, by identityHow the session was obtained

The senior move is knowing which one answers the question fastest. "Did data leave?" → proxy bytes-out and SaaS audit logs. "What started it?" → EDR. "Where did it go?" → DNS plus flow. Any single source will mislead you.

Tier 3 · Engineerdesign decisions

Designing and controlling networks

Module 3.1

Segmentation, egress control and the death of the perimeter

Where controls should sit when everything is SaaS

Classic design assumed a hard shell and a soft interior. For a FinTech running SaaS plus cloud, that model is gone: the "network" is a laptop in a bedroom talking to APIs. Three things replace it.

  • Identity as the control point — see the Identity path. Conditional access on user, device posture and risk.
  • Device posture — managed, encrypted, patched, EDR healthy. Netskope and your IdP both consume this signal.
  • Application-level access — ZTNA per app rather than routes into a network.

Egress filtering is still underrated. Servers should not be able to reach arbitrary internet addresses; allow-listing outbound destinations breaks most commodity C2 and exfiltration at a stroke, and produces excellent alerts when something tries. In AWS this means egress via NAT gateway plus a network firewall or proxy, with default-deny.

Microsegmentation

Restricting east-west traffic between workloads (security groups per service, not per VPC; Kubernetes NetworkPolicy). The test of a good design: compromise of one service should not grant network reachability to the database of another.

Module 3.2

Steering traffic to a security service

The engineering problem behind SASE

Any inline control needs traffic to physically pass through it. Options, with trade-offs:

MethodCoversWeakness
Endpoint client/agentAnywhere the laptop goesManaged devices only; users may tamper
PAC fileBrowser trafficBrowser-only, ignored by many apps
Explicit proxy settingApps honouring system proxyEasily bypassed, no thick clients
IPsec/GRE tunnel from routerWhole site, all devicesOnly when on that site
Reverse proxy via IdPUnmanaged/BYOD to sanctioned SaaSOnly sanctioned apps behind SSO
API (out-of-band)Data already in SaaS tenantsNot real-time; post-hoc

Mature deployments layer several: agent for managed laptops, tunnel for offices, reverse proxy for contractors, API for data at rest. Netskope's page walks through each of these concretely.

Module 3.3

PKI you actually have to operate

Private CAs, trust stores, pinning, rotation
  • Trust store distribution — the proxy CA must land in the OS store and the stores that ignore it: Firefox, Java (cacerts), Python (certifi), Node (NODE_EXTRA_CA_CERTS), Git, and container images. Half of all "TLS inspection broke my tooling" tickets are one of these.
  • Expiry management — certificates now max out around 13 months and are trending shorter. Anything not automated will eventually cause an outage at 2am.
  • Revocation — CRL and OCSP are weakly enforced; short lifetimes are the real mitigation.
  • mTLS — both sides present certificates. Common for service-to-service and for high-assurance API access; a strong alternative to shared secrets.
Tier 4 · Adversarialsenior

How networks get abused — and detected

Module 4.1

Command and control over things you allow

Beaconing, DNS tunnelling, domain fronting, living off trusted services

Modern C2 rarely uses a weird port. It uses HTTPS/443 to somewhere plausible, or DNS, because those are always permitted.

  • Beaconing — regular check-ins with jitter. Detect on periodicity and low variance in request size, not on destination reputation. A host contacting one domain every 60s ±5% for eight hours is suspicious even if the domain is clean.
  • DNS tunnelling — data encoded into subdomain labels and TXT answers. Detect on query length, entropy, query volume per domain, and rare parent domains with many unique children.
  • Domain fronting / trusted-service C2 — traffic to Slack, Discord, GitHub, Google Drive, or a CDN edge that also hosts something malicious. Reputation is useless here; you need content or endpoint context. This is a strong argument for CASB app-instance awareness — distinguishing your Google tenant from a personal one.
  • JA3/JA4 fingerprinting — hashes the ClientHello parameters, identifying the TLS client library even without decryption. A Python or Go TLS fingerprint from a laptop that should only run browsers is a great, cheap signal.
Detection idea for this stack: join proxy/SWG logs (destination, bytes, timing) with EDR process context (which binary opened it) in the SIEM. "Non-browser process making periodic HTTPS requests to a domain first seen in the estate today" is a durable, high-fidelity rule and maps to ATT&CK T1071 / T1568.
Module 4.2

Your blind spots, enumerated

Say these out loud before an auditor does
  • Decryption bypass lists — every pinned app you exempted is a hole. Keep the list short, reviewed and documented.
  • QUIC/HTTP3 — if UDP/443 is open outbound, some traffic is invisible to the proxy.
  • DoH — if browsers can reach public DoH endpoints, DNS logging is partial.
  • Unmanaged and personal devices — no agent, therefore only visible where they authenticate (IdP) or hit a reverse proxy.
  • Cloud-to-cloud — SaaS-to-SaaS OAuth integrations never touch your network at all. Only API-based CASB and IdP app governance see them.
  • Mobile — often the weakest telemetry, yet full mail and SSO access.

Writing this list down, with a compensating control per line, is exactly the artefact that turns a network conversation with a regulator or a client's TPRM team from defensive to credible.

Drill 2

Your DNS logs show 4,000 queries in an hour to unique subdomains of cdn-metrics.io, each 45–60 characters long, from one laptop. The parent domain has a clean reputation. Best first read?

DNS tunnelling. The tell is many unique, long, high-entropy child labels under one parent, at volume, from a single host — that is data being encoded outbound. Reputation is irrelevant because the attacker controls a freshly-clean domain. Pivot: which process on that host made the queries (EDR), and did the same host also make HTTPS connections you can correlate.
Referencesearchable

Glossary