Microsoft Sentinel Analytic Rules
cloudbrothers.infoAzure Sentinel RepoToggle Dark/Light/Auto modeToggle Dark/Light/Auto modeToggle Dark/Light/Auto modeBack to homepage

Remote Scheduled Task Creation or Update using ATSVC Named Pipe

Back
Id7aad876a-a6fe-4c11-879e-8b29d35ff739
RulenameRemote Scheduled Task Creation or Update using ATSVC Named Pipe
DescriptionThis query detects a scheduled task, created/updated remotely, using the ATSVC name pipe.

Threat actors are using scheduled tasks for establishing persistence and moving laterally through the network.

Ref: https://blog.menasec.net/2019/03/threat-hunting-25-scheduled-tasks-for.html
TacticsPersistence
TechniquesT1053.002
Required data connectorsSecurityEvents
KindScheduled
Source Urihttps://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Endpoint Threat Protection Essentials/Hunting Queries/RemoteScheduledTaskCreationUpdateUsingATSVCNamedPipe.yaml
Version1.0.0
Arm template7aad876a-a6fe-4c11-879e-8b29d35ff739.json
Deploy To Azure
SecurityEvent
| where EventID == 5145 and ShareName=="\\\\*\\IPC$" and RelativeTargetName == "atsvc"
| summarize StartTime = min(TimeGenerated), EndTime = max(TimeGenerated) by EventID, Computer, SubjectUserName, ShareName, RelativeTargetName, IpAddress
kind: Scheduled
relevantTechniques:
- T1053.002
id: 7aad876a-a6fe-4c11-879e-8b29d35ff739
description: |
  'This query detects a scheduled task, created/updated remotely, using the ATSVC name pipe. 
  Threat actors are using scheduled tasks for establishing persistence and moving laterally through the network.
  Ref: https://blog.menasec.net/2019/03/threat-hunting-25-scheduled-tasks-for.html'  
tactics:
- Persistence
OriginalUri: https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Endpoint Threat Protection Essentials/Hunting Queries/RemoteScheduledTaskCreationUpdateUsingATSVCNamedPipe.yaml
name: Remote Scheduled Task Creation or Update using ATSVC Named Pipe
version: 1.0.0
entityMappings:
- fieldMappings:
  - columnName: SubjectUserName
    identifier: FullName
  entityType: Account
- fieldMappings:
  - columnName: Computer
    identifier: FullName
  entityType: Host
- fieldMappings:
  - columnName: IpAddress
    identifier: Address
  entityType: IP
query: |
  SecurityEvent
  | where EventID == 5145 and ShareName=="\\\\*\\IPC$" and RelativeTargetName == "atsvc"
  | summarize StartTime = min(TimeGenerated), EndTime = max(TimeGenerated) by EventID, Computer, SubjectUserName, ShareName, RelativeTargetName, IpAddress  
requiredDataConnectors:
- connectorId: SecurityEvents
  dataTypes:
  - SecurityEvent
{
  "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "workspace": {
      "type": "String"
    }
  },
  "resources": [
    {
      "id": "[concat(resourceId('Microsoft.OperationalInsights/workspaces/providers', parameters('workspace'), 'Microsoft.SecurityInsights'),'/alertRules/7aad876a-a6fe-4c11-879e-8b29d35ff739')]",
      "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/7aad876a-a6fe-4c11-879e-8b29d35ff739')]",
      "type": "Microsoft.OperationalInsights/workspaces/providers/alertRules",
      "kind": "Scheduled",
      "apiVersion": "2022-11-01",
      "properties": {
        "displayName": "Remote Scheduled Task Creation or Update using ATSVC Named Pipe",
        "description": "'This query detects a scheduled task, created/updated remotely, using the ATSVC name pipe. \nThreat actors are using scheduled tasks for establishing persistence and moving laterally through the network.\nRef: https://blog.menasec.net/2019/03/threat-hunting-25-scheduled-tasks-for.html'\n",
        "enabled": true,
        "query": "SecurityEvent\n| where EventID == 5145 and ShareName==\"\\\\\\\\*\\\\IPC$\" and RelativeTargetName == \"atsvc\"\n| summarize StartTime = min(TimeGenerated), EndTime = max(TimeGenerated) by EventID, Computer, SubjectUserName, ShareName, RelativeTargetName, IpAddress\n",
        "suppressionDuration": "PT1H",
        "suppressionEnabled": false,
        "tactics": [
          "Persistence"
        ],
        "techniques": [
          "T1053.002"
        ],
        "alertRuleTemplateName": "7aad876a-a6fe-4c11-879e-8b29d35ff739",
        "customDetails": null,
        "entityMappings": [
          {
            "entityType": "Account",
            "fieldMappings": [
              {
                "identifier": "FullName",
                "columnName": "SubjectUserName"
              }
            ]
          },
          {
            "entityType": "Host",
            "fieldMappings": [
              {
                "identifier": "FullName",
                "columnName": "Computer"
              }
            ]
          },
          {
            "entityType": "IP",
            "fieldMappings": [
              {
                "identifier": "Address",
                "columnName": "IpAddress"
              }
            ]
          }
        ],
        "templateVersion": "1.0.0",
        "OriginalUri": "https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Endpoint Threat Protection Essentials/Hunting Queries/RemoteScheduledTaskCreationUpdateUsingATSVCNamedPipe.yaml"
      }
    }
  ]
}