Back
Id4a9d3c2e-7f1b-4e58-9a0c-2d5b8e3f1a7c
RulenameCertUtil Used for File Download (Living off the Land)
DescriptionDetects certutil.exe being used to download files from remote URLs via the

-urlcache or -verifyctl flags. CertUtil is a signed Windows binary (LOLBin)

that attackers abuse to download payloads while bypassing application

whitelisting and network controls.

Tune AllowlistedDomains to match your PKI/CA infrastructure.
SeverityHigh
TacticsCommandAndControl
DefenseEvasion
TechniquesT1105
T1218
T1140
Required data connectorsMicrosoftThreatProtection
SecurityEvents
KindScheduled
Query frequency1h
Query period1h
Trigger threshold0
Trigger operatorgt
Source Urihttps://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Endpoint%20Threat%20Protection%20Essentials/Analytic%20Rules/Certutil-Download-Abuse.yaml
Version1.0.0
Arm template4a9d3c2e-7f1b-4e58-9a0c-2d5b8e3f1a7c.json
Deploy To Azure
let Lookback = 1h;
let AllowlistedDomains = dynamic([
  "windowsupdate.microsoft.com",
  "download.microsoft.com",
  "dl.delivery.mp.microsoft.com",
  "ctldl.windowsupdate.com"
]);
let MDE_Results =
  DeviceProcessEvents
  | where Timestamp >= ago(Lookback)
  | where FileName =~ "certutil.exe"
  | where ProcessCommandLine has_any ("-urlcache", "-verifyctl", "-decode", "-decodehex")
  | where ProcessCommandLine has_any ("http://", "https://", "ftp://")
  | where not(ProcessCommandLine has_any (AllowlistedDomains))
  | extend
      AccountName   = InitiatingProcessAccountName,
      AccountDomain = InitiatingProcessAccountDomain,
      HostName      = DeviceName,
      EventTime     = Timestamp
  | project EventTime, HostName, AccountName, AccountDomain,
      ProcessCommandLine, InitiatingProcessFileName;
let SecEvent_Results =
  SecurityEvent
  | where TimeGenerated >= ago(Lookback)
  | where EventID == 4688
  | where NewProcessName endswith "\\certutil.exe"
  | where CommandLine has_any ("-urlcache", "-verifyctl", "-decode", "-decodehex")
  | where CommandLine has_any ("http://", "https://", "ftp://")
  | where not(CommandLine has_any (AllowlistedDomains))
  | extend
      AccountName   = SubjectUserName,
      AccountDomain = SubjectDomainName,
      HostName      = Computer,
      EventTime     = TimeGenerated,
      ProcessCommandLine = CommandLine,
      InitiatingProcessFileName = ParentProcessName
  | project EventTime, HostName, AccountName, AccountDomain,
      ProcessCommandLine, InitiatingProcessFileName;
union MDE_Results, SecEvent_Results
| sort by EventTime desc
tactics:
- CommandAndControl
- DefenseEvasion
requiredDataConnectors:
- dataTypes:
  - DeviceProcessEvents
  connectorId: MicrosoftThreatProtection
- dataTypes:
  - SecurityEvent
  connectorId: SecurityEvents
queryPeriod: 1h
kind: Scheduled
severity: High
OriginalUri: https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Endpoint%20Threat%20Protection%20Essentials/Analytic%20Rules/Certutil-Download-Abuse.yaml
queryFrequency: 1h
triggerThreshold: 0
description: |
  Detects certutil.exe being used to download files from remote URLs via the
  -urlcache or -verifyctl flags. CertUtil is a signed Windows binary (LOLBin)
  that attackers abuse to download payloads while bypassing application
  whitelisting and network controls.
  Tune AllowlistedDomains to match your PKI/CA infrastructure.
id: 4a9d3c2e-7f1b-4e58-9a0c-2d5b8e3f1a7c
triggerOperator: gt
status: Available
relevantTechniques:
- T1105
- T1218
- T1140
version: 1.0.0
name: CertUtil Used for File Download (Living off the Land)
entityMappings:
- entityType: Host
  fieldMappings:
  - columnName: HostName
    identifier: FullName
- entityType: Account
  fieldMappings:
  - columnName: AccountName
    identifier: Name
  - columnName: AccountDomain
    identifier: NTDomain
- entityType: Process
  fieldMappings:
  - columnName: ProcessCommandLine
    identifier: CommandLine
query: |
  let Lookback = 1h;
  let AllowlistedDomains = dynamic([
    "windowsupdate.microsoft.com",
    "download.microsoft.com",
    "dl.delivery.mp.microsoft.com",
    "ctldl.windowsupdate.com"
  ]);
  let MDE_Results =
    DeviceProcessEvents
    | where Timestamp >= ago(Lookback)
    | where FileName =~ "certutil.exe"
    | where ProcessCommandLine has_any ("-urlcache", "-verifyctl", "-decode", "-decodehex")
    | where ProcessCommandLine has_any ("http://", "https://", "ftp://")
    | where not(ProcessCommandLine has_any (AllowlistedDomains))
    | extend
        AccountName   = InitiatingProcessAccountName,
        AccountDomain = InitiatingProcessAccountDomain,
        HostName      = DeviceName,
        EventTime     = Timestamp
    | project EventTime, HostName, AccountName, AccountDomain,
        ProcessCommandLine, InitiatingProcessFileName;
  let SecEvent_Results =
    SecurityEvent
    | where TimeGenerated >= ago(Lookback)
    | where EventID == 4688
    | where NewProcessName endswith "\\certutil.exe"
    | where CommandLine has_any ("-urlcache", "-verifyctl", "-decode", "-decodehex")
    | where CommandLine has_any ("http://", "https://", "ftp://")
    | where not(CommandLine has_any (AllowlistedDomains))
    | extend
        AccountName   = SubjectUserName,
        AccountDomain = SubjectDomainName,
        HostName      = Computer,
        EventTime     = TimeGenerated,
        ProcessCommandLine = CommandLine,
        InitiatingProcessFileName = ParentProcessName
    | project EventTime, HostName, AccountName, AccountDomain,
        ProcessCommandLine, InitiatingProcessFileName;
  union MDE_Results, SecEvent_Results
  | sort by EventTime desc
{
  "$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/4a9d3c2e-7f1b-4e58-9a0c-2d5b8e3f1a7c')]",
      "kind": "Scheduled",
      "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/4a9d3c2e-7f1b-4e58-9a0c-2d5b8e3f1a7c')]",
      "properties": {
        "alertRuleTemplateName": "4a9d3c2e-7f1b-4e58-9a0c-2d5b8e3f1a7c",
        "customDetails": null,
        "description": "Detects certutil.exe being used to download files from remote URLs via the\n-urlcache or -verifyctl flags. CertUtil is a signed Windows binary (LOLBin)\nthat attackers abuse to download payloads while bypassing application\nwhitelisting and network controls.\nTune AllowlistedDomains to match your PKI/CA infrastructure.\n",
        "displayName": "CertUtil Used for File Download (Living off the Land)",
        "enabled": true,
        "entityMappings": [
          {
            "entityType": "Host",
            "fieldMappings": [
              {
                "columnName": "HostName",
                "identifier": "FullName"
              }
            ]
          },
          {
            "entityType": "Account",
            "fieldMappings": [
              {
                "columnName": "AccountName",
                "identifier": "Name"
              },
              {
                "columnName": "AccountDomain",
                "identifier": "NTDomain"
              }
            ]
          },
          {
            "entityType": "Process",
            "fieldMappings": [
              {
                "columnName": "ProcessCommandLine",
                "identifier": "CommandLine"
              }
            ]
          }
        ],
        "OriginalUri": "https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Endpoint%20Threat%20Protection%20Essentials/Analytic%20Rules/Certutil-Download-Abuse.yaml",
        "query": "let Lookback = 1h;\nlet AllowlistedDomains = dynamic([\n  \"windowsupdate.microsoft.com\",\n  \"download.microsoft.com\",\n  \"dl.delivery.mp.microsoft.com\",\n  \"ctldl.windowsupdate.com\"\n]);\nlet MDE_Results =\n  DeviceProcessEvents\n  | where Timestamp >= ago(Lookback)\n  | where FileName =~ \"certutil.exe\"\n  | where ProcessCommandLine has_any (\"-urlcache\", \"-verifyctl\", \"-decode\", \"-decodehex\")\n  | where ProcessCommandLine has_any (\"http://\", \"https://\", \"ftp://\")\n  | where not(ProcessCommandLine has_any (AllowlistedDomains))\n  | extend\n      AccountName   = InitiatingProcessAccountName,\n      AccountDomain = InitiatingProcessAccountDomain,\n      HostName      = DeviceName,\n      EventTime     = Timestamp\n  | project EventTime, HostName, AccountName, AccountDomain,\n      ProcessCommandLine, InitiatingProcessFileName;\nlet SecEvent_Results =\n  SecurityEvent\n  | where TimeGenerated >= ago(Lookback)\n  | where EventID == 4688\n  | where NewProcessName endswith \"\\\\certutil.exe\"\n  | where CommandLine has_any (\"-urlcache\", \"-verifyctl\", \"-decode\", \"-decodehex\")\n  | where CommandLine has_any (\"http://\", \"https://\", \"ftp://\")\n  | where not(CommandLine has_any (AllowlistedDomains))\n  | extend\n      AccountName   = SubjectUserName,\n      AccountDomain = SubjectDomainName,\n      HostName      = Computer,\n      EventTime     = TimeGenerated,\n      ProcessCommandLine = CommandLine,\n      InitiatingProcessFileName = ParentProcessName\n  | project EventTime, HostName, AccountName, AccountDomain,\n      ProcessCommandLine, InitiatingProcessFileName;\nunion MDE_Results, SecEvent_Results\n| sort by EventTime desc\n",
        "queryFrequency": "PT1H",
        "queryPeriod": "PT1H",
        "severity": "High",
        "status": "Available",
        "subTechniques": [],
        "suppressionDuration": "PT1H",
        "suppressionEnabled": false,
        "tactics": [
          "CommandAndControl",
          "DefenseEvasion"
        ],
        "techniques": [
          "T1105",
          "T1140",
          "T1218"
        ],
        "templateVersion": "1.0.0",
        "triggerOperator": "GreaterThan",
        "triggerThreshold": 0
      },
      "type": "Microsoft.OperationalInsights/workspaces/providers/alertRules"
    }
  ]
}