Infrastructureegresssecurity

Egress Security

Security also asks what a compromised service can call outward; unrestricted egress enables SSRF, command-and-control and exfiltration.

▶ Run the labFollow the failure

Frame the problem

Security starts with a concrete asset, attacker capability and trust crossing.

Asset
Secrets and data reachable from a compromised workload.
Attacker & capability
An attacker who controls a request path or gains code execution in a service.
Trust boundary
Workload → internal services and internet destinations
AssetThreatAttack SurfaceTrust BoundaryVulnerabilityExploit PathImpactMitigationDefense in DepthResidual Risk

Why the system fails

Every workload can reach arbitrary addresses and protocols, so stolen data and callbacks leave without crossing another policy decision.

The important question is not “what is Egress Security?” but “which assumption let untrusted data or an over-scoped identity cross workload → internal services and internet destinations?” Trace the decision at the boundary, then constrain what can happen after the first control fails.

Design the control in layers

Start with the control closest to the interpretation or privilege boundary: Allow only required destinations and protocols Then add a control that reduces blast radius and telemetry that proves the decision was enforced.

The resulting design is not labelled secure. Record the identified controls, the known failure paths, the remaining exposure, and the evidence you would need during an incident.

PreventDetectRecover
Allow only required destinations and protocols · Use controlled proxies for fetch workloads · Remove sensitive credentials from internet-facing servicesNovel destinations, DNS anomalies and unusual outbound volumeContain the affected identity or component, scope impact from audit evidence, and preserve a regression test.

Key points

  • Asset: Secrets and data reachable from a compromised workload.
  • Boundary: Workload → internal services and internet destinations
  • Primary control: Allow only required destinations and protocols
  • Detection signal: Novel destinations, DNS anomalies and unusual outbound volume
  • Always ask what limits damage when the primary control fails.

Boundary control exercise

This lesson uses the shared boundary-control exercise.

Boundary control check
Untrusted input / identity
Trust boundary
Privileged asset
Prevention may fail silently.

Follow the attack

Safe conceptual simulation: capability → missing control → crossed boundary → asset impact.

  1. 1
    Attacker starts with: An attacker who controls a request path or gains code execution in a service.
  2. 2
    Every workload can reach arbitrary addresses and protocols, so stolen data and callbacks leave without crossing another policy decision.
  3. 3
    The weak or missing boundary control is crossed: Workload → internal services and internet destinations
  4. 4
    Impact: Credential theft, internal probing and data exfiltration.
Blast radius
  • Credential theft, internal probing and data exfiltration.

Defend, detect, recover

One prevention is a single point of security failure. Layer it and make failure observable.

Prevent
  • • Allow only required destinations and protocols
  • • Use controlled proxies for fetch workloads
  • • Remove sensitive credentials from internet-facing services
Detect
  • • Novel destinations, DNS anomalies and unusual outbound volume
Respond & recover
  • • Contain the affected identity or component.
  • • Scope access from audit evidence.
  • • Fix the boundary and add a regression test.
Residual risk
  • • Misconfiguration and new access paths can bypass the intended control.
  • • A privileged insider or compromised control plane may still reach the asset.

Misconceptions

Claim
“A single allow only required destinations and protocols control makes this safe.”
Reality
One control changes risk; it does not erase it. Design prevention, detection, recovery, and blast-radius limits together.