Azure SQL Firewall Allows Broad Access
The Azure SQL server's firewall admits connections from the whole internet, or from all of Azure, so its database logins are exposed to password attacks from anywhere.
| Severity | High |
| CVSS 3.1 | 8.1 CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H Open in the calculator |
| CVSS 4.0 | 9.2 CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N Open in the calculator |
| CWE | CWE-668: Exposure of Resource to Wrong Sphere |
| OWASP Top 10 | A01:2025 Broken Access Control |
| MITRE ATT&CK | T1110 Brute Force, T1213.006 Databases |
| Category | Security Misconfiguration |
Description
An Azure SQL Database logical server accepts connections on its public endpoint, a host name under database.windows.net on TCP 1433, only from addresses its firewall allows. Server-level IP rules apply to every database on the server, and database-level rules apply to a single database. The finding applies where the rules admit far more than the clients that need access: a rule covering 0.0.0.0 to 255.255.255.255, very large address ranges, or the setting Allow Azure services and resources to access this server, which is stored as a rule from 0.0.0.0 to 0.0.0.0 and admits connections from any address inside Azure, including resources in other organisations' subscriptions.
Anyone on the internet, or anyone with an Azure resource where all of Azure is allowed, can then attempt to log in to the server. SQL authentication logins with weak or reused passwords can be guessed, and credentials leaked from connection strings in code, configuration files or compromised workstations can be used from anywhere. A successful login gives the attacker whatever that login can do, which for the server administrator or an application account is commonly full read and write access to the data. The impact is lower where only Microsoft Entra authentication is allowed, passwords are strong and logins have limited rights, but the firewall then provides no defence in depth.
Broad rules are usually added for convenience during development, for clients with changing addresses, or to let Azure services connect without private networking. The same pattern is found on the public endpoint of Azure SQL Managed Instance and on the firewalls of Azure Database for PostgreSQL and MySQL.
It is identified by reviewing the server and database firewall rules, or the sys.firewall_rules and sys.database_firewall_rules views, and confirmed by connecting from an unrelated address: a refused connection returns an error stating that the client's address is not allowed, while a permitted one reaches the login stage.
Remediation
- Remove rules that cover the whole internet or very large ranges, and allow only the specific addresses that need direct access, reviewing both server-level and database-level rules.
- Prefer private connectivity: reach the server through a private endpoint and disable public network access, or use virtual network rules for clients inside Azure.
- Switch off Allow Azure services and resources to access this server unless a specific service needs it and cannot use private connectivity.
- Enable Microsoft Entra-only authentication, so that SQL authentication logins cannot be used, and give applications managed identities rather than passwords.
- Require a minimum TLS version of 1.2, and enable Microsoft Defender for SQL to alert on brute-force attempts and unusual access.
For example, broad rules can be removed with Transact-SQL, the first statement in the master database for a server-level rule and the second in the user database for a database-level rule:
Confirm the fix by listing the firewall rules again and by attempting a connection from an address outside the allowed ranges, expecting it to be refused.
References
Add This Finding to Your Library
In Pental this write-up is in Settings, Library. Add to my library copies it into your own, rated in your firm's CVSS version, ready to put in your own words.
Free trialYour trial starts when your portal goes live, not when you sign up, so the time you spend setting up does not count. · No card required
Only need the reporting? Our reporting tool is free and open source, with the same library.