π‘οΈ Azure SQL Database allows ingress from 0.0.0.0/0 (ANY IP)π’
- Contextual name: π‘οΈ Database allows ingress from 0.0.0.0/0 (ANY IP)π’
- ID:
/ce/ca/azure/sql-database/disable-database-allows-ingress-from-any-ip-rule - Tags:
- π’ Policy with categories
- π’ Policy with type
- π’ Production policy
- Policy Type:
COMPLIANCE_POLICY - Policy Categories:
SECURITY
Logicβ
- π§ prod.logic.yamlπ’
Similar Policiesβ
- Cloud Conformity: Check for Unrestricted SQL Database Access
- Internal:
dec-x-0289e9c9
Similar Internal Rulesβ
| Rule | Policies | Flags |
|---|---|---|
| βοΈ dec-x-0289e9c9 | 1 |
Descriptionβ
Descriptionβ
Ensure that no SQL Databases allow ingress from 0.0.0.0/0 (any IP).
Rationaleβ
Azure SQL Server includes a firewall to block access to unauthorized connections. More granular IP addresses can be defined by referencing the range of addresses available from specific datacenters.
By default, for a SQL server, a firewall exists with StartIp of 0.0.0.0 and EndIP of 0.0.0.0 allowing access to all Azure services.
Additionally, a custom rule can be set up with StartIp of 0.0.0.0 and EndIP of 255.255.255.255 allowing access from any IP over the Internet.
In order to reduce the potential attack surface for a SQL server, firewall rules should be defined with more granular IP addresses by referencing the range of addresses available from specific datacenters.
If
Allow Azure services and resources to access this serveris checked, this allows resources outside the subscription or tenant boundary, within any Azure region, to bypass the SQL Server network ACL on the public endpoint. A malicious attacker can launch a SQL server password brute-force attack by creating a virtual machine in any Azure subscription or region, outside the subscription boundary where the SQL Server is located.... see more
Remediationβ
Remediationβ
From Azure Portalβ
- Go to
SQL servers.- For each SQL server:
- Under
Security, clickNetworking.- Uncheck
Allow Azure services and resources to access this server.- Set firewall rules to limit access to only authorized connections.
- Click
Save.From Azure CLIβ
Disable the default firewall rule
Allow access to Azure services:az sql server firewall-rule delete \
--resource-group {{resource-group-name}} \
--server {{sql-server-name}} \
--name "AllowAllWindowsAzureIps"Remove a custom firewall rule:
az sql server firewall-rule delete \
--resource-group {{resource-group-name}} \
--server {{sql-server-name}} \
--name {{firewall-rule-name}}Create a firewall rule:
az sql server firewall-rule create \
--resource-group {{resource-group-name}} \
--server {{sql-server-name}} \
--name {{firewall-rule-name}} \
--start-ip-address "{{ip-address-other-than-0-0-0-0}}" \
--end-ip-address "{{ip-address-other-than-0-0-0-0-or-255-255-255-255}}"Update a firewall rule:
... see more