Detection rules › YARA-L
YARA-L rules: 1p
| Rule | Severity |
|---|---|
| AWS SES Service Modification | medium |
| Hacktool - WinPEAS Execution Patterns | |
| Office 365 Teams member removed | low |
| sap hanadb deactivation of audit trail | critical |
AWS SES Service Modification
#Detect when the Amazon Simple Email Service (SES) has been modified where an attacker can modify Amazon SES service to propagate phishing emails campaigns.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Impact |
Telemetry Coverage
Rule Body
// Copyright 2023 Google LLC. Licensed under Apache-2.0.
rule aws_ses_service_modification {
meta:
author = "Google Cloud Security"
description = "Detect when the Amazon Simple Email Service (SES) has been modified where an attacker can modify Amazon SES service to propagate phishing emails campaigns."
rule_id = "mr_223bad6a-9c6a-4038-9990-18d3545598aa"
rule_name = "AWS SES Service Modification"
mitre_attack_tactic = "Impact"
mitre_attack_technique = "Resource Hijacking"
mitre_attack_url = "https://attack.mitre.org/techniques/T1496/"
mitre_attack_version = "v13.1"
type = "Alert"
data_source = "AWS CloudTrail"
platform = "AWS"
severity = "Medium"
priority = "Medium"
events:
$cloudtrail.metadata.vendor_name = "AMAZON"
$cloudtrail.metadata.product_name = "AWS CloudTrail"
(
$cloudtrail.metadata.product_event_type = "CreateEmailIdentity" or
$cloudtrail.metadata.product_event_type = "DeleteEmailIdentity" or
$cloudtrail.metadata.product_event_type = "VerifyEmailIdentity" or
$cloudtrail.metadata.product_event_type = "VerifyDomainIdentity" or
$cloudtrail.metadata.product_event_type = "VerifyDomainDkim"
)
or
(
(
$cloudtrail.metadata.product_event_type = "UpdateAccountSendingEnabled" or
$cloudtrail.metadata.product_event_type = "UpdateConfigurationSetSendingEnabled"
)
and $cloudtrail.target.resource.attribute.labels["enabled"] = "true"
)
or
(
(
$cloudtrail.metadata.product_event_type = "PutAccountSendingAttributes" or
$cloudtrail.metadata.product_event_type = "PutConfigurationSetSendingOptions"
)
and $cloudtrail.target.resource.attribute.labels["sendingEnabled"] = "true"
)
$cloudtrail.security_result.action = "ALLOW"
$cloudtrail.principal.user.userid = $user_id
match:
$user_id over 1h
outcome:
$risk_score = max(50)
$mitre_attack_tactic = "Impact"
$mitre_attack_technique = "Resource Hijacking"
$mitre_attack_technique_id = "T1496"
$event_count = count_distinct($cloudtrail.metadata.id)
$network_http_user_agent = array_distinct($cloudtrail.network.http.user_agent)
$principal_ip = array_distinct($cloudtrail.principal.ip)
$principal_ip_country = array_distinct($cloudtrail.principal.ip_geo_artifact.location.country_or_region)
$principal_ip_state = array_distinct($cloudtrail.principal.ip_geo_artifact.location.state)
$principal_user_display_name = array_distinct($cloudtrail.principal.user.user_display_name)
$recipient_aws_account_id = array_distinct($cloudtrail.additional.fields["recipientAccountId"])
$aws_region = array_distinct($cloudtrail.principal.location.name)
$target_resource_name = array_distinct($cloudtrail.target.resource.name)
$target_resource_product_object_id = array_distinct($cloudtrail.target.resource.product_object_id)
condition:
$cloudtrail
}
YARA-L Rule Structure
Condition
Fires when at least one $cloudtrail event in the 1h window.
Events
$cloudtrail
metadata.product_event_typeis one of:CreateEmailIdentityDeleteEmailIdentityVerifyEmailIdentityVerifyDomainIdentityVerifyDomainDkim
metadata.product_event_typeis one of:UpdateAccountSendingEnabledUpdateConfigurationSetSendingEnabled
target.resource.attribute.labels["enabled"] = "true"metadata.product_event_typeis one of:PutAccountSendingAttributesPutConfigurationSetSendingOptions
target.resource.attribute.labels["sendingEnabled"] = "true"security_result.action = "ALLOW"
Match and Correlation
Outcome
Outcome variables add context to a detection. When the rule generates an alert, $risk_score is displayed with it.
| Field | Expression |
|---|---|
risk_score | max(50) |
event_count | count_distinct($cloudtrail.metadata.id) |
network_http_user_agent | array_distinct($cloudtrail.network.http.user_agent) |
principal_ip | array_distinct($cloudtrail.principal.ip) |
principal_ip_country | array_distinct($cloudtrail.principal.ip_geo_artifact.location.country_or_region) |
principal_ip_state | array_distinct($cloudtrail.principal.ip_geo_artifact.location.state) |
principal_user_display_name | array_distinct($cloudtrail.principal.user.user_display_name) |
recipient_aws_account_id | array_distinct($cloudtrail.additional.fields["recipientAccountId"]) |
aws_region | array_distinct($cloudtrail.principal.location.name) |
target_resource_name | array_distinct($cloudtrail.target.resource.name) |
target_resource_product_object_id | array_distinct($cloudtrail.target.resource.product_object_id) |
Hacktool - WinPEAS Execution Patterns
#This detection rule identifies the execution of WinPEAS (Windows Privilege Escalation Awesome Script), a post-exploitation reconnaissance tool used to discover privilege escalation paths on Windows systems. WinPEAS performs a wide range of local enumeration checks, including service misconfigurations, permission issues, token privileges, and more. Its usage is commonly observed during red team assessments and by adversaries seeking to elevate privileges after gaining initial access. WinPEAS checks are well-documented in the HackTricks knowledge base.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Discovery |
References
- https://github.com/carlospolop/PEASS-ng
- https://book.hacktricks.wiki/en/windows-hardening/windows-local-privilege-escalation/index.html
- https://www.microsoft.com/en-us/security/blog/2022-10-14/new-prestige-ransomware-impacts-organizations-in-ukraine-and-poland/
- https://www.logpoint.com/wp-content/uploads/2023/02/emerging-threats-the-play-report.pdf
Telemetry Coverage
| Provider | Record / event type |
|---|---|
| Sysmon | Event ID 1: Process creation |
| Security-Auditing | Event ID 4688: A new process has been created. |
Rule Body
// Copyright 2025 Google LLC. Licensed under Apache-2.0.
rule hacktool_winpeas_execution_patterns {
meta:
author = "Georg Lauenstein - suresecure GmbH"
description = "This detection rule identifies the execution of WinPEAS (Windows Privilege Escalation Awesome Script), a post-exploitation reconnaissance tool used to discover privilege escalation paths on Windows systems. WinPEAS performs a wide range of local enumeration checks, including service misconfigurations, permission issues, token privileges, and more. Its usage is commonly observed during red team assessments and by adversaries seeking to elevate privileges after gaining initial access. WinPEAS checks are well-documented in the HackTricks knowledge base."
rule_id = "mr_9c9ad668-485a-4b10-b85d-36ba63546304"
rule_name = "Hacktool - WinPEAS Execution Patterns"
tactic = "TA0007"
technique = "T1082"
references = "https://github.com/carlospolop/PEASS-ng, https://book.hacktricks.wiki/en/windows-hardening/windows-local-privilege-escalation/index.html, https://www.microsoft.com/en-us/security/blog/2022-10-14/new-prestige-ransomware-impacts-organizations-in-ukraine-and-poland/, https://www.logpoint.com/wp-content/uploads/2023/02/emerging-threats-the-play-report.pdf"
type = "alert"
platform = "Windows, EDR"
data_source = "Microsoft Sysmon, Windows Event Logs"
severity = "Medium" // Adjust based on your risk assessment
priority = "Medium" // Adjust based on your incident response process
events:
$winpeas_execution.metadata.event_type = "PROCESS_LAUNCH"
and
(
$winpeas_execution.src.process.file.full_path = /winPEAS.exe|winPEASany.exe|winPEASany_ofs.exe|winPEASx64.exe|winPEASx64_ofs.exe|winPEASx86.exe|winPEASx86_ofs.exe/ nocase or
$winpeas_execution.target.process.file.full_path = /\\winPEAS\.exe|\\winPEASany\.exe|\\winPEASany_ofs\.exe|\\winPEASx64\.exe|\\winPEASx64_ofs\.exe|\\winPEASx86\.exe|\\winPEASx86_ofs\.exe/ nocase or
$winpeas_execution.target.process.command_line = /processinfo|servicesinfo|applicationsinfo|networkinfo|windowscreds|browserinfo|filesinfo|fileanalysis|eventsinfo/ nocase
or
(
$winpeas_execution.target.process.command_line = /raw\.githubusercontent\.com/ nocase and
$winpeas_execution.target.process.command_line = /carlospolop/ nocase and
$winpeas_execution.target.process.command_line = /winPEAS\.ps1/ nocase
)
or
(
$winpeas_execution.principal.process.command_line = / -linpeas$/ nocase or
$winpeas_execution.target.process.command_line = / -linpeas$/ nocase
)
)
not
(
// Exclusion: Microsoft Defender Threat Protection Sensor Updates
$winpeas_execution.additional.fields["current_directory"] = "C:\\ProgramData\\Microsoft\\Windows Defender Advanced Threat Protection\\Downloads\\"
)
// Capture the hostname where the event occurred
$winpeas_execution.principal.hostname = $hostname
match:
$hostname over 10m
outcome:
$risk_score = max(65)
$event_count = count_distinct($winpeas_execution.metadata.id)
$principal_process_pid = array_distinct($winpeas_execution.principal.process.pid)
$principal_process_command_line = array_distinct($winpeas_execution.principal.process.command_line)
$principal_process_file_sha256 = array_distinct($winpeas_execution.principal.process.file.sha256)
$principal_process_file_full_path = array_distinct($winpeas_execution.principal.process.file.full_path)
$principal_process_product_specific_process_id = array_distinct($winpeas_execution.principal.process.product_specific_process_id)
$principal_process_parent_process_product_specific_process_id = array_distinct($winpeas_execution.principal.process.parent_process.product_specific_process_id)
$target_process_pid = array_distinct($winpeas_execution.target.process.pid)
$target_process_command_line = array_distinct($winpeas_execution.target.process.command_line)
$target_process_file_sha256 = array_distinct($winpeas_execution.target.process.file.sha256)
$target_process_file_full_path = array_distinct($winpeas_execution.target.process.file.full_path)
$target_process_product_specific_process_id = array_distinct($winpeas_execution.target.process.product_specific_process_id)
$principal_user_userid = array_distinct($winpeas_execution.principal.user.userid)
condition:
$winpeas_execution
}
YARA-L Rule Structure
Condition
Fires when at least one $winpeas_execution event in the 10m window.
Events
$winpeas_execution
src.process.file.full_path matches "winPEAS.exe|winPEASany.exe|winPEASany_ofs.exe|winPEASx64.exe|winPEASx64_ofs.exe|winPEASx86.exe|winPEASx86_ofs.exe"target.process.file.full_path matches "\\winPEAS\.exe|\\winPEASany\.exe|\\winPEASany_ofs\.exe|\\winPEASx64\.exe|\\winPEASx64_ofs\.exe|\\winPEASx86\.exe|\\winPEASx86_ofs\.exe"target.process.command_line matches "processinfo|servicesinfo|applicationsinfo|networkinfo|windowscreds|browserinfo|filesinfo|fileanalysis|eventsinfo"target.process.command_line matches "raw\.githubusercontent\.com"target.process.command_line matches "carlospolop"target.process.command_line matches "winPEAS\.ps1"principal.process.command_line matches " -linpeas$"target.process.command_line matches " -linpeas$"additional.fields["current_directory"] = "C:\ProgramData\Microsoft\Windows Defender Advanced Threat Protection\Downloads\"
Match and Correlation
Outcome
Outcome variables add context to a detection. When the rule generates an alert, $risk_score is displayed with it.
| Field | Expression |
|---|---|
risk_score | max(65) |
event_count | count_distinct($winpeas_execution.metadata.id) |
principal_process_pid | array_distinct($winpeas_execution.principal.process.pid) |
principal_process_command_line | array_distinct($winpeas_execution.principal.process.command_line) |
principal_process_file_sha256 | array_distinct($winpeas_execution.principal.process.file.sha256) |
principal_process_file_full_path | array_distinct($winpeas_execution.principal.process.file.full_path) |
principal_process_product_specific_process_id | array_distinct($winpeas_execution.principal.process.product_specific_process_id) |
principal_process_parent_process_product_specific_process_id | array_distinct($winpeas_execution.principal.process.parent_process.product_specific_process_id) |
target_process_pid | array_distinct($winpeas_execution.target.process.pid) |
target_process_command_line | array_distinct($winpeas_execution.target.process.command_line) |
target_process_file_sha256 | array_distinct($winpeas_execution.target.process.file.sha256) |
target_process_file_full_path | array_distinct($winpeas_execution.target.process.file.full_path) |
target_process_product_specific_process_id | array_distinct($winpeas_execution.target.process.product_specific_process_id) |
principal_user_userid | array_distinct($winpeas_execution.principal.user.userid) |
Office 365 Teams member removed
#Detects when a user is removed from a group in Microsoft Teams.
Telemetry Coverage
| Platform | Record / event type |
|---|---|
| Microsoft 365 | MemberRemoved |
Rules Detecting the Same Action
These rules filter on the same operation.
Rule Body
// Copyright 2025 Google LLC. Licensed under Apache-2.0.
rule o365_teams_member_removed {
meta:
author = "Google Cloud Security"
description = "Detects when a user is removed from a group in Microsoft Teams."
rule_id = "mr_9cbf9cc6-35ae-44bd-8c2c-3ed4f8ea528f"
rule_name = "Office 365 Teams member removed"
type = "alert"
platform = "azure"
data_source = "o365"
severity = "Low"
priority = "Low"
events:
$app.metadata.product_name = "Office 365"
$app.metadata.vendor_name = "Microsoft"
$app.metadata.log_type = "OFFICE_365"
$app.metadata.product_event_type = "MemberRemoved"
$app.about.user.user_display_name = $userid
$app.target.application = "MicrosoftTeams"
$app.metadata.event_type = "USER_CHANGE_PERMISSIONS"
$app.security_result.action = "UNKNOWN_ACTION"
match:
$userid over 5m
outcome:
$risk_score = 35
$event_count = count_distinct($app.metadata.id)
$target_application = array_distinct($app.target.application)
$principal_user_userid = array_distinct($app.principal.user.userid)
$group_name = array_distinct($app.target.group.group_display_name)
$group_id = array_distinct($app.target.group.product_object_id)
$removed_user_email = array_distinct($app.about.user.email_addresses)
$removed_user_name = array_distinct($app.about.user.user_display_name)
condition:
$app
}
YARA-L Rule Structure
Condition
Fires when at least one $app event in the 5m window.
Events
$app
metadata.log_type = "OFFICE_365"metadata.product_event_type = "MemberRemoved"target.application = "MicrosoftTeams"security_result.action = "UNKNOWN_ACTION"
Match and Correlation
Outcome
Outcome variables add context to a detection. When the rule generates an alert, $risk_score is displayed with it.
| Field | Expression |
|---|---|
risk_score | 35 |
event_count | count_distinct($app.metadata.id) |
target_application | array_distinct($app.target.application) |
principal_user_userid | array_distinct($app.principal.user.userid) |
group_name | array_distinct($app.target.group.group_display_name) |
group_id | array_distinct($app.target.group.product_object_id) |
removed_user_email | array_distinct($app.about.user.email_addresses) |
removed_user_name | array_distinct($app.about.user.user_display_name) |
sap hanadb deactivation of audit trail
#Detects the deactivation of the global auditing state in SAP HANA, which stops all audit logging.
MITRE ATT&CK Coverage
| Tactic | Techniques |
|---|---|
| Defense Impairment |
Rule Body
// Copyright 2026 Google LLC. Licensed under Apache-2.0.
rule sap_hanadb_deactivation_of_audit_trail {
meta:
author = "Google Cloud Security"
description = "Detects the deactivation of the global auditing state in SAP HANA, which stops all audit logging."
severity = "Critical"
tactic = "TA0005"
technique = "T1562.001"
events:
$e.metadata.product_name = "SAP_HANA_AUDIT"
(
$e.metadata.product_event_type = /AUDIT CONFIGURATION/ nocase and
$e.target.resource.attribute.labels["parameter"] = "global_auditing_state" nocase and
$e.target.resource.attribute.labels["new_value"] = "false" nocase
) or
(
$e.metadata.product_event_type = "SYSTEM CONFIGURATION CHANGE" nocase and
$e.additional.fields["executed_statement"] = /ALTER SYSTEM ALTER CONFIGURATION/ nocase and
$e.additional.fields["executed_statement"] = /UNSET/ nocase
)
$user = $e.principal.user.userid
match:
$user over 30m
outcome:
$risk_score = max(95)
$principal_user = array_distinct($user)
$system_id = array_distinct($e.target.resource.attribute.labels["system_id"])
$prev_value = array_distinct($e.target.resource.attribute.labels["old_value"])
$new_value = array_distinct($e.target.resource.attribute.labels["new_value"])
$action = array_distinct($e.security_result.action)
condition:
$e
}
YARA-L Rule Structure
Condition
Fires when at least one $e event in the 30m window.
Events
$e
metadata.product_event_type matches "AUDIT CONFIGURATION"target.resource.attribute.labels["parameter"] = "global_auditing_state"target.resource.attribute.labels["new_value"] = "false"metadata.product_event_type = "SYSTEM CONFIGURATION CHANGE"additional.fields["executed_statement"] matches "ALTER SYSTEM ALTER CONFIGURATION"additional.fields["executed_statement"] matches "UNSET"
Match and Correlation
Outcome
Outcome variables add context to a detection. When the rule generates an alert, $risk_score is displayed with it.
| Field | Expression |
|---|---|
risk_score | max(95) |
principal_user | array_distinct($user) |
system_id | array_distinct($e.target.resource.attribute.labels["system_id"]) |
prev_value | array_distinct($e.target.resource.attribute.labels["old_value"]) |
new_value | array_distinct($e.target.resource.attribute.labels["new_value"]) |
action | array_distinct($e.security_result.action) |