MCADDF

[MISCONFIG-012]: SQL Database Firewall Disabled

Metadata

| Attribute | Details | |—|—| | Technique ID | MISCONFIG-012 | | MITRE ATT&CK v18.1 | T1526 – Cloud Service Discovery (misconfig enabling discovery and access); T1530 – Data from Cloud Storage Object (data theft) | | Tactic | Initial Access / Collection | | Platforms | Entra ID / Azure (Azure SQL Database, SQL Managed Instance) | | Severity | Critical | | Technique Status | ACTIVE | | Last Verified | 2026-01-10 | | Affected Versions | Azure SQL logical servers and managed instances with public endpoint and permissive firewall (0.0.0.0/0 or Allow Azure services) | | Patched In | N/A – configuration-based; mitigated via proper firewall, private endpoints, and network isolation | | Author | SERVTEPArtur Pchelnikau |


2. EXECUTIVE SUMMARY

Operational Risk

Compliance Mappings

| Framework | Control / ID | Description | |—|—|—| | CIS Benchmark | Azure Foundations controls for SQL firewall | Require restricted IP ranges and disallow 0.0.0.0/0 and AllowAllWindowsAzureIps. | | DISA STIG | Database SRG network controls | Limit remote connections and enforce network access control lists. | | CISA SCuBA | Database and PaaS access restrictions | Limit exposure of cloud databases to the internet. | | NIST 800-53 | AC-4, SC-7 | Boundary protection and system interconnections. | | GDPR | Art. 32 | Data protection by design including network-level controls. | | DORA | Art. 9 | ICT risk management including network and access segmentation. | | NIS2 | Art. 21 | Network and information system security, including access controls. | | ISO 27001 | A.8.20, A.8.21 | Network security and segregation. | | ISO 27005 | Risk Scenario | Database exposed to the internet leading to bulk data breach.

3. TECHNICAL PREREQUISITES

Supported Versions:

4. ENVIRONMENTAL RECONNAISSANCE

Azure CLI Recon

# List all SQL servers in a subscription
az sql server list -o table

# List firewall rules for each server
az sql server firewall-rule list \
  --resource-group <rg> \
  --server <server-name> -o table

What to Look For:

PowerShell Recon

Get-AzSqlServer | ForEach-Object {
  Get-AzSqlServerFirewallRule -ResourceGroupName $_.ResourceGroupName -ServerName $_.ServerName |
    Select-Object ServerName=@{n='Server';e={$_.ServerName}}, FirewallRuleName, StartIpAddress, EndIpAddress
}

What to Look For:

5. DETAILED EXECUTION METHODS AND THEIRS STEPS

METHOD 1 – Exploiting Open SQL Firewall from the Internet

Supported Versions: Azure SQL Database with public endpoint and 0.0.0.0/0 or broad rules.

Step 1: Discover Open SQL Endpoints

Objective: Use internet scanning or OSINT to identify Azure SQL servers with open firewall.

Step 2: Brute-Force or Spray Credentials

Objective: Attempt login using known or guessed SQL logins.

Command (example using sqlcmd):

sqlcmd -S tcp:<server>.database.windows.net,1433 -U <login> -P <password> -d master -Q "SELECT @@version;"

Expected Output:

OpSec & Evasion:

METHOD 2 – Lateral Abuse via “Allow Azure Services” Rule

Supported Versions: Any Azure SQL server with Allow Azure services and resources to access this server enabled.

Step 1: Compromise Another Azure Resource

Step 2: Connect from Compromised Resource

6. ATTACK SIMULATION & VERIFICATION (Atomic Red Team)

No dedicated Atomic test exists solely for Azure SQL firewall misconfiguration; use credential stuffing or SQL data exfiltration tests against a test database reachable via open firewall to validate detection and logging.

7. TOOLS & COMMANDS REFERENCE

8. SPLUNK DETECTION RULES

Rule 1: SQL Database Allows Ingress from Any IP

9. MICROSOFT SENTINEL DETECTION

Query 1: Azure SQL Servers with Open Firewall Rules (Azure Resource Graph)

resources
| where type == "microsoft.sql/servers/firewallrules"
| extend startIp = tostring(properties.startIpAddress), endIp = tostring(properties.endIpAddress)
| where startIp == "0.0.0.0" or endIp == "255.255.255.255"

Query 2: Brute-Force Activity Against Azure SQL

Use AzureDiagnostics or SQLSecurityAuditEvents to detect repeated failed logins from varied IPs towards a single server.

10. WINDOWS EVENT LOG MONITORING

Not directly applicable (PaaS service), but on self-hosted SQL Servers in IaaS VMs, use Windows Firewall and Event Log monitoring similar to endpoint guidance.

11. SYSMON DETECTION PATTERNS

For IaaS SQL Servers:

12. MICROSOFT DEFENDER FOR CLOUD

Key built-in recommendations:

Use these recommendations to identify and remediate misconfigured servers.

13. MICROSOFT PURVIEW (UNIFIED AUDIT LOG)

For M365-integrated apps using Azure SQL as backend, ensure that privileged access and app credential usage is audited and correlated with SQL access patterns.

14. DEFENSIVE MITIGATIONS

Priority 1: CRITICAL

Priority 2: HIGH

Validation Command (Verify Fix)

az sql server firewall-rule list --resource-group <rg> --server <server> -o table

# Ensure no rules with 0.0.0.0 or 255.255.255.255

15. DETECTION & INCIDENT RESPONSE

Indicators of Compromise (IOCs)

Forensic Artifacts

Response Procedures

  1. Immediately tighten firewall rules to only known IP ranges or private endpoints.
  2. Rotate credentials and revoke compromised connection strings.
  3. Review SQL audit logs for data exfiltration and privilege escalation.
  4. Notify regulators and affected parties if sensitive data exposure is confirmed.
Step Phase Technique Description
1 Initial Access Exposure of SQL endpoint Public SQL endpoint with weak firewall.
2 Credential Access Password spray / token theft Attacker obtains SQL credentials.
3 Current Step MISCONFIG-012 – SQL Database Firewall Disabled Firewall allows attacker to connect from untrusted networks.
4 Collection SQL data export SELECT and bulk export of sensitive tables.
5 Exfiltration & Impact Data breach and extortion Data exfiltration and regulatory impact.

17. REAL-WORLD EXAMPLES

Example 1: Cloud Database Breaches via Open Firewalls

Example 2: CSPM Findings Across Enterprises