Chapter 11 · Part II · Defending the network

From VPNs to zero trust

For a long time the plan was simple: build a wall around the company network, let staff in through a VPN, and trust whoever was inside. It fails the same way every time. One phished password or one infected laptop puts an attacker inside the wall, and inside, almost every door is unlocked. Zero trust throws away the idea of an inside. Every request, from anywhere, is checked against who is asking, from what device, for which resource, and the answer is good for that resource and that session only.

7tenets of zero trust in NIST SP 800-207, Zero Trust Architecture, published August 2020
5pillars in CISA's Zero Trust Maturity Model 2.0 (April 2023): identity, devices, networks, applications and workloads, data
4maturity stages in the same model: Traditional, Initial, Advanced, Optimal

Common mix-up: zero trust does not mean "trust nobody" and it is not a product you buy. Trust is still granted every day, to thousands of requests. The difference is that it is never granted implicitly because a device happens to sit on a particular network. It is granted explicitly, per request, for one resource, from evidence, and it can be taken back.

Read first: this chapter assumes you know what a VPN tunnel and an overlay network are and how peers find each other through NAT. If not, start with VPNs, tunnels & overlays and NAT traversal: STUN, hole punching & relays on networks.jelia.nyc. Network segmentation and firewall rules are Chapter 5; passwords, MFA and passkeys are Chapter 4.

The old bargain

The castle and the moat

The perimeter model draws one line around the organization. Outside the line is the internet, untrusted. Inside is the corporate network: the file servers, the wiki, the build system, the payroll application, the admin consoles. A firewall guards the line, and the rule of thumb is that anything already inside is one of us.

The VPN fits into that picture as a drawbridge. A remote employee proves who they are, usually with a password and sometimes a second factor, and the VPN gives their laptop an address on the inside network. From that moment the laptop is, as far as the network can tell, sitting at a desk in the office. That is the crucial detail: a classic VPN grants network-level access. It does not let you into "the wiki"; it lets you onto the network where the wiki, and everything else, happens to live.

NIST's zero trust document has a precise name for that inside space: an implicit trust zone, an area where everything is trusted to the level of the last checkpoint it passed. Airport security is its example. Once you are past screening, nobody checks again at the gate lounge. A perimeter network makes the whole company one enormous lounge.

The trouble shows up when the wrong person gets past the checkpoint. A phished password, a token stolen from a browser, an infected laptop that connects to the VPN every morning: each one puts an attacker inside the trust zone with whatever the network allows. What happens next has its own name. Lateral movement is the work of going from the first foothold to the thing the attacker actually wants, hop by hop: from the laptop to a file share, from the share to a script with a service password in it, from that service account to the database. MITRE ATT&CK lists it as a whole tactic, and lists "valid accounts" as one of the most common ways in, because a real username and password look exactly like an employee.

Two changes made this worse. First, the inside stopped being a place. Applications moved to cloud services, staff moved home, and contractors brought their own devices, so the perimeter turned into a collection of exceptions. Second, nearly every serious intrusion now involves a credential at some step, and a perimeter checks credentials once, at the drawbridge, and then believes them for hours.

Network-level access through a VPN compared with application-level access through a proxy Network-level access (classic VPN) Laptop INSIDE THE NETWORK VPN Wiki: reachable Files: reachable Payroll: reachable Admin: reachable every host, every port the network allows Application-level access (zero trust) Laptop PEP / PROXY Wiki ✓ allowed Files ✗ no path Payroll ✗ no path Admin ✗ no path one decision per resource
Left: the VPN puts the laptop on the network, and the network decides what it can reach. Right: the laptop never joins the network; an enforcement point in front of each application decides, one application at a time, and everything else simply has no path.
Go deeper: segmentation helps, but it still trusts location

The classic answer to lateral movement is segmentation (Chapter 5): split the network into zones and filter between them. It works, and it is still worth doing. But a zone rule talks about addresses, not people. "The user VLAN may reach the payroll server" lets every user reach payroll, including the one whose laptop was compromised this morning, because the firewall cannot tell the finance clerk's packets from the intern's. Finer zones mean more rules, more exceptions, and eventually the same flat network with extra steps.

Zero trust keeps the useful part of segmentation, small blast radius, and changes what the rule is about. Instead of "this subnet may talk to that subnet", the rule becomes "this person, on a healthy device, may use this application". Network location becomes one signal among many rather than the deciding one.

NIST SP 800-207

What zero trust actually says

"Zero trust" was coined years before it had a standard definition, which is part of why the phrase gets stretched over almost any product. The reference most people now use is NIST Special Publication 800-207, Zero Trust Architecture, from August 2020. It is short, vendor-neutral and readable, and it states the idea as seven tenets. The headline sentence of each is quoted below; the comments are ours.

#Tenet (NIST SP 800-207, section 2.1)What it means in practice
1"All data sources and computing services are considered resources."A printer, a SaaS account and a sensor are all things to protect and to make decisions about, not background.
2"All communication is secured regardless of network location."A request from the office LAN meets the same bar as one from a café. Being inside earns nothing.
3"Access to individual enterprise resources is granted on a per-session basis."Permission is for this resource, now, with the least privilege the task needs; it does not carry over to the next resource.
4"Access to resources is determined by dynamic policy..."The policy reads the client's identity, the application, and the state of the requesting device, and may add behavior and environment.
5"The enterprise monitors and measures the integrity and security posture of all owned and associated assets."Devices are measured continuously: patched, encrypted, managed, not showing signs of compromise.
6"All resource authentication and authorization are dynamic and strictly enforced before access is allowed."Check first, then connect, and keep re-checking while the session lasts.
7"The enterprise collects as much information as possible about the current state of assets, network infrastructure and communications and uses it to improve its security posture."Logs of every decision feed back into better policy and into detection (Chapter 17).

The same document names the moving parts, and the names are worth learning because every product maps onto them somehow. The policy enforcement point (PEP) sits in the path between a subject (a person or a program) and a resource. It enables, monitors and terminates connections, but it does not decide anything itself. It asks. The policy engine (PE) makes "the ultimate decision to grant access to a resource for a given subject", feeding enterprise policy and outside signals into what NIST calls a trust algorithm, and it logs every decision. The policy administrator (PA) carries the decision out: it tells the enforcement point to open or close the path and issues any session-specific token or credential. Together the engine and the administrator form the policy decision point (PDP).

Notice the two planes. Decisions travel on a control plane, a separate channel between the enforcement points and the decision point. Application traffic travels on the data plane, through the enforcement point and nowhere else. A resource should not be reachable except through a PEP at all; ideally an attacker on the same network cannot even see that it exists.

NIST zero trust logical components: policy engine, policy administrator and policy enforcement point, with their signal sources POLICY DECISION POINT Policyengine Policyadministrator Identity provider Device management Threat intelligence Access policy Activity logs Compliance rules control plane CONTROL PLANE ABOVE DATA PLANE BELOW Subjectperson + device Enforcementpoint (PEP) Resourceone application request
After Figure 2 of NIST SP 800-207. The enforcement point stands between subject and resource and asks; the engine decides from policy and signals; the administrator tells the enforcement point to open or close the path. Decisions use the control plane; application traffic uses the data plane.
Go deeper: the trust algorithm, and three ways to deploy it

NIST describes two styles of trust algorithm. A criteria-based algorithm checks a set of qualifications: if every condition is met, allow; otherwise deny. A score-based algorithm computes a confidence value from the inputs and compares it to a threshold set for each resource. It also separates singular evaluation, which judges each request on its own, from contextual evaluation, which also considers the subject's recent history, so that a burst of unusual requests can lower the answer for the next one. The simulator below is criteria-based and singular, which is where most real deployments start.

The document then sketches deployment patterns. In the device agent / gateway model, an agent on the laptop and a gateway in front of each resource form a two-part enforcement point. In the enclave model, a gateway guards a group of resources, useful for legacy systems that cannot sit behind their own gateway. In the resource portal model, one portal fronts everything and no agent is installed, which works for unmanaged devices but sees less about them. Most organizations end up with a mix.

Instrument · policy decision simulator

A policy decision, by hand

Here is a small policy engine. At the top is the policy: a list of allow rules. Each rule names who (a role), what (a resource), and the conditions the request must meet: what kind of device, how strong the sign-in, from where, and when. Anything no rule allows is denied. That is default deny, the same principle as in a firewall, applied to people and applications instead of addresses and ports.

Below the policy are twelve made-up requests from one morning. Most come from employees doing their jobs. Four come from an attacker using phished credentials: in two of them the attacker also talked a tired user into approving a push prompt. Load the VPN = full access preset and watch everything go through. Then load Zero trust and see which requests survive, and which honest ones now get stopped. Click any request to see the engine's reasoning, rule by rule, and change its attributes to see what would flip the answer.

Policy: allow rules (everything else is denied)

#RoleResourceDeviceSign-in at leastLocationHours
Edit any cell; the verdicts below update at once.
Legitimate work allowed–
Risky but honest, allowed–
Outside the job, allowed–
Attacker requests allowed–

Requests

#WhoDeviceSign-inFromTimeResourceKindVerdict

Change this request

Worked example: the phished payroll clerk

Request 10 is an attacker who phished Ben's password and then sent push prompts until Ben tapped "approve". Under VPN + MFA it is allowed: the VPN wanted a password and a second factor, and it got both. Nothing in that policy knows that the device is one the company has never seen, in a country Ben has never logged in from, at two in the morning.

Under Zero trust, the engine looks for a rule that grants the finance role access to payroll. Rule 4 does, and the engine checks its conditions one by one: device must be healthy (it is unmanaged, so fail), sign-in must be a passkey (it was a push approval, so fail), location must be known (it is unfamiliar, so fail). Three independent reasons to say no. The attacker would have to beat all three at once, and the passkey condition alone defeats remote phishing, because a passkey will not sign in to a look-alike site (Chapter 4).

Now look at the cost. Request 4 is the real Ben, checking payroll from his own phone in the evening. The zero-trust policy denies him too. That is not a bug in the simulator; it is the trade-off every policy author makes. The usual answer is to give the honest user a path that meets the bar, such as a managed device or a passkey on his phone, and to make the denial message tell him exactly which condition failed. Request 12 is the other honest lesson: the wiki rule accepts any device with a second factor, so the attacker who phished Cara and got her push approved reads the wiki. Low-value resources get looser rules on purpose. Make sure they really are low-value.

Go deeper: why "deny by default, explain every denial" matters

A policy engine is only as good as the rules people can maintain. Two habits keep it healthy. First, write rules as positive grants to roles, not as lists of exceptions, so that a new resource is invisible until someone decides who needs it. OWASP's authorization guidance calls this denying by default and enforcing least privilege. Second, make every decision explainable: which rule was considered and which condition failed. That turns support calls from "it doesn't work" into "my laptop is missing updates", and it gives detection teams a stream of denied requests that is far more interesting than a stream of failed logins.

Device health and the clock

Device posture, re-checked

The second input to every decision, after identity, is the device. Device posture is the set of facts about a device that bear on how far to trust it: is it enrolled in the organization's device management, is the disk encrypted, is the operating system on a supported version with current security updates, is endpoint protection running and quiet, is the screen lock on. Tenet 5 asks the enterprise to measure this for every asset, owned or not.

The facts have to be trustworthy, and that is harder than it sounds. A device that simply reports "I am patched" can lie, and malware with administrator rights can make it lie. Stronger designs tie the device's identity to a key held in its hardware security chip, issued when the device was enrolled, so that "this request comes from managed laptop 4471" is a cryptographic statement rather than a claim. NIST is explicit that devices must be told apart using enterprise-issued credentials, not information that can be spoofed, such as a network MAC address.

Posture changes over a day. A laptop that was healthy at nine can miss a critical update by lunch, or trip an endpoint alert at three. A perimeter network checks posture, if at all, when the VPN connects, and then trusts the session until the user disconnects. Zero trust asks the question again. The usual mechanism is the token: after a decision, the policy administrator issues a short-lived credential for that resource, and when it expires the device must come back and be judged again. Some systems go further and push a revocation as soon as a signal changes, without waiting for the expiry.

How long should tokens live? The instrument below lets you measure the trade-off. The laptop falls out of compliance at a moment you choose. You set how long tokens last and how often the engine re-evaluates live sessions. The timeline computes how long the unhealthy laptop keeps its access under three designs.

VPN session, checked at connect–
Short tokens only–
Tokens + live re-evaluation–
Decisions per laptop per day–

Blue ticks are policy checks; the hatched stretch is time the unhealthy laptop still has access, and ✕ marks the moment it is cut off. The workday runs 9:00 to 17:00. Tokens are issued at 9:00 and renewed every lifetime; each renewal is a fresh decision. "Live re-evaluation" re-runs the policy for open sessions on a timer. Shorter is safer and costs more decisions.

exposure = (first check after t₀) − t₀
t₀ is the minute the device becomes unhealthy. A check is any moment the policy is re-run: a token renewal or a live re-evaluation. The laptop keeps its access until the first check after t₀, so the exposure is the gap from t₀ to that check.

Worked example. Tokens last 60 minutes and are issued at 9:00, 10:00, 11:00 and so on. The laptop misses a critical update and goes out of compliance at 11:15, which is t₀ = 135 minutes into the day. The next renewal is at 12:00, minute 180, so the unhealthy laptop keeps access for 180 − 135 = 45 minutes. Add live re-evaluation every 5 minutes and the next check is at minute 140, so the exposure drops to 5 minutes. The classic VPN session, checked only when the user connected at 9:00, keeps access for the remaining 480 − 135 = 345 minutes, until the user goes home.

The price shows in the last readout. Five-minute tokens mean 96 decisions per laptop per day, against 8 for hourly tokens. Multiply by every laptop and every application and the policy engine becomes a busy, critical service. That is why designs mix the two: moderately long tokens for the common case, with live re-evaluation or pushed revocation for the signals that matter most, such as "this device just raised an alert".

Instrument · lateral movement graph

How far can one laptop reach?

Blast radius is a graph problem. Draw every resource as a node. Draw an arrow from A to B wherever something on A can open a connection to B. An attacker who controls A can reach everything along the arrows, and if they can take over one of those nodes (because it is unpatched, or keeps a password in a script, or holds keys to something else) the search continues from there. Everything the search touches is exposed: the attacker can at least try it.

This model company has fifteen resources in five zones. Four are crown jewels, marked ◆: payroll, the customer database, the backups, and the identity admin console. Choose the attacker's foothold and the access model, and the instrument runs a breadth-first search: it counts what is reachable, which crown jewels are exposed, and the shortest path to each. Click a node, or pick it from the list, to see the path.

Resources exposed–
Crown jewels exposed–
Shortest path to a jewel–
Hosts used as stepping stones–

Weak hosts (!) are the contractor laptop (behind on updates), the printer and camera (old firmware), the file server (a script on it holds a service password), the build server (holds deployment keys to the database) and the jump host (admins leave sessions open). In the per-app models, laptops are never reachable from each other, and backups pull from servers rather than the other way round.

Worked example: the engineer's laptop, four ways

Start from the engineer's laptop with malware the endpoint tools have not noticed. On the flat VPN, all 14 other resources are one hop away, including all four crown jewels. The attacker does not need to be clever; the network does the work.

Segmented, the laptop sits in the user zone. It can still reach the other laptops (same zone), the printer, the four applications, and the file server and payroll, because users legitimately use them and a zone rule cannot tell this user from the others. The file server is weak, and servers talk freely among themselves, so the database and backups fall at hop 2. Three of four jewels are exposed. Only the identity console, in the admin zone, is out of reach.

Per-app, identity only: the engineer is entitled to the wiki, email, code repository and build server, and nothing else is even visible. One jewel is still exposed: the build server holds deployment keys to the customer database, so the path is laptop → build server → database, two hops. That is the lesson zero trust does not erase: an entitlement is an arrow, and a machine with broad keys is a bridge. The fix is to scope those keys, which is what workload identity is for.

Per-app with device checks gives the same answer while the malware is undetected, because the device still looks healthy. Switch the foothold to "endpoint protection flagged it" and the device fails posture: every arrow from the laptop disappears and the exposure drops to zero. Switch to "phished password, attacker's own device" and the same thing happens, because an unknown device never passes the device check, while on either VPN model the phished password alone opens everything a laptop could reach.

Building it

What zero trust looks like in practice

BeyondCorp. The best-documented early large deployment is Google's. In a 2014 paper, BeyondCorp: A New Approach to Enterprise Security, Rory Ward and Betsy Beyer described "removing the requirement for a privileged intranet and moving our corporate applications to the Internet". Employees reached internal applications through an access proxy on the public internet, the same way from the office as from home. The proxy granted access based on who the user was and on an inventory of managed devices, each with its own certificate. The office network itself was treated as no more trusted than a coffee shop's. It took years and many follow-up papers, and that is part of the lesson.

Identity-aware proxies and ZTNA. That access proxy is now a product category, usually called an identity-aware proxy or zero trust network access (ZTNA). A proxy in front of each web application authenticates the user with the organization's identity provider, checks device posture through an agent or a certificate, consults policy, and only then forwards the request. The application itself is not reachable from the internet except through the proxy. For non-web protocols, an agent on the laptop builds a tunnel to a gateway per application rather than to a whole network: the VPN's mechanics, with the scope cut down to one resource.

Mesh networks with ACLs. For a small organization the most practical step is often an overlay network: a mesh of encrypted peer-to-peer tunnels, typically WireGuard, where each device has its own key and a coordination service distributes keys and policy (the mechanics are on networks.jelia.nyc, under overlays and NAT traversal). What makes a mesh a zero-trust tool rather than a flat VPN is its access control list. Every device is enrolled to a person or a tag, and the list says which identities may reach which tags on which ports. With no rule, there is no path, even between two laptops on the same mesh.

# illustrative mesh-network policy: generic syntax, made-up names
groups:
  engineering: [ana@example.com, raj@example.com]
  finance:     [ben@example.com]
rules:
  - allow: group:engineering -> tag:git, tag:ci     # web ports only
    when:  device.managed and device.os_current
  - allow: group:finance     -> tag:payroll
    when:  device.managed and signin == "passkey"
  - allow: tag:ci            -> tag:artifacts       # a machine, not a person
# no rule, no path: laptops cannot reach each other at all

Service to service: mutual TLS and workload identity. Zero trust is not only about people. Inside a data center, services call each other constantly, and the perimeter habit is to trust a call because of where it comes from: anything on the build subnet must be the build system. That fails the moment anything else lands on that subnet. The alternative is to give every workload a cryptographic identity and to have both ends of every connection prove theirs with mutual TLS (mTLS): in an ordinary TLS handshake only the server shows a certificate (Chapter 3); in mTLS the client does too. The receiving service then authorizes by that identity, not by address.

# BEFORE: trust by address. Anything that lands in this range is "the build system".
allow_callers_from: 198.51.100.0/24
# AFTER: trust by workload identity, proven by a short-lived client certificate
tls:
  require_client_certificate: true
  trust_domain: example.org             # the organization's workload certificate authority
  max_certificate_lifetime: 1h          # renewed automatically by a local agent
authorize:
  - caller: spiffe://example.org/build/ci-runner
    may:    [read artifacts, write artifacts]

The spiffe:// name comes from SPIFFE, an open set of standards for naming workloads and issuing them identity documents, as X.509 certificates or JWTs; SPIRE is its reference implementation. The pattern matters more than the product: identity is issued automatically to the workload by something that can attest what it is (which machine, which container image), certificates live for minutes or hours rather than years, and renewal is automatic. A stolen certificate is worth little for very long, and there is no long-lived password sitting in a configuration file for an attacker to find. The same idea reaches into OAuth: RFC 8705 binds access tokens to a client's TLS certificate, so a token copied off the wire is useless without the matching private key.

Go deeper: short-lived credentials everywhere

The common thread through tokens, workload certificates and certificate-bound tokens is replacing standing secrets with short-lived ones that are issued on demand after a decision. Administrators get the same treatment: rather than a permanent admin account, a person requests elevated access for one task, the request is approved (by policy or by a colleague), and the credential expires on its own. Cloud providers' role-assumption features, short-lived SSH certificates and just-in-time admin access are all instances. The CISA maturity model's Optimal stage describes exactly this: "fully automated, just-in-time lifecycles and assignments of attributes".

CISA Zero Trust Maturity Model 2.0

A migration, not a purchase

The US Cybersecurity and Infrastructure Security Agency publishes a maturity model that turns NIST's principles into a progression. Version 2.0, dated April 2023, organizes the work into five pillars, "Identity, Devices, Networks, Applications and Workloads, and Data", with three capabilities that cut across all of them: visibility and analytics, automation and orchestration, and governance. Each pillar moves through four stages, from Traditional through Initial and Advanced to Optimal. The point of the model is that an organization can be Advanced on identity and Traditional on data at the same time, and that is normal.

Its identity pillar shows how concrete the stages are. For authentication, the model's four stages read, in short:

StageAuthentication, per the CISA identity pillar
TraditionalPasswords or multi-factor authentication, with static access once signed in.
InitialMFA, which may include a password as one factor, plus validation of several attributes such as locale or activity.
AdvancedPhishing-resistant MFA and attributes for all identities, beginning to move away from passwords.
OptimalIdentity validated continuously with phishing-resistant MFA, "not just when access is initially granted."

A realistic migration follows the same logic as the instruments above. Most guidance, from NIST, CISA and the UK's National Cyber Security Centre, lands on roughly this order:

  1. Inventory. Know your users, devices, applications, services and data. NIST's migration chapter starts here; you cannot write "who may reach what" without both lists.
  2. Identity first. One identity provider for everything, with strong, ideally phishing-resistant, sign-in. Every later decision depends on it.
  3. Device health. Enroll managed devices, give them hardware-backed identities, and start collecting posture before you enforce on it, so you know how many devices would fail.
  4. Protect the highest-value applications first. Put an enforcement point in front of the systems in your crown-jewel list, write narrow rules, and run them in a logging-only mode before switching to enforce.
  5. Shrink the VPN. As applications move behind enforcement points, take them off the flat network. The VPN ends up as a fallback for the few systems that cannot move yet.
  6. Workloads and data. Workload identity and mTLS between services, then data-level controls, are the long tail.
Honest limits

Where zero trust goes wrong

The identity provider becomes the crown jewel. When every decision starts with "who is this?", whoever controls the identity provider controls everything. Its administrator accounts need the strongest sign-in you have, their own enforcement, few members and close monitoring. Its availability matters too: if the policy engine is down, nobody works. NIST calls out both risks, subversion of the decision process and denial of service against it, as threats to a zero-trust architecture.

Policy sprawl. Hundreds of applications times dozens of roles times device and location conditions is a lot of rules, and rules accumulate the way firewall rules do. A rule written for one urgent project ("contractors may reach the build server from any device") outlives the project. Review rules on a schedule, attach an owner and an expiry to each exception, and prefer a few broad roles with clear rules over many personal ones.

"Zero trust" as a label. Because the phrase has no trademark, it gets attached to almost anything with a login page. A useful test is to ask the NIST questions of any product: does it decide per resource and per session, does it use device state, does it re-evaluate, does it log the decision, and can a resource be reached without passing through it? A VPN with MFA is a better VPN, not zero trust.

Legacy systems. Some applications cannot sit behind a proxy: old protocols, hard-coded addresses, devices with no way to install an agent. NIST's enclave model exists for them. Put a gateway in front of the whole group, keep the group small, and accept that inside it, the old rules still apply.

It does not stop an authorized user. If the policy says the finance clerk may read payroll, malware running as the finance clerk on a healthy-looking laptop can read payroll too. The lateral-movement graph made this plain. Zero trust shrinks what any one compromise can reach and makes every access a logged decision; detecting misuse of legitimate access is still the job of monitoring (Chapter 17) and response (Chapter 18).

Go deeper: how the UK NCSC phrases it

The UK National Cyber Security Centre's zero trust architecture guidance puts the same advice as a short set of design principles: know your architecture, including users, devices, services and data; know each user, service and device identity; assess user behavior, device and service health; use policies to authorize requests; authenticate and authorize everywhere; focus monitoring on users, devices and services; don't trust any network, including your own; and choose services designed for zero trust. The last one is a quiet warning about retrofitting: some systems are much easier to replace than to wrap.

Where this comes from

Sources