adfs_db_suspicious_named_pipe_connection
Description
Connection to ADFS via named pipes that are not using specific Windows ADFS processes may be indicative of user attempting to access ADFS for suspicious purposes
Query · yara_l
events:
$process.metadata.event_type = "PROCESS_UNCATEGORIZED"
$process.metadata.product_event_type = "18"
$process.metadata.product_name = "Microsoft-Windows-Sysmon"
not re.regex($process.target.process.file.full_path, `Microsoft.Identity.Health.Adfs.PshSurrogate.exe|Microsoft.IdentityServer.ServiceHost.exe|AzureADConnect.exe|Microsoft.Tri.Sensor.exe|wsmprovhost.exe|mmc.exe|sqlservr.exe|sqlwriter.exe`) nocase
$process.target.resource.name = "\\MICROSOFT##WID\\tsql\\query" nocase
/*
If you have a listing of ADFS servers, you can use a reference list or enumerate them in the field below.
Alternatively, if ADFS servers are grouped in an asset attribute, that attribute could be used instead.
*/
$process.principal.hostname = /adfs/ nocase
$process.principal.hostname = $hostname
match:
$hostname over 5m
outcome:
$risk_score = 65
$event_count = count_distinct($process.metadata.id)
$security_summary = array_distinct($process.security_result.summary)
$target_process_parent_process_command_line = array_distinct($process.target.process.parent_process.command_line)
//added to populate alert graph with additional context
//Commented out because it is the same as the match variable, if match variable changes, uncomment to use
//$principal_hostname = array_distinct($process.principal.hostname)
$principal_user_userid = array_distinct($process.principal.user.userid)
$target_process_pid = array_distinct($process.target.process.pid)
$target_process_command_line = array_distinct($process.target.process.command_line)
$target_process_file_sha256 = array_distinct($process.target.process.file.sha256)
$target_process_file_full_path = array_distinct($process.target.process.file.full_path)
$target_process_product_specific_process_id = array_distinct($process.target.process.product_specific_process_id)
$target_process_parent_product_specific_process_id = array_distinct($process.target.process.parent_process.product_specific_process_id)
$target_resource_name = array_distinct($process.target.resource.name)
condition:
$process