More Info:
Ensure that Microsoft Azure network security groups (NSGs) do not allow unrestricted access (i.e. 0.0.0.0/0) on TCP port 3306 in order to protect against malicious actors and significantly reduce the attack surface. TCP port 3306 is used by the MySQL Database Server, a popular open-source Relational Database Management System (RDBMS) server.Risk Level
HighAddress
SecurityCompliance Standards
SOC2, GDPR, ISO27001, HIPAA, NISTCSF, PCIDSS, FedRAMPTriage and Remediation
- Remediation
Remediation
Using Console
Using Console
To remediate the unrestricted MySQL database access issue in Azure, please follow the below steps:
- Log in to the Azure portal (https://portal.azure.com/).
- Navigate to the Azure Database for MySQL service.
- Click on the MySQL server that has the unrestricted access issue.
- In the left-hand menu, click on “Firewalls and virtual networks”.
- Under “Firewall rules”, click on “Add client IP”.
- This will automatically add a firewall rule to allow only your IP address to access the MySQL database.
- If you need to grant access to a specific IP range, click on “Add existing virtual network” and select the virtual network and subnet that you want to allow access from.
- Save the changes by clicking on “Save”.
Using CLI
Using CLI
The remediation steps for Unrestricted MySQL Database Access on Azure using Azure CLI are as follows:Step 1: Identify the MySQL Database Server that has unrestricted access.Step 2: Get the details of the MySQL Database Server.Step 3: Update the firewall rules for the MySQL Database Server to restrict access to specific IP addresses or IP ranges.Note: Replace the Note: Replace the Note: Replace the
<resource-group-name>, <mysql-server-name>, <firewall-rule-name>, <start-ip-address>, and <end-ip-address> with the appropriate values.Step 4: Delete the existing firewall rule that allows unrestricted access.<resource-group-name>, <mysql-server-name>, and <firewall-rule-name> with the appropriate values.Step 5: Verify that the firewall rules have been updated successfully.<resource-group-name> and <mysql-server-name> with the appropriate values.By following these steps, you can remediate the Unrestricted MySQL Database Access issue on Azure using Azure CLI.Using Python
Using Python
To remediate the unrestricted MySQL database access issue in Azure using Python, you can follow the below steps:Step 1: Install the Azure SDK for Python using pipStep 2: Connect to the Azure account using the Azure SDK for PythonStep 3: Get the list of MySQL servers in the Azure accountStep 4: Save the Python script and run it to remediate the unrestricted MySQL database access issue in Azure.Note: This Python script will remove all the firewall rules that allow unrestricted MySQL database access. If you have specific IP addresses that need access, you will need to modify the script accordingly.

