Skip to content
ShankarStack

Networking for security testers

The TCP/IP and OSI models in practice

Hands-on lab linked to this lesson

Launch the smb-enumeration sandbox

Every assessment ultimately travels over a network. Before you can test anything, you need an accurate mental model of how data actually moves — because that model tells you where things can be observed, altered, misconfigured or fail, which is exactly where security lives.

Why a network model matters to a tester

When you load https://shop.example.com, a surprising amount happens in a fraction of a second. Your computer looks up the name, finds an address, opens a connection, proves the server's identity, encrypts the channel, and only then sends the actual request. Each of those steps is a place where something can go wrong — and where an attacker or a tester can learn something. If you understand the sequence, you can reason precisely about what you're testing and why a tool behaves the way it does. If you don't, security testing becomes guesswork.

Two models, one reality

The industry describes networking with two layered models. The OSI model has seven layers (Physical, Data Link, Network, Transport, Session, Presentation, Application); the TCP/IP model collapses these into four (Link, Internet, Transport, Application). You don't need to memorise every layer — you need the intuition that networking is built in layers, where each layer wraps the one above it and adds its own addressing and control information.

The layers you'll reference constantly:

  • Network/Internet layer (IP): moves packets between machines using IP addresses. This is "which computer".
  • Transport layer (TCP/UDP): moves data between programs on those machines using ports. This is "which application".
  • Application layer (HTTP, SSH, DNS…): the actual protocol you and the server speak.

Encapsulation: how a request becomes bytes on the wire

Your HTTP request is wrapped by TCP (adding source and destination ports and sequence numbers), then by IP (adding source and destination addresses), then by the link layer (adding hardware addresses), and finally sent as electrical, optical or radio signals. At the other end, each layer is unwrapped in reverse. This matters because each wrapper is a place to inspect, filter or tamper — firewalls work at the IP/port layers, a proxy works at the application layer, and so on.

Ports, sockets and the TCP handshake

A port is a number (0–65535) that identifies an application on a host. A web server typically listens on 443 (HTTPS) or 80 (HTTP); SSH on 22; SMB on 445. A socket is the combination of an IP address and a port — a specific endpoint of a conversation.

TCP is connection-oriented: before any data flows, the two sides perform a three-way handshake:

  1. The client sends SYN ("I'd like to talk").
  2. The server replies SYN-ACK ("I'm here, go ahead").
  3. The client sends ACK ("great, here we go").

Understanding this is directly useful: port scanners manipulate exactly these messages to decide whether a port is open (handshake completes), closed (actively refused with a RST), or filtered (no answer at all — usually a firewall silently dropping the packet). Those three outcomes mean very different things in a report.

TCP vs UDP

  • TCP guarantees delivery and ordering (web, SSH, SMB, email). Use it when every byte must arrive correctly.
  • UDP is fire-and-forget: faster, no handshake, no guarantee (DNS, some VoIP, SNMP). Scanning UDP is slower and noisier precisely because there's no handshake to confirm state.

How this shows up in real testing

When a scan says a port is "filtered", you've learned there's a firewall — that's intelligence, not a dead end. When a service answers on an unexpected port, you've found something the inventory missed. When you read a packet capture, you can follow a conversation hop by hop and see exactly where it breaks. All of this flows from the layered model.

Key takeaways

  • Networking is layered; each layer adds addressing and can be inspected or filtered.
  • IP addresses identify machines; ports identify applications.
  • The TCP three-way handshake (SYN → SYN-ACK → ACK) is what scanners manipulate to classify ports as open, closed or filtered — and each state means something different.
  • TCP is reliable and ordered; UDP is fast and best-effort.
  • A precise model turns tool output into understanding instead of guesswork.

Practice safely

Apply this in the smb-enumeration lab — an isolated, sandboxed target created just for you. Only ever test systems you own or are explicitly authorised to assess.

Reporting mindset: for every observation, record what you did, what you saw, the business impact, and a clear, verifiable remediation. Evidence and clear writing are what turn testing into value.

This is a free preview. Sign in to track progress and unlock the full course.

Sign in