ASR Bypassing Writing Executable Content
Id | efe4efef-5ca7-4b51-a53e-0e96492ce97a |
Rulename | ASR Bypassing Writing Executable Content |
Description | The query checks for any file which has been created/written by an Office application and shortly after renamed to one of the deny-listed “executable extensions” which are text files. (e.g. ps1, .js, .vbs). |
Severity | Medium |
Tactics | DefenseEvasion |
Techniques | T1211 |
Required data connectors | MicrosoftThreatProtection |
Kind | Scheduled |
Query frequency | 1h |
Query period | 1h |
Trigger threshold | 0 |
Trigger operator | gt |
Source Uri | https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/FalconFriday/Analytic Rules/ASRBypassingWritingExecutableContent.yaml |
Version | 1.0.0 |
Arm template | efe4efef-5ca7-4b51-a53e-0e96492ce97a.json |
let timeframe = 1d;
let executableExtensions = dynamic([".js", ".hta", ".lnk", ".application", ".vb", ".vba", ".vbs", ".ps", ".ps1", ".bat", ".cmd"]);
DeviceFileEvents
| where Timestamp >= ago(timeframe)
| where InitiatingProcessFileName in~ ("winword.exe", "excel.exe", "outlook.exe", "powerpnt.exe")
| where ActionType == "FileRenamed"
// The mv-apply is less performance compared to doing a full written out !endswith. We kept the mv-apply since We don't hit any limits and get more readable/maintainable code.
| mv-apply ext=executableExtensions to typeof(string) on
(
where PreviousFileName !endswith ext and FileName endswith ext
)
| project-reorder PreviousFileName, FileName
// Begin allow-list.
// End allow-list.
version: 1.0.0
severity: Medium
queryFrequency: 1h
triggerOperator: gt
relevantTechniques:
- T1211
status: Available
kind: Scheduled
triggerThreshold: 0
query: |
let timeframe = 1d;
let executableExtensions = dynamic([".js", ".hta", ".lnk", ".application", ".vb", ".vba", ".vbs", ".ps", ".ps1", ".bat", ".cmd"]);
DeviceFileEvents
| where Timestamp >= ago(timeframe)
| where InitiatingProcessFileName in~ ("winword.exe", "excel.exe", "outlook.exe", "powerpnt.exe")
| where ActionType == "FileRenamed"
// The mv-apply is less performance compared to doing a full written out !endswith. We kept the mv-apply since We don't hit any limits and get more readable/maintainable code.
| mv-apply ext=executableExtensions to typeof(string) on
(
where PreviousFileName !endswith ext and FileName endswith ext
)
| project-reorder PreviousFileName, FileName
// Begin allow-list.
// End allow-list.
entityMappings:
- fieldMappings:
- columnName: DeviceName
identifier: FullName
entityType: Host
- fieldMappings:
- columnName: InitiatingProcessAccountSid
identifier: Sid
- columnName: InitiatingProcessAccountName
identifier: Name
- columnName: InitiatingProcessAccountDomain
identifier: NTDomain
entityType: Account
- fieldMappings:
- columnName: InitiatingProcessCommandLine
identifier: CommandLine
entityType: Process
name: ASR Bypassing Writing Executable Content
queryPeriod: 1h
description: |
The query checks for any file which has been created/written by an Office application and shortly after renamed to one of the deny-listed "executable extensions" which are text files. (e.g. ps1, .js, .vbs).
requiredDataConnectors:
- dataTypes:
- DeviceFileEvents
connectorId: MicrosoftThreatProtection
id: efe4efef-5ca7-4b51-a53e-0e96492ce97a
OriginalUri: https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/FalconFriday/Analytic Rules/ASRBypassingWritingExecutableContent.yaml
tactics:
- DefenseEvasion
{
"$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/efe4efef-5ca7-4b51-a53e-0e96492ce97a')]",
"kind": "Scheduled",
"name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/efe4efef-5ca7-4b51-a53e-0e96492ce97a')]",
"properties": {
"alertRuleTemplateName": "efe4efef-5ca7-4b51-a53e-0e96492ce97a",
"customDetails": null,
"description": "The query checks for any file which has been created/written by an Office application and shortly after renamed to one of the deny-listed \"executable extensions\" which are text files. (e.g. ps1, .js, .vbs).\n",
"displayName": "ASR Bypassing Writing Executable Content",
"enabled": true,
"entityMappings": [
{
"entityType": "Host",
"fieldMappings": [
{
"columnName": "DeviceName",
"identifier": "FullName"
}
]
},
{
"entityType": "Account",
"fieldMappings": [
{
"columnName": "InitiatingProcessAccountSid",
"identifier": "Sid"
},
{
"columnName": "InitiatingProcessAccountName",
"identifier": "Name"
},
{
"columnName": "InitiatingProcessAccountDomain",
"identifier": "NTDomain"
}
]
},
{
"entityType": "Process",
"fieldMappings": [
{
"columnName": "InitiatingProcessCommandLine",
"identifier": "CommandLine"
}
]
}
],
"OriginalUri": "https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/FalconFriday/Analytic Rules/ASRBypassingWritingExecutableContent.yaml",
"query": "let timeframe = 1d;\nlet executableExtensions = dynamic([\".js\", \".hta\", \".lnk\", \".application\", \".vb\", \".vba\", \".vbs\", \".ps\", \".ps1\", \".bat\", \".cmd\"]);\nDeviceFileEvents\n| where Timestamp >= ago(timeframe)\n| where InitiatingProcessFileName in~ (\"winword.exe\", \"excel.exe\", \"outlook.exe\", \"powerpnt.exe\")\n| where ActionType == \"FileRenamed\"\n// The mv-apply is less performance compared to doing a full written out !endswith. We kept the mv-apply since We don't hit any limits and get more readable/maintainable code.\n| mv-apply ext=executableExtensions to typeof(string) on\n(\n where PreviousFileName !endswith ext and FileName endswith ext\n)\n| project-reorder PreviousFileName, FileName\n// Begin allow-list.\n// End allow-list.\n",
"queryFrequency": "PT1H",
"queryPeriod": "PT1H",
"severity": "Medium",
"status": "Available",
"subTechniques": [],
"suppressionDuration": "PT1H",
"suppressionEnabled": false,
"tactics": [
"DefenseEvasion"
],
"techniques": [
"T1211"
],
"templateVersion": "1.0.0",
"triggerOperator": "GreaterThan",
"triggerThreshold": 0
},
"type": "Microsoft.OperationalInsights/workspaces/providers/alertRules"
}
]
}