rules/findings/azure/appservices/azure-app-service-remote-debugging-enabled.json

{
  "provider": "Azure",
  "serviceType": "_ARG_0_",
  "serviceName": "Hosted Services",
  "displayName": "Ensure \u0027Remote debugging\u0027 is set to \u0027Off\u0027",
  "description": "Remote debugging allows an App Service app to be debugged in real-time directly in the Azure environment. When remote debugging is enabled, it opens a communication channel that could potentially be exploited by unauthorized users if not properly secured.",
  "rationale": "Disabling remote debugging on an App Service app is primarily about enhancing security.\u003Cbr/\u003E\u003Cbr/\u003ERemote debugging opens a communication channel that can be exploited by attackers.\u003Cbr/\u003E\u003Cbr/\u003EBy disabling it, you reduce the number of potential entry points for unauthorized access.\u003Cbr/\u003E\u003Cbr/\u003EIf remote debugging is enabled without proper access controls, it can allow unauthorized users to connect to your application, potentially leading to data breaches or malicious code execution.\u003Cbr/\u003E\u003Cbr/\u003EDuring a remote debugging session, sensitive information might be exposed. Disabling remote debugging helps ensure that such data remains secure. This minimizes the use of remote access tools to reduce risk.",
  "impact": "You will not be able to connect to your application from a remote location to diagnose and fix issues in real-time. You will not be able to step through code, set breakpoints, or inspect variables and the call stack while the application is running on the server.\u003Cbr/\u003E\u003Cbr/\u003ERemote debugging is particularly useful for diagnosing issues that only occur in the production environment. Without it, you will need to rely on logs and other diagnostic tools.",
  "remediation": {
    "text": "\n\t\t\t#### Remediate from Azure Portal\n\t\t\t1. Login to Azure Portal using https://portal.azure.com\n\t\t\t2. Go to App Services\n\t\t\t3. Click on each App\n\t\t\t4. Under Setting section, Click on Configuration\n\t\t\t5. Under the General settings tab, set the Remote debugging option to Off.\n\t\t",
    "code": {
      "powerShell": null,
      "iac": null,
      "terraform": null,
      "other": null
    }
  },
  "recommendation": null,
  "references": [
    "https://learn.microsoft.com/en-us/visualstudio/debugger/remote-debugging-azure-app-service?view=visualstudio",
    "https://learn.microsoft.com/en-us/security/benchmark/azure/mcsb-posture-vulnerability-management#pv-2-audit-and-enforce-secure-configurations",
    "https://learn.microsoft.com/en-us/cli/azure/webapp?view=azure-cli-latest",
    "https://learn.microsoft.com/en-us/powershell/module/az.websites/get-azwebapp?view=azps-15.4.0",
    "https://learn.microsoft.com/en-us/powershell/module/az.websites/set-azwebapp?view=azps-15.4.0"
  ],
  "compliance": [
    {
      "name": "_ARG_1_",
      "version": "_ARG_2_",
      "reference": "_ARG_3_",
      "profile": [
        "Level 1"
      ]
    }
  ],
  "level": "medium",
  "tags": [],
  "rule": {
    "path": "az_app_services",
    "subPath": null,
    "selectCondition": {},
    "query": [
      {
        "filter": [
          {
            "conditions": [
              [
                "config.properties.remoteDebuggingEnabled",
                "ne",
                "false"
              ]
            ]
          }
        ]
      },
      {
        "connectOperator": "and",
        "filter": [
          {
            "include": "_ARG_4_"
          }
        ]
      }
    ],
    "shouldExist": null,
    "returnObject": null,
    "removeIfNotExists": null
  },
  "output": {
    "html": {
      "data": {
        "properties": {
          "name": "Name",
          "location": "location",
          "resourceGroupName": "Resource Group Name",
          "config.properties.remoteDebuggingEnabled": "Remote Debugging"
        },
        "expandObject": null
      },
      "table": "default",
      "decorate": [
        {
          "itemName": "Remote Debugging",
          "itemValue": "enabled",
          "className": "badge badge-danger badge-xl"
        }
      ],
      "emphasis": [],
      "actions": {
        "objectData": {
          "properties": [
            "name",
            "location",
            "resourceGroupName",
            "config"
          ],
          "expandObject": null,
          "limit": null
        },
        "showGoToButton": "True",
        "showModalButton": "True",
        "directLink": null
      }
    },
    "text": {
      "data": {
        "properties": {
          "name": "Name",
          "location": "location",
          "resourceGroupName": "Resource Group Name",
          "config.properties.remoteDebuggingEnabled": "Remote Debugging"
        },
        "expandObject": null
      },
      "status": {
        "keyName": [
          "name"
        ],
        "message": "Ensure \u0027Remote debugging\u0027 is set to \u0027Off\u0027 for {name}",
        "defaultMessage": null
      },
      "properties": {
        "resourceName": "name",
        "resourceId": "id",
        "resourceType": "type"
      },
      "onlyStatus": false
    }
  },
  "idSuffix": "azure__ARG_0__remote_debugging_enabled",
  "notes": [],
  "categories": [],
  "immutableProperties": [
    "name",
    "id"
  ],
  "id": "azure_app_service__ARG_5_"
}