Skip to main content

More Info:

Ensure that no network security groups allow unrestricted inbound access on TCP port 25.

Risk Level

High

Address

Security

Compliance 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)
  • FedRAMP
  • 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 CSF
  • NIST SP 800-171
  • NYDFS 23 NYCRR 500
  • PCI
  • 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

Using Console

Sure, here are the step by step instructions to remediate Unrestricted SMTP Access misconfiguration in Azure:
  1. Login to the Azure portal and navigate to the problematic resource group.
  2. In the left-hand menu, click on “Network security group”.
  3. Select the network security group that is associated with the affected resource.
  4. Click on “Inbound security rules” and then click on “Add”.
  5. In the “Add inbound security rule” page, provide the following details:
    • Source: Select “IP addresses”.
    • Source IP addresses: Enter the IP address range that you want to allow SMTP access for.
    • Destination: Select “Any”.
    • Protocol: Select “TCP”.
    • Destination port ranges: Enter “25” (SMTP port number).
    • Name: Enter a name for the rule.
    • Priority: Choose a priority number that is lower than the existing SMTP rule.
  6. Click on “Add” to create the new rule.
  7. Verify that the new rule is created successfully and the old rule is deleted.
By following these steps, you have successfully remediated the Unrestricted SMTP Access misconfiguration in Azure using the Azure console.

To remediate Unrestricted SMTP Access in AZURE using AZURE CLI, you can follow the below steps:Step 1: Open the Azure CLI on your local machine.Step 2: Login to your Azure account using the below command:
Step 3: Once you are logged in, run the below command to list all the virtual machines in your Azure account:
Step 4: Identify the virtual machine that has unrestricted SMTP access.Step 5: Run the below command to open the Network Security Group (NSG) associated with the virtual machine:
Step 6: Identify the rule that allows unrestricted SMTP access.Step 7: Run the below command to delete the rule:
Step 8: Verify that the rule has been deleted by running the below command:
Once you have followed the above steps, the Unrestricted SMTP Access misconfiguration in AZURE would have been remediated successfully.
To remediate Unrestricted SMTP Access issue in Azure using Python, you can follow these steps:
  1. Import the required libraries:
  1. Authenticate with Azure:
  1. Get the list of network security groups in your subscription:
  1. For each network security group, check if there is a rule allowing unrestricted SMTP access:
  1. If you find a rule allowing unrestricted SMTP access, remove it:
Note: Replace <your-subscription-id> and <your-resource-group> with your actual subscription ID and resource group name. Also, make sure you have the necessary permissions to modify network security groups in your Azure subscription.
If you are tightening an existing rule (changing source_address_prefix from "*" or 0.0.0.0/0 to specific CIDRs), Terraform will update that individual security_rule; the NSG itself is not replaced, but the rule object is modified, which may briefly impact SMTP reachability from disallowed sources.For verification, terraform plan should show either:
  • a modification of the existing SMTP rule changing source_address_prefix/source_address_prefixes from "*" (or 0.0.0.0/0) to your specific CIDRs, or
  • a deletion of the unrestricted SMTP rule and creation of a new, restricted one, with no other unrelated changes.