Detection rules › YARA-L

YARA-L rules: 1p

AWS SES Service Modification

#
Severity
medium
Type
Alert
Time window
1h
Match by
user_id
Author
Google Cloud Security
Source
github.com/chronicle/detection-rules

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

TacticTechniques
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_type is one of:
    • CreateEmailIdentity
    • DeleteEmailIdentity
    • VerifyEmailIdentity
    • VerifyDomainIdentity
    • VerifyDomainDkim
  • metadata.product_event_type is one of:
    • UpdateAccountSendingEnabled
    • UpdateConfigurationSetSendingEnabled
  • target.resource.attribute.labels["enabled"] = "true"
  • metadata.product_event_type is one of:
    • PutAccountSendingAttributes
    • PutConfigurationSetSendingOptions
  • target.resource.attribute.labels["sendingEnabled"] = "true"
  • security_result.action = "ALLOW"

Match and Correlation

Match key
$user_id (principal.user.userid)
Within
1h

Outcome

Outcome variables add context to a detection. When the rule generates an alert, $risk_score is displayed with it.

FieldExpression
risk_scoremax(50)
event_countcount_distinct($cloudtrail.metadata.id)
network_http_user_agentarray_distinct($cloudtrail.network.http.user_agent)
principal_iparray_distinct($cloudtrail.principal.ip)
principal_ip_countryarray_distinct($cloudtrail.principal.ip_geo_artifact.location.country_or_region)
principal_ip_statearray_distinct($cloudtrail.principal.ip_geo_artifact.location.state)
principal_user_display_namearray_distinct($cloudtrail.principal.user.user_display_name)
recipient_aws_account_idarray_distinct($cloudtrail.additional.fields["recipientAccountId"])
aws_regionarray_distinct($cloudtrail.principal.location.name)
target_resource_namearray_distinct($cloudtrail.target.resource.name)
target_resource_product_object_idarray_distinct($cloudtrail.target.resource.product_object_id)

Hacktool - WinPEAS Execution Patterns

#
Type
alert
Time window
10m
Match by
hostname
Author
Georg Lauenstein - suresecure GmbH
Source
github.com/chronicle/detection-rules

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

TacticTechniques
Discovery

References

Telemetry Coverage

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 PROCESS_LAUNCH (1, 4688)

  • 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

Match key
$hostname (principal.hostname)
Within
10m

Outcome

Outcome variables add context to a detection. When the rule generates an alert, $risk_score is displayed with it.

FieldExpression
risk_scoremax(65)
event_countcount_distinct($winpeas_execution.metadata.id)
principal_process_pidarray_distinct($winpeas_execution.principal.process.pid)
principal_process_command_linearray_distinct($winpeas_execution.principal.process.command_line)
principal_process_file_sha256array_distinct($winpeas_execution.principal.process.file.sha256)
principal_process_file_full_patharray_distinct($winpeas_execution.principal.process.file.full_path)
principal_process_product_specific_process_idarray_distinct($winpeas_execution.principal.process.product_specific_process_id)
principal_process_parent_process_product_specific_process_idarray_distinct($winpeas_execution.principal.process.parent_process.product_specific_process_id)
target_process_pidarray_distinct($winpeas_execution.target.process.pid)
target_process_command_linearray_distinct($winpeas_execution.target.process.command_line)
target_process_file_sha256array_distinct($winpeas_execution.target.process.file.sha256)
target_process_file_full_patharray_distinct($winpeas_execution.target.process.file.full_path)
target_process_product_specific_process_idarray_distinct($winpeas_execution.target.process.product_specific_process_id)
principal_user_useridarray_distinct($winpeas_execution.principal.user.userid)

Office 365 Teams member removed

#
Severity
low
Type
alert
Time window
5m
Match by
userid
Author
Google Cloud Security
Source
github.com/chronicle/detection-rules

Detects when a user is removed from a group in Microsoft Teams.

Telemetry Coverage

PlatformRecord / event type
Microsoft 365MemberRemoved

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 USER_CHANGE_PERMISSIONS

  • metadata.log_type = "OFFICE_365"
  • metadata.product_event_type = "MemberRemoved"
  • target.application = "MicrosoftTeams"
  • security_result.action = "UNKNOWN_ACTION"

Match and Correlation

Match key
$userid (about.user.user_display_name)
Within
5m

Outcome

Outcome variables add context to a detection. When the rule generates an alert, $risk_score is displayed with it.

FieldExpression
risk_score35
event_countcount_distinct($app.metadata.id)
target_applicationarray_distinct($app.target.application)
principal_user_useridarray_distinct($app.principal.user.userid)
group_namearray_distinct($app.target.group.group_display_name)
group_idarray_distinct($app.target.group.product_object_id)
removed_user_emailarray_distinct($app.about.user.email_addresses)
removed_user_namearray_distinct($app.about.user.user_display_name)

sap hanadb deactivation of audit trail

#
Severity
critical
Time window
30m
Match by
user
Author
Google Cloud Security
Source
github.com/chronicle/detection-rules

Detects the deactivation of the global auditing state in SAP HANA, which stops all audit logging.

MITRE ATT&CK Coverage

TacticTechniques
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

Match key
$user
Within
30m

Outcome

Outcome variables add context to a detection. When the rule generates an alert, $risk_score is displayed with it.

FieldExpression
risk_scoremax(95)
principal_userarray_distinct($user)
system_idarray_distinct($e.target.resource.attribute.labels["system_id"])
prev_valuearray_distinct($e.target.resource.attribute.labels["old_value"])
new_valuearray_distinct($e.target.resource.attribute.labels["new_value"])
actionarray_distinct($e.security_result.action)

Back to all YARA-L rules