Skip to main content

Default Outbound Allow in Azure NSGs Enables Data Exfiltration

Medium severityMicrosoft Azure About 20 minutes to fixGenerated 4 Aug 2026

Overview

A hardened-looking Azure NSG can still leave a silent outbound exfiltration path open, because the platform's default outbound allow rule survives unless explicitly overridden.

At a glance

Symptom
A workload protected by an Azure Network Security Group with tightly restricted inbound rules can still send data outbound to arbitrary internet destinations without…
Likely cause
Azure Network Security Groups apply a fixed set of default rules in each direction that remain active unless a lower-priority user-defined rule explicitly overrides…
Impact
A compromised workload behind this NSG configuration retains an unmonitored, unrestricted path to exfiltrate data or reach command-and-control infrastructure over the internet, even though the NSG appears hardened…
Verification signal
Validation succeeds only when the effective rule list shows the new deny rule evaluated ahead of the default outbound allow rule and every required application dependency still functions.Re-run…
Safe correction
Close the gap by adding an explicit, higher-priority outbound rule that denies unrestricted internet-bound traffic from the affected subnet or interface, then layering a specific allow-list for destinations…
Rollback or recovery
Rollback removes only the specific deny rule that this correction added, restoring the pre-change effective rule set captured during diagnosis.If the new rule blocks a legitimate dependency missed…

Symptom

A workload protected by an Azure Network Security Group with tightly restricted inbound rules can still send data outbound to arbitrary internet destinations without triggering any alert unless flow logs and alerting have been set up separately. Engineers reviewing the NSG in the Azure portal see only explicit inbound allow rules for known administrative ranges and an inbound deny for everything else, which reads as a fully locked-down boundary. When outbound flow logs or a compromised-host investigation are checked later, the same workload is found to have open outbound connectivity to internet hosts that were never approved, with no NSG rule blocking it. NSG rules do not log or alert on their own; allowed flows are recorded only if flow logs are enabled.

False Assumption

The team reviewing the NSG assumes that restricting inbound access is equivalent to securing the whole network boundary, and that anything not explicitly allowed inbound is also blocked outbound. This treats the rule set as symmetrical, when it is not. Reviewers sign off the NSG as hardened after checking only the inbound rule list, without separately checking the outbound rule set or the platform’s default outbound behaviour.

Root Cause

Azure Network Security Groups apply a fixed set of default rules in each direction that cannot be deleted or edited, but any user-defined rule (priorities 100 to 4096) has a lower priority number, is evaluated first and so takes precedence over them. On the outbound side, the default set includes a broad allow rule for internet-bound traffic, evaluated ahead of the final default deny. If no custom outbound rule is added, that default allow rule remains the effective outbound policy, regardless of how restrictive the inbound rule set is. Because the portal and CLI list custom rules separately from default rules, a reviewer who checks only the custom rule list never sees the default outbound allow rule doing the real work. Microsoft documents the outbound defaults as AllowVnetOutBound (priority 65000), AllowInternetOutBound (65001) and DenyAllOutBound (65500).

Azure NSG default rule tiers (custom rules at priorities 100 to 4096 are evaluated before all of these)
Rule tierDirectionDefault effect
Allow VNet trafficInbound / OutboundAllows traffic within the virtual network
Allow Azure Load BalancerInboundAllows load balancer health probes
Allow Internet outboundOutboundAllows all outbound traffic to the internet unless overridden
Deny allInbound / OutboundDenies everything else at the lowest priority

Impact

A compromised workload behind this NSG configuration retains an unmonitored, unrestricted path to exfiltrate data or reach command-and-control infrastructure over the internet, even though the NSG appears hardened on inbound inspection alone. The exposure does not depend on any inbound misconfiguration; it persists purely because outbound traffic was never independently reviewed, so the blast radius extends to every workload on the affected subnet or network interface that inherits the same default outbound posture.

Diagnosis

Confirm the gap by listing the effective security rules applied to the affected network interface, not just the custom rules configured on the NSG object, since the effective list includes the platform defaults that a casual review misses.

  • List the effective rules on the NIC to see every rule actually being evaluated, including default rules.
  • Separately list the custom rules on both the subnet-level and NIC-level NSGs, where both exist, to check whether an outbound restriction exists anywhere in the chain.
  • Record the full effective-rules output before making any change; this becomes the rollback baseline.

Correction

Close the gap by adding an explicit, higher-priority outbound rule that denies unrestricted internet-bound traffic from the affected subnet or interface, then layering a specific allow-list for destinations the workload genuinely needs.

Build the destination allow-list first wherever possible, covering required package repositories, telemetry endpoints, update services and partner APIs, before applying the deny rule, so the correction does not convert a silent security gap into a silent outage. The Internet service tag also covers Azure’s own public endpoints, so allow the service tags the workload depends on (for example AzureMonitor, Storage or AzureActiveDirectory), and apply the change to one test subnet or NIC first, in a change window, before any NSG shared by other workloads.

For example, with the allow rules at priorities below 4000: az network nsg rule create --resource-group <rg> --nsg-name <nsg> --name deny-internet-outbound --priority 4000 --direction Outbound --access Deny --protocol '*' --destination-address-prefixes Internet --destination-port-ranges '*'. The baseline and validation command is az network nic list-effective-nsg --resource-group <rg> --name <nic>, which needs the VM to be running.

Validation

Validation succeeds only when the effective rule list shows the new deny rule evaluated ahead of the default outbound allow rule and every required application dependency still functions.

Re-run the effective-rules command against the same NIC used for diagnosis and confirm the new rule appears above the default tier in evaluation order. Exercise the workload’s known outbound dependencies and confirm they still succeed, while a connection attempt to an arbitrary, non-allow-listed external endpoint from the same host is refused or times out.

Rollback

Rollback removes the specific deny rule that this correction added: az network nsg rule delete --resource-group <rg> --nsg-name <nsg> --name deny-internet-outbound. The allow rules added beforehand stay unless you delete them too, so allow for them when comparing with the pre-change baseline captured during diagnosis.

If the new rule blocks a legitimate dependency missed during allow-list preparation, delete the deny-internet-outbound rule immediately, re-run the effective-rules command to confirm the environment matches the saved pre-change baseline apart from any allow rules you kept, and re-test the previously failing dependency before treating the rollback as complete. Do not leave the workload in a partially-rolled-back state.

Prevention

Treat outbound rule review as a mandatory part of every NSG hardening exercise, not an optional follow-up to inbound restrictions. Build an explicit outbound rule set into subnet and NIC-level NSG templates from the start, so new workloads never rely on the platform default outbound allow rule by omission. Include an effective-rules check, covering both inbound and outbound and both subnet and NIC levels where applicable, in any change or audit process that claims a workload’s network boundary has been hardened.

3

Apply the safer control

Before you change production

Confirm the affected scope, export the current configuration, and test the replacement control in a non-production environment first.

Fix commands and configuration

az network nsg rule create --resource-group <rg> --nsg-name <nsg> --name deny-internet-outbound --priority 4000 --direction Outbound --access Deny --protocol '*' --destination-address-prefixes Internet --destination-port-ranges '*'
az network nic list-effective-nsg --resource-group <rg> --name <nic>
az network nsg rule delete --resource-group <rg> --nsg-name <nsg> --name deny-internet-outbound
4

Verify, roll back or escalate

Verify

Validation succeeds only when the effective rule list shows the new deny rule evaluated ahead of the default outbound allow rule and every required application dependency still functions.Re-run the effective-rules command against the same NIC used for diagnosis and confirm…

Rollback

Rollback removes only the specific deny rule that this correction added, restoring the pre-change effective rule set captured during diagnosis.If the new rule blocks a legitimate dependency missed during allow-list preparation, delete the named rule immediately, re-run the effective-rules command…

Escalate

Escalate when the blast radius is uncertain, the control cannot be tested safely, or remediation requires an outage or security exception.

The KBY Brief

Fixed? Get the next one before it hits you: The KBY Brief

Practical fixes for the systems you run, by email about twice a week. Unsubscribe at any time.

About this page

Credited to

Dates

Published

Last updated

Corrections

No corrections are listed for this page. Some review sweeps corrected pages without naming each one; those are in the corrections log.

Was this useful?

Reports go to the site owner and are used to correct pages. Corrections are listed at /corrections.

After remediation

Further reading stays below the corrective workflow and is selected by platform, category and shared technical keywords.

Discover more

Connected KBY resources

Default Outbound Allow in Azure NSGs Enables Data Exfiltration