Identify SysAid Server web shell creation
| Id | 50eb4cbd-188f-44f4-b964-bab84dcdec10 |
| Rulename | Identify SysAid Server web shell creation |
| Description | This query looks for potential webshell creation by the threat actor Mercury after the sucessful exploitation of SysAid server. Reference: https://www.microsoft.com/security/blog/2022/08/25/mercury-leveraging-log4j-2-vulnerabilities-in-unpatched-systems-to-target-israeli-organizations/ |
| Severity | High |
| Tactics | InitialAccess |
| Techniques | T1190 |
| Required data connectors | MicrosoftThreatProtection SecurityEvents WindowsSecurityEvents |
| Kind | Scheduled |
| Query frequency | 1d |
| Query period | 1d |
| Trigger threshold | 0 |
| Trigger operator | gt |
| Source Uri | https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Web Shells Threat Protection/Analytic Rules/PotentialMercury_Webshell.yaml |
| Version | 1.0.3 |
| Arm template | 50eb4cbd-188f-44f4-b964-bab84dcdec10.json |
let timeframe = 1d;
let time_window = 5m;
(union isfuzzy=true
(SecurityEvent
| where TimeGenerated > ago(timeframe)
| where EventID == 4688
| where Process has_any ("java.exe", "javaw.exe") and CommandLine has "SysAidServer"
| summarize by ParentProcessName,Process, Account, Computer, CommandLine, timekey= bin(TimeGenerated, time_window), TimeGenerated, SubjectLogonId
| join kind=inner(
SecurityEvent
| where TimeGenerated > ago(timeframe)
| where EventID == 4663
| where Process has_any ("java.exe", "javaw.exe")
| where AccessMask in ('0x2','0x100', '0x10', '0x4')
| where ObjectName endswith ".jsp"
| summarize by ParentProcessName, Account, Computer, ObjectName, ProcessName, timekey= bin(TimeGenerated, time_window), TimeGenerated, SubjectLogonId)
on timekey, Computer, SubjectLogonId
),
(DeviceFileEvents
| where InitiatingProcessFileName has_any ("java.exe", "javaw.exe")
| where InitiatingProcessCommandLine has "SysAidServer"
| where FileName endswith ".jsp"
| extend Account = strcat(InitiatingProcessAccountDomain, @'\', InitiatingProcessAccountName), Computer = DeviceName
),
(imFileEvent
| where TimeGenerated > ago(timeframe)
| where EventType == "FileCreated"
| where ActingProcessName has_any ("java.exe", "javaw.exe")
| where ActingProcessCommandLine has "SysAidServer"
| where FilePath endswith ".jsp"
| extend Account = ActorUsername, Computer = DvcHostname
)
)
| extend AccountName = tostring(split(Account, @'\')[1]), AccountNTDomain = tostring(split(Account, @'\')[0])
| extend HostName = tostring(split(Computer, ".")[0]), DomainIndex = toint(indexof(Computer, '.'))
| extend HostNameDomain = iff(DomainIndex != -1, substring(Computer, DomainIndex + 1), Computer)
version: 1.0.3
triggerOperator: gt
OriginalUri: https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Web Shells Threat Protection/Analytic Rules/PotentialMercury_Webshell.yaml
description: |
'This query looks for potential webshell creation by the threat actor Mercury after the sucessful exploitation of SysAid server.
Reference: https://www.microsoft.com/security/blog/2022/08/25/mercury-leveraging-log4j-2-vulnerabilities-in-unpatched-systems-to-target-israeli-organizations/'
queryFrequency: 1d
name: Identify SysAid Server web shell creation
tactics:
- InitialAccess
triggerThreshold: 0
id: 50eb4cbd-188f-44f4-b964-bab84dcdec10
query: |
let timeframe = 1d;
let time_window = 5m;
(union isfuzzy=true
(SecurityEvent
| where TimeGenerated > ago(timeframe)
| where EventID == 4688
| where Process has_any ("java.exe", "javaw.exe") and CommandLine has "SysAidServer"
| summarize by ParentProcessName,Process, Account, Computer, CommandLine, timekey= bin(TimeGenerated, time_window), TimeGenerated, SubjectLogonId
| join kind=inner(
SecurityEvent
| where TimeGenerated > ago(timeframe)
| where EventID == 4663
| where Process has_any ("java.exe", "javaw.exe")
| where AccessMask in ('0x2','0x100', '0x10', '0x4')
| where ObjectName endswith ".jsp"
| summarize by ParentProcessName, Account, Computer, ObjectName, ProcessName, timekey= bin(TimeGenerated, time_window), TimeGenerated, SubjectLogonId)
on timekey, Computer, SubjectLogonId
),
(DeviceFileEvents
| where InitiatingProcessFileName has_any ("java.exe", "javaw.exe")
| where InitiatingProcessCommandLine has "SysAidServer"
| where FileName endswith ".jsp"
| extend Account = strcat(InitiatingProcessAccountDomain, @'\', InitiatingProcessAccountName), Computer = DeviceName
),
(imFileEvent
| where TimeGenerated > ago(timeframe)
| where EventType == "FileCreated"
| where ActingProcessName has_any ("java.exe", "javaw.exe")
| where ActingProcessCommandLine has "SysAidServer"
| where FilePath endswith ".jsp"
| extend Account = ActorUsername, Computer = DvcHostname
)
)
| extend AccountName = tostring(split(Account, @'\')[1]), AccountNTDomain = tostring(split(Account, @'\')[0])
| extend HostName = tostring(split(Computer, ".")[0]), DomainIndex = toint(indexof(Computer, '.'))
| extend HostNameDomain = iff(DomainIndex != -1, substring(Computer, DomainIndex + 1), Computer)
severity: High
metadata:
categories:
domains:
- Security - Others
source:
kind: Scheduled
support:
tier: Community
author:
name: Microsoft Security Research
tags:
- Mercury
- SchemaVersion: 0.1.0
Schema: ASIMFileEvent
queryPeriod: 1d
entityMappings:
- fieldMappings:
- columnName: Account
identifier: FullName
- columnName: AccountName
identifier: Name
- columnName: AccountNTDomain
identifier: NTDomain
entityType: Account
- fieldMappings:
- columnName: Computer
identifier: FullName
- columnName: HostName
identifier: HostName
- columnName: HostNameDomain
identifier: DnsDomain
entityType: Host
relevantTechniques:
- T1190
kind: Scheduled
requiredDataConnectors:
- connectorId: SecurityEvents
dataTypes:
- SecurityEvent
- connectorId: WindowsSecurityEvents
dataTypes:
- SecurityEvent
- connectorId: MicrosoftThreatProtection
dataTypes:
- DeviceFileEvents