More Info:
Ensure that no network security groups allow unrestricted inbound access on TCP port 443.Risk Level
CriticalAddress
SecurityCompliance Standards
- APRA CPS 234 (Australia)
- BSI C5 (Germany)
- Brazil LGPD
- CCPA / CPRA (California)
- CIS Critical Security Controls v8
- CMMC 2.0
- CSA Cloud Controls Matrix v4
- DPDPA
- Digital Operational Resilience Act (EU)
- GDPR
- HITRUST CSF
- ISO/IEC 27017
- ISO/IEC 27018
- ISO/IEC 27701
- KSA PDPL
- MAS Technology Risk Management (Singapore)
- MITRE ATT&CK (Cloud)
- NIS2 Directive
- NIST SP 800-171
- NYDFS 23 NYCRR 500
- Reserve Bank of India (RBI) Cyber Security Framework
- Reserve Bank of India (RBI) Master Direction – Information Technology Framework
- SOC2
- SWIFT Customer Security Controls Framework
- Sarbanes-Oxley IT General Controls
- UK NCSC Cyber Assessment Framework
Triage and Remediation
- Remediation
Remediation
Using Console
Using Console
The following are the step-by-step instructions to remediate the unrestricted HTTPS access misconfiguration in Azure using the Azure console:
- Log in to the Azure portal (https://portal.azure.com/).
- Navigate to the resource group containing the virtual machine that needs to be remediated.
- Select the virtual machine that needs to be remediated.
- Click on the “Networking” tab on the left-hand side of the screen.
- Under the “Inbound port rules” section, click on the “Add inbound port rule” button.
- In the “Add inbound security rule” window, enter a name for the rule (e.g., “HTTPS Access”), select “HTTPS” as the service, and set the action to “Deny”.
- Under the “Source” section, select “IP Addresses” and enter the IP address range that needs to be denied access to the virtual machine.
- Click on the “Add” button to add the rule.
- Repeat steps 5-8 to add additional rules as needed for other IP address ranges.
- Once all the necessary rules have been added, click on the “Save” button to apply the changes.
- Verify that the changes have been applied by attempting to access the virtual machine via HTTPS from an IP address that has been denied access. The access should be blocked.
Using CLI
Using CLI
The following are the step-by-step instructions to remediate the unrestricted HTTPS access misconfiguration in Azure using Azure CLI:
-
Open the Azure CLI and login to your Azure account using the command:
-
Once you are logged in, set the appropriate subscription using the command:
-
Next, list all the virtual machines in your subscription using the command:
- Identify the virtual machine that has unrestricted HTTPS access and note its resource group and name.
-
Once you have identified the virtual machine, you need to create a network security group (NSG) and associate it with the virtual machine. Use the following command to create a new NSG:
-
Next, you need to create an inbound security rule to block all traffic on port 443 (HTTPS). Use the following command to create the inbound security rule:
-
Finally, you need to associate the NSG with the virtual machine. Use the following command to associate the NSG with the virtual machine:
Note: Replace
<nic_name>with the name of the network interface card associated with the virtual machine. -
Verify that the NSG has been associated with the virtual machine using the command:
This command should return the details of the network interface card, including the NSG associated with it.
Using Python
Using Python
The following are the step-by-step instructions to remediate the “Unrestricted HTTPS Access” misconfiguration in Azure using Python:
-
First, you need to install the Azure SDK for Python. You can do this by running the following command in your terminal:
- Next, you need to authenticate with Azure. You can do this by creating a Service Principal and then using its credentials to authenticate with Azure. You can follow the instructions here to create a Service Principal: https://docs.microsoft.com/en-us/azure/active-directory/develop/howto-create-service-principal-portal
-
Once you have authenticated with Azure, you can use the Azure SDK for Python to retrieve a list of all the virtual networks in your subscription. You can do this by running the following code:
-
Next, you need to loop through the list of virtual networks and for each virtual network, retrieve a list of all the subnets in that virtual network. You can do this by running the following code:
-
For each subnet, you need to retrieve the network security group (NSG) associated with that subnet. You can do this by running the following code:
-
Finally, you need to update the NSG to deny all inbound traffic to port 443 (HTTPS). You can do this by running the following code:
Using Terraform
Using Terraform
EXAMPLE_RGwith your actualazurerm_resource_groupresource name.EXAMPLE_NSG_NAMEwith the existing NSG name (or use the existing NSG resource you already manage).ALLOWED_SOURCE_CIDR_1/ALLOWED_SOURCE_CIDR_2with the specific CIDR ranges or IPs that should be able to reach port 443.
azurerm_network_security_rule on this NSG that allows:access = "Allow"destination_port_range = "443"(or includes 443 in a range / list)- and
source_address_prefixorsource_address_prefixesincluding"*","0.0.0.0/0", or"Internet"
source_address_prefix / source_address_prefixes only list the approved CIDR ranges, or change access = "Deny" if no inbound HTTPS should be allowed. Changing these attributes is in-place and does not force replacement of the NSG.For verification, terraform plan should show the existing HTTPS rule on this NSG being updated so that no inbound rule with access = "Allow" on TCP/443 has source_address_prefix or source_address_prefixes set to "*", "0.0.0.0/0", or "Internet".
