Defense control

Network / Egress Restrictions

How deterministic reachability controls outside the model limit which destinations, protocols, ports and network paths agent workloads and tools can reach. A permitted path is only reachability: not permission to act and not permission for particular data to cross it.

By Norbert HofmannPublished: 2026-09-27Last reviewed: 2026-09-27Level: AdvancedAudience: Security Engineers, Developers, AI Engineers
Control family
Information flow and action controls
Control type
Preventive / limiting
Enforcement
Deterministic, at network enforcement points outside the model
Core question
Does a network path from this workload to this destination, protocol and port exist
Level
Advanced
Table of contents

Security Objective

Network and egress restrictions constrain which destinations, protocols, ports and network paths agentic components, tools, sandboxes and workloads can reach, regardless of what the model intends. Model influence must not be able to create arbitrary network reach.

Outbound connectivity for protected agent workloads should be deny by default, brokered through enforceable boundaries and limited to explicitly configured destinations and protocols.

Ownership Boundaries

Four separate questions
QuestionOwning controlRelation to egress
May this principal or tool perform this actionAgent authorizationIndependent; an authorized call does not open arbitrary sockets
May data with this lineage and classification reach that sinkInformation flow controlIndependent; an allowed destination does not accept arbitrary data
Does a network path to that destination and protocol existNetwork / egress restrictionsThis page
Which tools, credentials and network capabilities exist at allLeast privilegeSets the capability budget egress enforces at the network layer
Does a chain introduce a new destinationTool-chain analysisCan flag the sequence; egress makes the reachability decision

Egress is not data loss prevention. It decides where traffic can go, not what the traffic may contain.

Threat Model

Influenced model behavior, from direct input, web content, tool output or a sub-agent result, may propose a request to a destination the task never needed: an external upload host, an internal administration plane or an infrastructure service. The concern is that the runtime can actually reach it.

01
PatternUnapproved external destination

A model-proposed or content-supplied host outside policy.

02
PatternRedirect to a new host

An allowed first hop that points onward to a different destination.

03
PatternResolution into a denied class

A name that resolves to loopback, link-local, metadata or management networks.

04
PatternInternal sensitive services

East-west targets the workload has no reason to reach.

05
PatternAlternate protocol or port

Reach beyond the protocol and port the destination is approved for.

06
PatternDirect-socket bypass

Runtime traffic that avoids the brokered enforcement point.

A blocked destination does not prove malicious intent. It only proves the attempted path was outside current network policy.

Reachability Is a Separate Permission

Having a tool, or having a tool call authorized, does not imply that arbitrary outbound sockets or arbitrary URLs are allowed. Reachability is granted per workload, destination identity, protocol and port, and is checked where connections are made.

Deny-by-Default Egress

For protected agent workloads, outbound traffic is denied unless an explicit, scoped, reviewable exception allows it. NIST SP 800-53 Rev. 5 control enhancement SC-7(5) describes denying network traffic by default and allowing by exception at managed interfaces; this page applies that general principle to agent workloads.

Fail closed when destination identity cannot be resolved or policy cannot be evaluated in protected workflows.

Authoritative Destination Facts

The authoritative destination comes from fully parsed and resolved application-side connection facts: scheme, canonical host or service identity, resolved address and network class, port and, where a gateway enforces it, path template or API operation.

Trust Model

Proposal, resolution, policy decision and connection
UntrustedModel proposes a destination
SystemApplication resolves service or URL
SystemEgress policy decision
SystemEnforcement point
SystemConnection and result evidence

URLs returned by tools, retrieved documents, webpages, messages or sub-agents remain variable content. They never become reachable merely because a trusted connector returned them.

Destination Classes and Service Identities

Classify destinations: approved first-party services, approved third-party services, internal sensitive services, infrastructure-only networks and unknown. Policies refer to classes and exact service identities, not to whatever string appears in a request.

Unknown or unclassifiable destinations are denied in protected workflows.

Application-Owned Service IDs vs Arbitrary URLs

Generic model-controlled URL fetchers are high risk: they turn any string in context into a potential destination. Prefer application-owned service identifiers, such as inventory-read, mapped to fixed hosts and bounded endpoint templates. The model selects a service ID and parameters; the application builds the connection.

URL Parsing and Canonicalization

Parse URLs with a maintained library, canonicalize host and port, and compare the parsed result against policy. Regex-only validation on the raw string is fragile. Evaluate the same parsed representation the client will actually use, at the final connection point rather than only in UI or input validation.

DNS Resolution and Rebinding-Resistant Enforcement

DNS resolution must not silently widen reach. A name that was checked once can later resolve to a different address, including an internal or infrastructure address. Enforce policy on the actual resolved destination and network class, ideally in a controlled resolver, proxy or gateway that both resolves and connects, so the checked address is the connected address.

The OWASP SSRF Prevention Cheat Sheet discusses this destination-confusion risk and recommends validating all resolved addresses. Re-evaluate when resolution changes meaningfully.

Redirect Re-Evaluation

Every redirect is a new destination decision. An initially allowed URL must not transitively authorize a later host. Either disable automatic redirects in clients that do not need them, or re-run the full parse, resolve and policy check for each hop and record REDIRECT_DESTINATION_DENIED when a hop fails.

Protocol and Port Restrictions

Restrict protocols and ports, not only hostnames. A destination allowed for HTTPS on 443 does not imply arbitrary TCP or UDP, alternate ports or other protocols. Deny with PROTOCOL_NOT_ALLOWED or PORT_NOT_ALLOWED.

TLS and Server Identity

TLS and server identity validation stay mandatory on allowed paths. Egress policy must never turn certificate validation off, and an identity mismatch is reported as TLS_IDENTITY_MISMATCH rather than silently accepted. Where a gateway terminates TLS, it takes over validation toward the destination.

Internal and East-West Reach

Egress applies at the agent or workload boundary, not only toward the public internet. Internal is not automatically trusted or reachable. Administration planes, sensitive databases, management networks and other east-west services the workload does not need should be unreachable from it.

Loopback, Link-Local, Metadata and Management Planes

Block or segregate destination classes such as loopback and local services, link-local ranges including cloud metadata services, private management ranges and other infrastructure-only networks unless a workload explicitly needs them. Deny with NETWORK_CLASS_DENIED. These classes often hold credentials or control functions the agent should never touch.

Brokered Egress Architecture

Route outbound traffic from protected workloads through an enforcement point that resolves, decides, connects and logs. Options include an egress proxy or gateway, a service mesh or sidecar, host or container network policy, cloud firewall or security policy, or an application gateway. The property matters, not the product: one attributable decision per connection, enforced where the connection is made.

Preventing Direct-Socket Bypass

Agent runtimes should not have an unrestricted direct-socket path around the brokered control. Block direct outbound traffic at the host, container or network layer so the broker is the only route, and alert on DIRECT_EGRESS_BYPASS attempts. Where direct access is intentionally needed, scope it explicitly.

Per-Tool and Per-Workload Egress Policies

Give each tool or workload its own policy tied to its identity, so a document fetcher, an inventory reader and a notification sender do not share one broad allowlist. Every decision should be attributable to the workload, tool or service identity and, where possible, to task, run and call IDs.

Webhooks, Callbacks and Tool-Supplied Destinations

Webhook targets, callback URLs and destinations supplied in tool output or API responses are still destinations. They remain variable content and go through the same parse, resolve and policy steps before use.

Relationship to Information Flow Control

Information flow control decides what data may traverse a path; egress decides whether the path exists. NIST SP 800-53 AC-4 addresses information flow enforcement generally and is cited here only to mark that boundary. Each control can deny independently.

Relationship to Agent Authorization

Agent authorization decides whether a fully resolved action may execute. An authorized send still fails if the destination is unreachable, and a reachable destination does not make an action authorized.

Relationship to Least Privilege

Least privilege decides which tools, credentials and network capabilities a workload has at all. Egress restrictions enforce the network part of that budget at connection time, so a capability that was never granted cannot be exercised by influenced behavior.

Relationship to Tool-Chain Analysis

Tool-chain analysis may identify a sequence that introduces a new destination. Egress restrictions make the actual reachability decision at the network boundary. A chain finding never opens a path, and an allowed path never clears a chain finding.

Policy Decision and Enforcement Points

The allow or deny decision is deterministic. A model-assisted classifier is not the egress decision point; semantic risk signals may inform a separate response policy but never grant reach. Response and telemetry can record, alert, restrict or pause, and network exceptions are never granted dynamically by model output.

Keep reachability, authorization, flow classification, provenance, chain findings and execution evidence separate. No blended trust score.

Telemetry and Reason Codes

Egress decision record fields

  • Workload or agent identity and tool or service ID
  • Initiating principal and task, run and call correlation IDs
  • Scheme or protocol, host or service identity and port
  • Resolved address and network class where relevant, and the resolver or proxy used
  • Destination class and path template or API operation if enforced at a gateway
  • Redirect hop number and TLS identity result
  • Policy version, decision and reason code
  • Connection and result evidence
01
StateProposed

The model suggested a destination. No connection was attempted.

02
StateConnection attempted / submitted

The client or broker tried to connect.

03
StateConnection established

A network path was opened. This does not prove data moved.

04
StateRequest succeeded, failed or unobserved

Result evidence, or its explicit absence.

Example reason codes, as engineering guidance: DESTINATION_NOT_ALLOWED, PROTOCOL_NOT_ALLOWED, PORT_NOT_ALLOWED, NETWORK_CLASS_DENIED, REDIRECT_DESTINATION_DENIED, DESTINATION_UNRESOLVED, DIRECT_EGRESS_BYPASS, TLS_IDENTITY_MISMATCH and POLICY_EXCEPTION_USED. Correlate broker and workload logs by task, run and call ID.

Exceptions and Change Control

Exceptions are short lived and carry an owner, reason, exact scope and expiry. Broad permanent wildcards are not a default. Keep policy as reviewable, versioned configuration. Separate development and production policies without opening production for convenience. Domain-only and IP-only lists both have limits: shared CDN addresses make static IP lists brittle, and wildcards or user-controlled subdomains make broad hostname lists risky. Prefer exact service identity plus controlled resolution.

Worked Scenario A: Allowed First-Party Service

A tool needs read-only HTTPS access to inventory-api.internal.example.test:443, represented by service ID inventory-read. Egress policy allows that exact service and path class for this workload. The connection may proceed at the network layer.

This only grants network reach. Action authorization and information flow control still run separately.

Worked Scenario B: External Upload Destination Denied

Influenced model behavior proposes sending a file to upload.outside.example.test. No approved service identity matches, so reach is denied with DESTINATION_NOT_ALLOWED. If the request was only proposed, no connection was attempted and no exfiltration attempt is claimed.

Worked Scenario C: Redirect to an Unapproved Destination Denied

A request to docs.internal.example.test is allowed. The response redirects to collector.outside.example.test. The redirect hop is a fresh destination decision and is denied with REDIRECT_DESTINATION_DENIED. The original allow decision does not carry over.

Worked Scenario D: Internal Management Destination and Callback Denied

The workload proposes reaching admin.internal.example.test, an internal administration destination not in its policy. It is denied with NETWORK_CLASS_DENIED even though it is internal.

Separately, a tool response supplies a callback URL at hooks.partner.example.test. The URL is variable content; it is resolved against policy, has no approved identity for this workload and is denied before use.

What the Scenarios Prove and Do Not Prove

Interpreting the worked scenarios
ScenarioShowsDoes not show
A: allowed serviceReach exists for an exact service identityThat the action is authorized or the data may be sent
B: external uploadUnapproved destinations are unreachableThat exfiltration was attempted or intended
C: redirectEach hop is decided anewThat the first host was malicious
D: internal and callbackInternal and data-supplied destinations get no implicit reachThat the workload was compromised

Testing and Validation

Labelled regression matrix (defensive test classes)
Test classExpected result
Allowed exact destinationAllowed; measures false blocks and utility
Unknown destinationDenied
Alternate protocol or port to an allowed hostDenied
Redirect from allowed to unapproved hostDenied at the redirect hop
Name resolving into a denied network classDenied
Wildcard and subdomain edge casesOnly exact approved identities allowed
Callback or webhook destination supplied as dataEvaluated like any destination
Internal management destinationDenied
Direct socket from the runtimeBlocked and alerted
TLS identity mismatchConnection refused
Unresolvable destination in a protected workflowFails closed

Tests are defensive: they verify the policy, not techniques for evading it.

To practice egress decisions on fictional paths, try the Network / Egress Restrictions lab.

Metrics

Operational measures with separate denominators
MetricDenominator
Egress decision coverageAll protected outbound connection attempts observed
Broker or proxy coverageAll outbound connections from protected workloads
Destination-resolution coverageDecisions requiring resolution
Redirect re-evaluation coverageObserved redirect hops
TLS identity validation coverageEstablished TLS connections on allowed paths
Expected-deny block rateLabelled expected-deny tests
False-block rateLabelled allowed tests
Direct-bypass prevention rateLabelled direct-bypass tests
Unknown-destination fail-closed coverageLabelled unresolvable or unclassified destinations
Exception usage rateAllowed connections
Exception expiry complianceActive exceptions
Reason-code distributionAll deny decisions
Decision and enforcement latencyEvaluated connections
Benign task successLabelled benign tasks

These are operational measures, not proof of security. Do not combine them into one score.

Common Mistakes

Failure patterns
  1. 01
    Treating an allowed path as data permission

    Skipping flow control because the destination is approved.

  2. 02
    Trusting internal destinations

    Leaving admin, metadata and management networks reachable.

  3. 03
    Validating strings, not connections

    Checking the literal URL but not the resolved address or redirects.

  4. 04
    Generic URL fetchers

    Giving influenced behavior arbitrary destinations.

  5. 05
    Broad permanent wildcards

    Exceptions without owner, scope or expiry.

  6. 06
    Bypassable brokers

    Runtimes that can open direct sockets.

  7. 07
    Model-decided reach

    Letting a classifier or model output grant exceptions.

  8. 08
    Inferring transfer from proposal

    Reporting data movement when only a URL was proposed.

Implementation Checklist

Before relying on egress restrictions

  • Protected workloads are deny by default with explicit, scoped exceptions
  • Destinations are application-owned service IDs or bounded templates where feasible
  • URLs are parsed by libraries and checked at the final connection point
  • Resolution happens in a controlled resolver, proxy or gateway
  • Every redirect hop is re-evaluated
  • Protocols and ports are restricted, TLS validation stays on
  • Loopback, link-local, metadata and management networks are denied unless needed
  • Direct-socket bypass is blocked and alerted
  • Decisions are attributable to workload, tool and task, run and call IDs
  • Exceptions have owner, reason, scope and expiry and live in versioned policy
  • Authorization, IFC and least privilege remain independent

Standards and Sources

Standards and guidance referenced

NIST
SP 800-53 Rev. 5 SC-7 Boundary Protection, including SC-7(5), SP 800-53 Rev. 5 AC-4 Information Flow Enforcement (boundary only)
OWASP
SSRF Prevention Cheat Sheet, Top 10 for Agentic Applications 2026: ASI02 Tool Misuse and Exploitation, LLM01:2026 Prompt Injection

Source scope: NIST SC-7 is general boundary-protection guidance; SC-7(5) describes deny by default and allow by exception for network traffic. Neither is specific to AI agents. AC-4 is cited only to mark the boundary to information flow control. The OWASP SSRF Prevention Cheat Sheet is general web-application guidance on destination allowlisting, validation of resolved addresses and redirect handling, not agent-specific guidance. The OWASP agentic list provides risk context for tool misuse; it does not define this control. LLM01:2026 is attack context only. No cited source defines "network / egress restrictions" as an agent-specific control. Service-ID schemas, reason codes, gateway designs and metrics on this page are engineering guidance.

Frequently Asked Questions

Does an allowed destination mean the data may be sent?

No. Information flow control decides what data may cross the path.

Is an internal destination trusted?

No. Internal destinations are reachable only when the workload's policy explicitly allows them.

Does a denied connection prove an attack?

No. It proves the path was outside current policy.

Can a model decide which hosts are allowed?

No. The decision is deterministic; model signals may inform a separate response policy only.

Is a URL from a trusted tool safe to reach?

No. Returned URLs remain variable content and go through policy like any other destination.

Is a domain allowlist enough?

Not alone. Combine exact service identity with controlled resolution, redirect re-evaluation and protocol and port limits.

Does a proposed URL mean a connection happened?

No. Proposed, attempted, established and completed are separate states.

References

  1. NIST SP 800-53 Rev. 5, Security and Privacy Controls for Information Systems and Organizations (SC-7, SC-7(5), AC-4)NIST · StandardReviewed 2026-09-27
  2. Server Side Request Forgery Prevention Cheat SheetOWASP Cheat Sheet Series · GuidanceReviewed 2026-09-27
  3. OWASP Top 10 for Agentic Applications for 2026OWASP GenAI Security Project · Guidance · 2025-12Reviewed 2026-09-27
  4. OWASP GenAI LLM Top 10 2026 (LLM01:2026 Prompt Injection)OWASP GenAI Security Project · GuidanceReviewed 2026-09-27