|   Trend Micro Cloud One™
Open menu

Check for Unrestricted FTP Access

Cloud Conformity allows you to automate the auditing process of this resolution page. Register for a 14 day evaluation and check your compliance level for free!

Start a Free Trial Product features
Risk level: Very High (act immediately)
Rule ID: Network-005

Ensure that Microsoft Azure network security groups (NSGs) do not allow unrestricted access on TCP ports 20 and 21 in order to protect against attackers that use brute force methods to gain access to Azure virtual machines associated with these NSGs. TCP ports 20 and 21 are used for data transfer and communication by the File Transfer Protocol (FTP) client-server applications.

This rule resolution is part of the Cloud Conformity Security & Compliance tool for Azure

Security

Allowing unrestricted FTP access to your Azure virtual machines (VMs) via network security groups (NSGs) can increase opportunities for malicious activities such as brute-force attacks, FTP bounce attacks, spoofing and packet capture attacks.

Audit

To determine if your Azure network security groups allow unrestricted access on TCP ports 20 and 21 (FTP), perform the following actions

Using Azure Console

01 Sign in to Azure Management Console.

02 Navigate to All resources blade at https://portal.azure.com/#blade/HubsExtension/BrowseAll to access all your Microsoft Azure resources.

03 From the Subscription filter box, select the Azure account subscription that you want to examine.

04 From the Type filter box, select Network security group to list only the security groups available in the selected Azure subscription.

05 Click on the name of the network security group that you want to examine.

06 In the navigation panel, under Settings, select Inbound security rules to access the list with the inbound rules defined for the selected security group.

07 On the Inbound security rules page, verify the value available in the SOURCE column for any inbound rules with the PORT set to 20 or 21 (FTP) and the PROTOCOL set to TCP. If one or more rules have the SOURCE set to Any (i.e. 0.0.0.0/0), the selected network security group allows unrestricted traffic on TCP port 20/21, therefore the FTP access to the associated Microsoft Azure virtual machine(s) is not secured.

08 Repeat steps no. 5 – 7 for each network security group available in the current Azure subscription.

09 Repeat steps no. 3 – 8 for each subscription created in your Microsoft Azure cloud account.

Using Azure CLI

01 Run network nsg list command (Windows/macOS/Linux) using custom query filters to list the names of all network security groups (and the name of their associated resource groups) available in the current Azure subscription:

az network nsg list
	--output table
	--query '[*].{name:name, resourceGroup:resourceGroup}'

02 The command output should return a table with requested resource information:

Name                       ResourceGroup
------------------------   ------------------------------
cc-production-vm-nsg       cloud-shell-storage-westeurope
cc-project5-server-nsg     cloud-shell-storage-westeurope

03 Run az network nsg rule list command (Windows/macOS/Linux) using the name of the Azure network security group that you want to examine and its associated resource group as identifier parameters to describe the FTP inbound rule defined for the selected network security group using custom query filters:

az network nsg rule list
	--nsg-name cc-production-vm-nsg
	--resource-group cloud-shell-storage-westeurope
	--query "[?direction=='Inbound' && access=='Allow' && protocol=='TCP' && (destinationPortRange=='20' || destinationPortRange=='21')]"

04 The command output should return the requested security group rule metadata or an empty array such as [], if there is no FTP rule for TCP port 20 or 21 defined:

[
  {
    "access": "Allow",
    "description": null,
    "destinationAddressPrefix": "*",
    "destinationAddressPrefixes": [],
    "destinationApplicationSecurityGroups": null,
    "destinationPortRange": "21",
    "destinationPortRanges": [],
    "direction": "Inbound",
    "etag": "W/\"abcdabcd-1234-abcd-1234-abcdabcdabcd\"",
    "id": "/subscriptions/abcd1234-abcd-1234-abcd-1234abcd1234/resourceGroups/cloud-shell-storage-westeurope/providers/Microsoft.Network/networkSecurityGroups/cc-production-nsg/securityRules/FTP",
    "name": "FTP",
    "priority": 100,
    "protocol": "TCP",
    "provisioningState": "Succeeded",
    "resourceGroup": "cloud-shell-storage-westeurope",
    "sourceAddressPrefix": "*",
    "sourceAddressPrefixes": [],
    "sourceApplicationSecurityGroups": null,
    "sourcePortRange": "*",
    "sourcePortRanges": [],
    "type": "Microsoft.Network/networkSecurityGroups/securityRules"
  }
]

If the "sourceAddressPrefix" configuration attribute value is set to "*", "internet" or "any", as shown in the output example above, the selected network security group allows unrestricted traffic on TCP port 20/21, hence the Secure Shell (FTP) access to any associated Microsoft Azure virtual machine(s) is not currently secured.

05 Repeat step no. 3 and 4 for each Azure network security group created in the selected subscription.

06 Repeat steps no. 1 – 5 for each subscription available within your Microsoft Azure cloud account.

Remediation / Resolution

To update your Azure network security group FTP rule configuration in order to restrict Secure Shell access to specific, authorized entities only such as IP addresses or IP ranges, perform the following actions:

Using Azure Console

01 Sign in to Azure Management Console.

02 Navigate to All resources blade at https://portal.azure.com/#blade/HubsExtension/BrowseAll to access all your Microsoft Azure resources.

03 From the Subscription filter box, select the Azure account subscription that you want to access.

04 From the Type filter box, select Network security group to list only the security groups available in the selected Azure subscription.

05 Click on the name of the network security group that you want to reconfigure.

06 In the navigation panel, under Settings, select Inbound security rules to access the list with the inbound rules defined for the selected security group.

07 On the Inbound security rules page, click on the noncompliant FTP security group rule that you want to reconfigure (see Audit section part I to identify the right NSG rule).

08 On the selected security group rule configuration panel, perform the following:

  1. Select IP Addresses from the Source dropdown list to allow inbound traffic on TCP port 20/21 from specified IP addresses only.
  2. For Source IP addresses/CIDR ranges, provide the source IP address, IP addresses or IP address ranges that will be allowed to access the virtual machines associated with the selected network security group (NSG). You can specify a single value or comma-separated list of multiple values. An example of multiple values is 10.0.1.5/32, 10.0.1.6/32.
  3. Make sure that Action is set to Allow and leave the rest of the NSG configuration settings unchanged.
  4. Click Save to apply the configuration changes.

09 Repeat steps no. 5 – 8 for each network security group that allows unrestricted inbound access on TCP port 20 or 21 (FTP), available in the current Azure subscription.

10 Repeat steps no. 3 – 9 for each subscription created in your Microsoft Azure cloud account.

Using Azure CLI

01 Run network nsg rule update command (Windows/macOS/Linux) using the name of the network security group rule that you want to reconfigure as identifier parameter (see Audit section part II to identify the right rule) to restrict FTP access on TCP port 22 to specific IP address(es) by setting the --source-address-prefixes parameter to the IP address, IP addresses or IP address ranges that can be allowed to access the virtual machines associated with the selected network security group. You can specify a single value (e.g. 10.0.1.6/32) or a space-separated list of multiple values (e.g. 10.0.1.5/32 10.0.1.6/32):

az network nsg rule update
	--name FTP
	--nsg-name cc-production-vm-nsg
	--resource-group cloud-shell-storage-westeurope
	--source-address-prefixes 10.0.1.6/32

02 The command output should return the metadata for the reconfigured Azure NSG rule:

{
  "access": "Allow",
  "description": null,
  "destinationAddressPrefix": "*",
  "destinationAddressPrefixes": [],
  "destinationApplicationSecurityGroups": null,
  "destinationPortRange": "21",
  "destinationPortRanges": [],
  "direction": "Inbound",

  ...

  "name": "FTP",
  "priority": 110,
  "protocol": "TCP",
  "provisioningState": "Succeeded",
  "resourceGroup": "cloud-shell-storage-westeurope",
  "sourceAddressPrefix": "10.0.1.6/32",
  "sourceAddressPrefixes": [],
  "sourceApplicationSecurityGroups": null,
  "sourcePortRange": "*",
  "sourcePortRanges": [],
  "type": "Microsoft.Network/networkSecurityGroups/securityRules"
}

03 Repeat step no. 1 and 2 for each network security group that allows unrestricted inbound access on TCP port 20 or 21 (FTP), available in the current Azure subscription.

04 Repeat steps no. 1 – 3 for each subscription created within your Microsoft Azure cloud account.

References

Publication date Jun 3, 2020

Unlock the Remediation Steps

Gain free unlimited access to our full Knowledge Base


Over 600 rules & best practices for and

Get started for FREE

A verification email will be sent to this address
We keep your information private. Learn more.

Thank you!

Please click the link in the confirmation email sent to

You are auditing:

Check for Unrestricted FTP Access

Risk level: Very High