{
  "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "workspace": {
      "type": "String"
    }
  },
  "resources": [
    {
      "apiVersion": "2024-01-01-preview",
      "id": "[concat(resourceId('Microsoft.OperationalInsights/workspaces/providers', parameters('workspace'), 'Microsoft.SecurityInsights'),'/alertRules/56cda6d3-8402-4d6c-a2e7-f72b1efed280')]",
      "kind": "Scheduled",
      "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/56cda6d3-8402-4d6c-a2e7-f72b1efed280')]",
      "properties": {
        "alertRuleTemplateName": "56cda6d3-8402-4d6c-a2e7-f72b1efed280",
        "customDetails": null,
        "description": "'[Unvalidated] Identifies a shell or reconnaissance tool spawned\ndirectly under a PHP worker process (php-fpm, lsphp, or Apache\nmod_php, where PHP runs in-process inside the apache2/httpd worker).\nThis is a generic PHP child-process-monitoring indicator, useful\nagainst any PHP RCE regardless of root cause - it does not itself\ndetect or confirm exploitation of CVE-2026-109618 or CVE-2026-109619\nspecifically.\n\nCVE attribution is unvalidated: the reference sample this rule's\nfield-matching was checked against\n(https://github.com/rjmendez/phpup-2026/blob/master/examples/INDEX.md)\nwas produced by a direct shell_exec() test endpoint, not by triggering\neither CVE''s actual longjmp/bailout mechanism\n(https://github.com/rjmendez/phpup-2026/blob/master/ANALYSIS.md). No\nrepresentative malicious sample produced by exploiting either CVE has\nbeen validated against this query.\n\nBenign-use tuning: legitimate applications routinely invoke shells,\nPython, curl, or wget from PHP (build steps, package managers, image\nprocessing, health checks). Expect overlap with existing generic\n\"process spawned a shell\" content already present in most\nenvironments; this rule adds PHP-worker-specific parentage as a\nnarrowing filter, not a new detection category. Tune the command-line\ntokens and account/parent filters to your own environment before\nenabling as an alert.\n\n2026-10-21, same day, second fix: FileHash entity was mapped to this\ntable's SHA256 column - Microsoft's own DeviceProcessEvents schema\nreference states that field \"is usually not populated - use the SHA1\ncolumn when available\". Switched to SHA1, confirmed as the convention\na real, already-merged detection in this same repo uses for the same\ntable (Detections/DeviceProcessEvents/\nSolarWinds_SUNBURST_Process-IOCs.yaml).\nReferences:\n- https://github.com/php/php-src/security/advisories/GHSA-6wmf-4rv5-p3rp\n- https://github.com/php/php-src/security/advisories/GHSA-w8hw-w9fx-j79w\n- https://github.com/rjmendez/phpup-2026'\n",
        "displayName": "PHP Worker Process Spawning Shell/Recon Tool",
        "enabled": true,
        "entityMappings": [
          {
            "entityType": "Account",
            "fieldMappings": [
              {
                "columnName": "InitiatingProcessAccountName",
                "identifier": "Name"
              },
              {
                "columnName": "InitiatingProcessAccountDomain",
                "identifier": "NTDomain"
              },
              {
                "columnName": "InitiatingProcessAccountSid",
                "identifier": "Sid"
              }
            ]
          },
          {
            "entityType": "Host",
            "fieldMappings": [
              {
                "columnName": "DeviceName",
                "identifier": "HostName"
              }
            ]
          },
          {
            "entityType": "Process",
            "fieldMappings": [
              {
                "columnName": "ProcessCommandLine",
                "identifier": "CommandLine"
              }
            ]
          },
          {
            "entityType": "FileHash",
            "fieldMappings": [
              {
                "columnName": "HashAlgorithm",
                "identifier": "Algorithm"
              },
              {
                "columnName": "SHA1",
                "identifier": "Value"
              }
            ]
          }
        ],
        "OriginalUri": "https://github.com/Azure/Azure-Sentinel/blob/master/Detections/DeviceProcessEvents/phpup2026-PHPShellSpawn.yaml",
        "query": "DeviceProcessEvents\n| where InitiatingProcessFileName matches regex @\"(?i)^(php-fpm[\\d.]*|php[\\d.]*|lsphp[\\d]*|apache2|httpd)$\"\n| where FileName in~ (\"sh\", \"bash\", \"dash\", \"zsh\", \"ash\", \"python\", \"python2\", \"python3\",\n    \"perl\", \"ruby\", \"curl\", \"wget\", \"nc\", \"ncat\", \"nmap\", \"whoami\", \"id\")\n     or ProcessCommandLine has_any (\n         \"/bin/sh\", \"/bin/bash\", \"bash -i\", \"python -c\", \"python3 -c\",\n         \"exec(\", \"eval(\", \"base64 -d\", \"curl \", \"wget \"\n       )\n| extend HashAlgorithm = \"SHA1\"\n| project TimeGenerated, DeviceName,\n          InitiatingProcessAccountName, InitiatingProcessAccountDomain,\n          InitiatingProcessAccountSid,\n          InitiatingProcessFileName, InitiatingProcessCommandLine,\n          FileName, ProcessCommandLine, FolderPath, SHA1, HashAlgorithm\n",
        "queryFrequency": "PT1H",
        "queryPeriod": "PT1H",
        "severity": "High",
        "status": "Available",
        "subTechniques": [
          "T1059.004"
        ],
        "suppressionDuration": "PT1H",
        "suppressionEnabled": false,
        "tactics": [
          "Execution",
          "InitialAccess"
        ],
        "tags": [
          "CVE-2026-109618",
          "CVE-2026-109619",
          "phpup-2026",
          "unvalidated"
        ],
        "techniques": [
          "T1059",
          "T1190"
        ],
        "templateVersion": "1.0.1",
        "triggerOperator": "GreaterThan",
        "triggerThreshold": 0
      },
      "type": "Microsoft.OperationalInsights/workspaces/providers/alertRules"
    }
  ]
}
