Inadequate Segmentation
In the lab network of the introduction, every device sits in one flat 10.10.0.0/24: the receptionist's PC, the database, the printer, the admin workstation. The firewall guards the edge, and inside there is nothing. When one workstation is phished, the attacker is on the same network as the database, can talk to every SMB share, can ARP-spoof the gateway and can reach the printer's Telnet port. Inadequate segmentation is the sixth common weakness, and it is the one that turns a small incident into a company-wide one: ransomware spreads as far as the network lets it.
The mechanism: blast radius
Segmentation doesn't stop the first compromise. It limits what the compromised machine can reach next, the blast radius. The program compares the lab network as it is (flat) with a segmented design, starting from a phished workstation and following every allowed connection to a service an attacker could try to abuse.
from collections import deque
hosts = { # host -> zone, services offered
"ws05": ("staff", set()), "admin01": ("admin", set()), "www": ("dmz", {80, 443, 22}),
"mail": ("servers", {25, 143, 587}), "db": ("servers", {5432, 22}), "files": ("servers", {445, 21}),
"prn40": ("devices", {23, 80, 9100}), "ns": ("servers", {53}),
}
def flat(src_zone, dst_zone, port):
return True # one /24, no internal filtering
SEGMENTED = { # (from zone, to zone): allowed ports
("staff", "dmz"): {80, 443}, ("staff", "servers"): {25, 143, 587, 445, 53},
("staff", "devices"): {9100}, ("admin", "dmz"): {22}, ("admin", "servers"): {22},
("dmz", "servers"): {5432, 53},
}
def segmented(src_zone, dst_zone, port):
return src_zone == dst_zone and src_zone != "staff" or port in SEGMENTED.get((src_zone, dst_zone), set())
def blast_radius(start, allowed, exploitable):
"""Hosts reachable from start, assuming an attacker can take over a host via an 'exploitable' service."""
owned, queue, reached = {start}, deque([start]), {}
while queue:
h = queue.popleft()
for t, (zone, ports) in hosts.items():
open_ports = {p for p in ports if allowed(hosts[h][0], zone, p)}
if t != h and open_ports:
reached.setdefault(t, set()).update(open_ports)
if t not in owned and open_ports & exploitable:
owned.add(t); queue.append(t)
return reached, owned
# Assume, for the comparison, that these services can be abused once reached
# (weak or reused credentials, the printer's Telnet, unpatched SMB).
EXPLOITABLE = {22, 23, 445}
for name, rule in [("flat", flat), ("segmented", segmented)]:
reached, owned = blast_radius("ws05", rule, EXPLOITABLE)
print(f"{name:10} reachable: {len(reached)} hosts, {sum(len(p) for p in reached.values())} services; "
f"taken over: {sorted(owned - {'ws05'})}")flat reachable: 6 hosts, 14 services; taken over: ['db', 'files', 'prn40', 'www']
segmented reachable: 6 hosts, 11 services; taken over: ['db', 'files']
In the flat network, the phished workstation reaches every service of every host, and through SSH, Telnet and SMB the attacker spreads to the database, the web server, the file server and the printer. In the segmented design the same workstation still reaches the services staff need (web, mail, file shares, printing, DNS), but SSH and Telnet are no longer reachable from staff desks. One stepping stone remains: the file server's SMB. Once the file server falls, the attacker is inside the server zone, where servers may talk to each other freely, and reaches the database's SSH. Zone-level segmentation cut the radius from four hosts to two; cutting the last hop needs either patched, signed SMB or rules within the zone (Microsegmentation). (The rule src_zone == dst_zone and src_zone != "staff" lets servers talk within their zone; staff PCs can't reach each other, a cheap and effective rule against worm-style spread.)
Finding it
- Scan from a user network (within scope) and compare with the policy matrix: in the lab scan from
10.10.0.99, every server port answered, which is the evidence for this finding (Nmap Inventories). - Read the design: one big subnet, or VLANs with a router that routes everything between them without ACLs (segmentation on paper only).
- Look for layer-2 weaknesses: VLANs that exist but trunks that carry all of them to user ports, VLAN 1 everywhere (VLANs, VLAN Hopping).
- Check east-west monitoring: if nothing logs traffic between internal hosts, lateral movement is invisible.
Detecting lateral movement
Segmentation also creates places to watch. Every allowed path between zones crosses a firewall or a router ACL that can log, and traffic that tries to cross where it isn't allowed (a workstation probing SSH on servers) is a high-quality alert, because legitimate users never do it. In a flat network the same probe goes from switch port to switch port and no device logs it.
How it is fixed
- Zones by trust and function: users, servers, DMZ, management, devices/IoT, guests (Zones, DMZs and Trust Boundaries).
- Filtering between zones with default deny, from a policy matrix (VLAN and ACL Design).
- Client isolation: user devices don't need to talk to each other (private VLANs, Wi-Fi client isolation, host firewalls).
- Admin paths only from admin systems through a bastion (Bastion Hosts).
- For critical systems, microsegmentation down to individual workloads (Microsegmentation), and in the long run zero-trust access (Zero Trust).
Segmenting a running network is a project, not a rule change: inventory the real flows first (flow logs over weeks), build the matrix, move one zone at a time, log before you block.
Pitfalls
- VLANs without filtering between them: separate broadcast domains, same reachability.
- Exceptions that recreate the flat network: "allow staff to servers, any port" for convenience.
- Forgetting the management network, which often has access to everything and becomes the new flat network.
- Segmenting IPv4 and leaving IPv6 routed freely.
Practice
1. In the program, remove 445 from EXPLOITABLE (SMB patched and signing enforced). What is taken over in the segmented design?
Nothing besides the workstation: staff can reach only web, mail, SMB, printing and DNS, none of which is in the exploitable set any more. In the flat design SSH and Telnet still let the attacker spread.
2. Why are "staff PC to staff PC" connections worth blocking?
Users rarely need them, while worms and ransomware spread exactly that way (SMB, RDP, WinRM between workstations). Blocking them limits spread and makes any attempt an alert.
3. Which evidence from the lab assessment supports the segmentation finding?
The scan from the staff network at 10.10.0.99 reached SSH on the firewall, web and database servers, PostgreSQL, and FTP and SMB on the file server (the leased printer was out of scope): no internal filtering exists, and the design documents show a single /24.
Test yourself
What does segmentation primarily limit?
- The first compromise
- The blast radius: what a compromised host can reach next
- Internet bandwidth
- The number of VLANs
Two VLANs are routed by a layer-3 switch with no ACLs. Are they segmented?
- Yes, VLANs are segments
- No: separate broadcast domains but unrestricted reachability
- Only for IPv6
- Only if the VLAN IDs differ by 10
Why is a blocked attempt from a workstation to SSH on a server a good alert?
- It is common
- Legitimate users never do it, so it signals scanning or lateral movement
- It costs nothing
- Firewalls can't log allowed traffic