rules/findings/azure/virtual_machines/azure-virtual-machine-disk-network-access-allow-all-networks.json

{
    "args": [],
    "provider": "Azure",
    "serviceType": "Disks",
    "serviceName": "Storage",
    "displayName": "Ensure that 'Disk Network Access' is NOT set to 'Enable public access from all networks'",
    "description": "Virtual Machine Disks and snapshots can be configured to allow access from different network resources.",
    "rationale": "The setting 'Enable public access from all networks' is, in many cases, an overly permissive setting on Virtual Machine Disks that presents atypical attack, data infiltration, and data exfiltration vectors. If a disk to network connection is required, the preferred setting is to 'Disable public access and enable private access.'",
    "impact": "The setting 'Disable public access and enable private access' will require configuring a private link (URL in references below).<br/><br/>The setting 'Disable public and private access' is most secure and preferred where disk network access is not needed.",
    "remediation": {
        "text": "
            #### Remediate from Azure Portal
            Part A. Select the Virtual Machine to Remediate
                1. Using the search bar, search for and open the Virtual Machines service.
                2. Click on the name of the Virtual Machine to be remediated.
            Part B. Remediate each Virtual Machine Disk individually
                1. From the selected Virtual Machine resource window, expand the Settings menu item and click Disks.
                2. For each disk, click the name of the disk to open the disk resource window.
                3. From the selected Disk resource window, expand the Settings menu item, and click Networking. Under Network access, select the radio button for either:
                    * Disable public access and enable private access
                    * Disable public and private access
            Repeat Part B for each Disk attached to a VM. Repeat Parts A and B to remediate all Disks in all VMs.
        ",
        "code": {
            "powerShell": null,
            "iac": null,
            "terraform": null,
            "other": null
        }
    },
    "recommendation": null,
    "references": [
        "https://learn.microsoft.com/en-us/azure/virtual-machines/disks-enable-private-links-for-import-export-portal",
        "https://learn.microsoft.com/en-us/azure/virtual-machines/linux/disks-export-import-private-links-cli",
        "https://learn.microsoft.com/en-us/azure/virtual-machines/disks-restrict-import-export-overview"
    ],
    "compliance": [
        {
            "name": "CIS Microsoft Azure Foundations",
            "version": "2.0.0",
            "reference": "20.4",
            "profile": [
                "Level 1"
            ]
        }
    ],
    "level": "medium",
    "tags": [],
    "rule": {
        "path": "az_managed_disks",
        "subPath": null,
        "selectCondition": {
             
        },
        "query": [
            {
                "filter": [
                    {
                        "conditions": [
                            [
                                "allowAccessFromAllNetworks",
                                "eq",
                                "true"
                            ],
                            [
                                "networkAccessPolicy",
                                "eq",
                                "AllowAll"
                            ]
                        ],
                        "operator": "and"
                    }
                ]
            }
        ],
        "shouldExist": null,
        "returnObject": null,
        "removeIfNotExists": null
    },
    "output": {
        "html": {
            "data": {
                "properties": {
                    "name": "Disk Name",
                    "location": "Location",
                    "sku.name": "SKU Name",
                    "networkAccessPolicy": "Network Access Policy",
                    "allowAccessFromAllNetworks": "Access From All Networks"
                },
                "expandObject": null
            },
            "table": "default",
            "decorate": [],
            "emphasis": [],
            "actions": {
                "objectData": {
                    "properties": [
                        "name",
                        "location",
                        "sku",
                        "properties.osType",
                        "sse_encryption"
                    ],
                    "expandObject": null,
                    "limit": null
                },
                "showGoToButton": "True",
                "showModalButton": "True",
                "directLink": null
            }
        },
        "text": {
            "data": {
                "properties": {
                    "name": "Disk Name",
                    "location": "Location",
                    "skuname": "SKU Name",
                    "networkAccessPolicy": "Network Access Policy",
                    "allowAccessFromAllNetworks": "Access From All Networks"
                },
                "expandObject": null
            },
            "status": {
                "keyName": ["name"],
                "message": "Ensure that 'Disk Network Access' is NOT set to 'Enable public access from all networks' for {name}",
                "defaultMessage": null
            },
            "properties": {
                "resourceName": "name",
                "resourceId": "id",
                "resourceType": "type"
            },
            "onlyStatus": false
        }
    },
    "idSuffix": "disk_network_access_allow_all_networks",
    "notes": [
         
    ],
    "categories": [
         
    ],
    "immutable_properties": [
        "name",
        "id"
    ],
    "id": "azure_storage_002"
}