Week 08 · lesson

Ports Belong to Transport Endpoints

A port number is not a program.

A port number is part of a transport-layer endpoint used to direct traffic to the appropriate socket/process context on a host.

That distinction prevents a lot of bad reasoning.

Build the endpoint tuple

For a TCP connection, a useful model includes:

source IP
source port
destination IP
destination port
transport protocol

Example:

192.0.2.10:53144 → 198.51.100.20:8080 / TCP

The client usually uses a temporary source port. The server uses the port on which its service is listening.

The same number can mean different things in different contexts

Port 53 is commonly associated with DNS traffic, but seeing 53 in a packet does not prove the payload is legitimate DNS, that a particular DNS product produced it, or that the system is safe.

Likewise, a service can run on an unusual port.

So avoid claims like:

Port 8080 means web server.

A better statement is:

The supplied socket table shows a TCP listening socket on local port 8080 owned by the fictional status-service process.

That statement includes evidence.

Binding controls where a service listens locally

Compare:

127.0.0.1:8080

with:

0.0.0.0:8080

In a simplified IPv4 model:

  • 127.0.0.1:8080 binds the service to loopback;
  • 0.0.0.0:8080 commonly means listen on all applicable IPv4 local interfaces.

Those are very different exposure intentions.

A service bound to loopback may be accessible only from the same host through that loopback path.

A service bound to all interfaces may become reachable from other networks if routes, local policy, upstream policy, and other conditions permit it.

That “if” matters.

Socket evidence is stronger than guessing from configuration

Supplied baseline:

LISTEN 0 128 127.0.0.1:8080 0.0.0.0:* users:("status-service",pid=421)

Changed state:

LISTEN 0 128 0.0.0.0:8080 0.0.0.0:* users:("status-service",pid=421)

The strongest supported claim is that the local listening binding changed from loopback-only to all local IPv4 interfaces represented by the supplied socket state.

Do not claim the service is reachable from the internet. That requires path and policy evidence we do not have.

Optional local observation

On your own authorized Linux VM, you may inspect listening TCP sockets:

ss -lnt

If process ownership is permitted in your environment, your teacher may allow:

ss -lntp

If permissions hide process names, that itself is an observation about your current privilege level. Do not escalate privileges merely to make the output prettier unless the lab explicitly authorizes it.

A supplied transcript is always sufficient.

Process, socket, and service manager are different views

You might collect:

process list → process exists
service manager → unit active
socket table → listening endpoint exists
application check → expected response exists

These are related but not interchangeable.

A process can exist without listening.

A socket can listen while the application returns errors.

A service manager can report active while a required dependency is unhealthy.

Activity: classify the claim

Given only:

LISTEN 0 128 127.0.0.1:8080 0.0.0.0:*

Can you claim:

  1. something is listening on local TCP port 8080? Yes, within the supplied observation.
  2. the application returns HTTP 200? No.
  3. another host can reach it? Not from this evidence.
  4. the service is secure? No.
  5. the binding is limited to loopback? Yes, in the supplied state.

This is the evidence discipline you need for network defense.

Start your Service Exposure Record

Record:

Process/service:
Transport:
Local bind address:
Local port:
Baseline binding:
Changed binding:
What the socket table proves:
What it does not prove:

Lesson 2 adds transport state and explains why a listening socket is only one piece of the connection.

process flow

Process to Bounded Service Exposure

  1. Process

    Identify the service process and required function.

  2. Socket

    Observe transport protocol, local bind address, and port.

  3. Transport

    Classify handshake, reset, silence, or datagram evidence at the observation point.

  4. Path

    Determine which intended client paths are represented in the lab.

  5. Policy

    State the required allowed and denied relationships.

  6. Narrow Exposure

    Apply the smallest control that removes an unnecessary path.

  7. Retest Both Sides

    Verify required access still works and prohibited direct access does not.

  8. Bound Claim

    Separate listening, reachability, application function, authorization, and security claims.

Read this concept flow as plain text
  1. Process. Identify the service process and required function.
  2. Socket. Observe transport protocol, local bind address, and port.
  3. Transport. Classify handshake, reset, silence, or datagram evidence at the observation point.
  4. Path. Determine which intended client paths are represented in the lab.
  5. Policy. State the required allowed and denied relationships.
  6. Narrow Exposure. Apply the smallest control that removes an unnecessary path.
  7. Retest Both Sides. Verify required access still works and prohibited direct access does not.
  8. Bound Claim. Separate listening, reachability, application function, authorization, and security claims.