Detection rules › YARA-L

YARA-L rules: 2v

AWS S3 Public Access Block Removed

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

Detect when the S3 Public Access Block configuration has been removed from a bucket or an account.

MITRE ATT&CK Coverage

TacticTechniques
Defense Impairment

Telemetry Coverage

Rule Body

// Copyright 2023 Google LLC. Licensed under Apache-2.0.

rule aws_s3_public_access_block_removed {
  meta:
    author = "Google Cloud Security"
    description = "Detect when the S3 Public Access Block configuration has been removed from a bucket or an account."
    rule_id = "mr_07638aec-6719-467b-9fee-8de4993087fa"
    rule_name = "AWS S3 Public Access Block Removed"
    mitre_attack_tactic = "Defense Evasion"
    mitre_attack_technique = "Impair Defenses"
    mitre_attack_url = "https://attack.mitre.org/techniques/T1562/"
    mitre_attack_version = "v13.1"
    type = "Alert"
    data_source = "AWS CloudTrail"
    platform = "AWS"
    severity = "High"
    priority = "High"

  events:
    $cloudtrail.metadata.vendor_name = "AMAZON"
    $cloudtrail.metadata.product_name = "AWS CloudTrail"
    (
      $cloudtrail.metadata.product_event_type = "DeleteAccountPublicAccessBlock" or
      $cloudtrail.metadata.product_event_type = "DeleteBucketPublicAccessBlock" or
      (
        (
          $cloudtrail.metadata.product_event_type = "PutBucketPublicAccessBlock" or
          $cloudtrail.metadata.product_event_type = "PutAccountPublicAccessBlock"
        )
        and
        (
          $cloudtrail.target.resource.attribute.labels["RestrictPublicBuckets"] = "true" or
          $cloudtrail.target.resource.attribute.labels["BlockPublicPolicy"] = "true" or
          $cloudtrail.target.resource.attribute.labels["BlockPublicAcls"] = "true" or
          $cloudtrail.target.resource.attribute.labels["IgnorePublicAcls"] = "true"
        )
      )
    )
    $cloudtrail.security_result.action = "ALLOW"
    $cloudtrail.principal.user.userid = $user_id

  match:
    $user_id over 1h

  outcome:
    $risk_score = max(75)
    $mitre_attack_tactic = "Defense Evasion"
    $mitre_attack_technique = "Impair Defenses"
    $mitre_attack_technique_id = "T1562"
    $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 = "DeleteAccountPublicAccessBlock"
  • metadata.product_event_type = "DeleteBucketPublicAccessBlock"
  • metadata.product_event_type is one of:
    • PutBucketPublicAccessBlock
    • PutAccountPublicAccessBlock
  • target.resource.attribute.labels["RestrictPublicBuckets"] = "true"
  • target.resource.attribute.labels["BlockPublicPolicy"] = "true"
  • target.resource.attribute.labels["BlockPublicAcls"] = "true"
  • target.resource.attribute.labels["IgnorePublicAcls"] = "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(75)
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)

Multiple failed file downloads from OneDrive observed in the Microsoft Graph API

#
Severity
low
Type
alert
Time window
15m
Match by
ip, session, url
Author
Google Cloud Security
Source
github.com/chronicle/detection-rules

This detects when a 401 Unauthorized status is received on multiple attempts of the same file when attempting to download from OneDrive and may indicate a permissions issue for the user.

Rule Body

// Copyright 2025 Google LLC. Licensed under Apache-2.0.

rule ms_graph_failed_file_downloads_multiple_attempts {

  meta:
    author = "Google Cloud Security"
    description = "This detects when a 401 Unauthorized status is received on multiple attempts of the same file when attempting to download from OneDrive and may indicate a permissions issue for the user."
    rule_id = "mr_1117b547-0f30-444e-b10e-c9cfdf00f1f5"
    rule_name = "Multiple failed file downloads from OneDrive observed in the Microsoft Graph API"
    type = "alert"
    data_source = "MS Graph Activity Logs"
    platform = "Azure"
    severity = "Low"
    priority = "Low"

  events:
    $api.metadata.event_type = "NETWORK_HTTP"
    $api.metadata.product_event_type = "Microsoft Graph Activity"
    re.regex($api.target.url, `^https://graph\.microsoft\.com/v1\.0/drives/.*/content$`) nocase
    //Can be tuned for specific User Agent strings being used - by default GraphRunner does not forge the UA for this action
    //$api.network.http.user_agent = /PowerShell/ nocase
    $api.network.http.method = "GET"
    $api.network.http.response_code = 401
    $api.principal.ip = $ip
    $api.network.session_id = $session
    $api.target.url = $url

  match:
    $ip, $session, $url over 15m

  outcome:
    $risk_score = 35
    $event_count = count_distinct($api.metadata.id)
    $doc_count = count_distinct($api.target.url)
    $requesting_user_guid = array_distinct($api.principal.user.userid)
    $requesting_ip = array_distinct($api.principal.ip)
    $user_agent = array_distinct($api.network.http.user_agent)
    $location = array_distinct($api.principal.location.name)
    $target_application_id_guid = array_distinct($api.target.resource.product_object_id)
    $session_id = array_distinct($api.network.session_id)
    $target_url = array_distinct($api.target.url)

  condition:
    //Tune to the desired threshold
    #api > 2
}

YARA-L Rule Structure

Condition

Fires when $api occurs more than 2 times in the 15m window.

Events

$api NETWORK_HTTP

  • metadata.product_event_type = "Microsoft Graph Activity"
  • target.url matches "^https://graph\.microsoft\.com/v1\.0/drives/.*/content$"
  • network.http.method = "GET"
  • network.http.response_code = "401"

Match and Correlation

Match key
$ip (principal.ip), $session (network.session_id), $url (target.url)
Within
15m

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($api.metadata.id)
doc_countcount_distinct($api.target.url)
requesting_user_guidarray_distinct($api.principal.user.userid)
requesting_iparray_distinct($api.principal.ip)
user_agentarray_distinct($api.network.http.user_agent)
locationarray_distinct($api.principal.location.name)
target_application_id_guidarray_distinct($api.target.resource.product_object_id)
session_idarray_distinct($api.network.session_id)
target_urlarray_distinct($api.target.url)

Process Memory Dump via RdrLeakDiag.exe

#
Severity
high
Type
Detection
Time window
5m
Match by
hostname
Author
Cedric MAURUGEON, Florian Roth (Nextron Systems), Swachchhanda Shrawan Poudel, Nasreddine Bencherchali (Nextron Systems)
Source
github.com/chronicle/detection-rules

Detects the use of the Microsoft Windows Resource Leak Diagnostic tool rdrleakdiag.exe to dump process memory

Known False Positives

  • Unlikely

MITRE ATT&CK Coverage

TacticTechniques
Credential Access

References

Telemetry Coverage

Rule Body

// Copyright 2025 Google LLC. Licensed under Apache-2.0.

rule process_memory_dump_via_rdrleakdiag {

  meta:
    author = "Cedric MAURUGEON, Florian Roth (Nextron Systems), Swachchhanda Shrawan Poudel, Nasreddine Bencherchali (Nextron Systems)"
    description = "Detects the use of the Microsoft Windows Resource Leak Diagnostic tool rdrleakdiag.exe to dump process memory"
    reference = "https://github.com/SigmaHQ/sigma/blob/master/rules/windows/process_creation/proc_creation_win_rdrleakdiag_process_dumping.yml"
    license = "https://github.com/SigmaHQ/Detection-Rule-License/blob/main/LICENSE.Detection.Rules.md"
    rule_name = "Process Memory Dump via RdrLeakDiag.exe"
    sigma_uuid = "edadb1e5-5919-4e4c-8462-a9e643b02c4b"
    sigma_status = "test"
    rule_id = "mr_89eca7b6-5b7e-4bd1-978e-156bd00f5324"
    tactic = "TA0006"
    technique = "T1003.001"
    type = "Detection"
    data_source = "Windows Event Logs"
    platform = "Windows"
    severity = "High"
    priority = "High"
    false_positives = "Unlikely"

  events:
    $process.metadata.event_type = "PROCESS_LAUNCH"
    (
        re.regex($process.target.process.file.full_path, `rdrleakdiag\.exe$`) nocase or
        $process.src.process.file.full_path = "RdrLeakDiag.exe" nocase
    )
    re.regex($process.target.process.command_line, `(/|full)memdmp`) nocase
    re.regex($process.target.process.command_line, `/(o|p)`) nocase

    $process.principal.hostname = $hostname

  match:
    $hostname over 5m

  outcome:
    //example usage of specifying test user and hostname to adjust risk score
    $risk_score = max(if($process.principal.user.userid = "user" and $process.principal.hostname = "hostname", 0, 15))
    $principal_process_pid = array_distinct($process.principal.process.pid)
    $principal_process_command_line = array_distinct($process.principal.process.command_line)
    $principal_process_file_sha256 = array_distinct($process.principal.process.file.sha256)
    $principal_process_file_full_path = array_distinct($process.principal.process.file.full_path)
    $principal_process_product_specfic_process_id = array_distinct($process.principal.process.product_specific_process_id)
    $principal_process_parent_process_product_specfic_process_id = array_distinct($process.principal.process.parent_process.product_specific_process_id)
    $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_specfic_process_id = array_distinct($process.target.process.product_specific_process_id)
    $principal_user_userid = array_distinct($process.principal.user.userid)
    $log_type = array_distinct(strings.concat($process.metadata.log_type,"/",$process.metadata.product_event_type))

  condition:
    $process
}

YARA-L Rule Structure

Condition

Fires when at least one $process event in the 5m window.

Events

$process PROCESS_LAUNCH (1, 4688)

  • target.process.file.full_path matches "rdrleakdiag\.exe$"
  • src.process.file.full_path = "RdrLeakDiag.exe"
  • target.process.command_line matches "(/|full)memdmp"
  • target.process.command_line matches "/(o|p)"

Match and Correlation

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

Outcome

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

FieldExpression
risk_scoremax(if($process.principal.user.userid = "user" and $process.principal.hostname = "hostname", 0, 15))
principal_process_pidarray_distinct($process.principal.process.pid)
principal_process_command_linearray_distinct($process.principal.process.command_line)
principal_process_file_sha256array_distinct($process.principal.process.file.sha256)
principal_process_file_full_patharray_distinct($process.principal.process.file.full_path)
principal_process_product_specfic_process_idarray_distinct($process.principal.process.product_specific_process_id)
principal_process_parent_process_product_specfic_process_idarray_distinct($process.principal.process.parent_process.product_specific_process_id)
target_process_pidarray_distinct($process.target.process.pid)
target_process_command_linearray_distinct($process.target.process.command_line)
target_process_file_sha256array_distinct($process.target.process.file.sha256)
target_process_file_full_patharray_distinct($process.target.process.file.full_path)
target_process_product_specfic_process_idarray_distinct($process.target.process.product_specific_process_id)
principal_user_useridarray_distinct($process.principal.user.userid)
log_typearray_distinct(strings.concat($process.metadata.log_type,"/",$process.metadata.product_event_type))

Suspicious File Downloaded From File-Sharing Website Via Certutil.EXE

#
Severity
high
Type
Detection
Time window
5m
Match by
hostname
Author
Nasreddine Bencherchali (Nextron Systems)
Source
github.com/chronicle/detection-rules

Detects the execution of certutil with certain flags that allow the utility to download files from file-sharing websites

Known False Positives

  • Unknown

MITRE ATT&CK Coverage

References

Telemetry Coverage

Rule Body

// Copyright 2025 Google LLC. Licensed under Apache-2.0.

rule suspicious_file_downloaded_from_file_sharing_website_via_certutil_exe {

  meta:
    author = "Nasreddine Bencherchali (Nextron Systems)"
    description = "Detects the execution of certutil with certain flags that allow the utility to download files from file-sharing websites"
    reference = "https://github.com/SigmaHQ/sigma/blob/master/rules/windows/process_creation/proc_creation_win_certutil_download_file_sharing_domains.yml"
    license = "https://github.com/SigmaHQ/Detection-Rule-License/blob/main/LICENSE.Detection.Rules.md"
    rule_name = "Suspicious File Downloaded From File-Sharing Website Via Certutil.EXE"
    sigma_uuid = "42a5f1e7-9603-4f6d-97ae-3f37d130d794"
    sigma_status = "experimental"
    rule_id = "mr_f61b63c4-96f0-4c2c-9f63-2e1dc16ddcf8"
    tactic = "TA0005"
    technique = "T1027"
    type = "Detection"
    data_source = "Sysmon"
    platform = "Windows"
    severity = "High"
    priority = "High"
    false_positives = "Unknown"

  events:
    $process.metadata.event_type = "PROCESS_LAUNCH"
    (
        re.regex($process.target.process.file.full_path, `\\certutil\.exe$`) nocase or
        $process.src.process.file.full_path = "certutil.exe" nocase
    )
    (
        strings.contains(strings.to_lower($process.target.process.command_line), "urlcache ") or
        strings.contains(strings.to_lower($process.target.process.command_line), "verifyctl ")
    )
    (
        strings.contains(strings.to_lower($process.target.process.command_line), ".githubusercontent.com") or
        strings.contains(strings.to_lower($process.target.process.command_line), "anonfiles.com") or
        strings.contains(strings.to_lower($process.target.process.command_line), "cdn.discordapp.com") or
        strings.contains(strings.to_lower($process.target.process.command_line), "ddns.net") or
        strings.contains(strings.to_lower($process.target.process.command_line), "dl.dropboxusercontent.com") or
        strings.contains(strings.to_lower($process.target.process.command_line), "ghostbin.co") or
        strings.contains(strings.to_lower($process.target.process.command_line), "glitch.me") or
        strings.contains(strings.to_lower($process.target.process.command_line), "gofile.io") or
        strings.contains(strings.to_lower($process.target.process.command_line), "hastebin.com") or
        strings.contains(strings.to_lower($process.target.process.command_line), "mediafire.com") or
        strings.contains(strings.to_lower($process.target.process.command_line), "mega.nz") or
        strings.contains(strings.to_lower($process.target.process.command_line), "onrender.com") or
        strings.contains(strings.to_lower($process.target.process.command_line), "pages.dev") or
        strings.contains(strings.to_lower($process.target.process.command_line), "paste.ee") or
        strings.contains(strings.to_lower($process.target.process.command_line), "pastebin.com") or
        strings.contains(strings.to_lower($process.target.process.command_line), "pastebin.pl") or
        strings.contains(strings.to_lower($process.target.process.command_line), "pastetext.net") or
        strings.contains(strings.to_lower($process.target.process.command_line), "privatlab.com") or
        strings.contains(strings.to_lower($process.target.process.command_line), "privatlab.net") or
        strings.contains(strings.to_lower($process.target.process.command_line), "send.exploit.in") or
        strings.contains(strings.to_lower($process.target.process.command_line), "sendspace.com") or
        strings.contains(strings.to_lower($process.target.process.command_line), "storage.googleapis.com") or
        strings.contains(strings.to_lower($process.target.process.command_line), "storjshare.io") or
        strings.contains(strings.to_lower($process.target.process.command_line), "supabase.co") or
        strings.contains(strings.to_lower($process.target.process.command_line), "temp.sh") or
        strings.contains(strings.to_lower($process.target.process.command_line), "transfer.sh") or
        strings.contains(strings.to_lower($process.target.process.command_line), "trycloudflare.com") or
        strings.contains(strings.to_lower($process.target.process.command_line), "ufile.io") or
        strings.contains(strings.to_lower($process.target.process.command_line), "w3spaces.com") or
        strings.contains(strings.to_lower($process.target.process.command_line), "workers.dev")
    )
    $process.principal.hostname = $hostname

  match:
    $hostname over 5m

  outcome:
      //example usage of specifying test user and hostname to adjust risk score
      $risk_score = max(if($process.principal.user.userid = "user" and $process.principal.hostname = "hostname", 0, 15))
      $principal_process_pid = array_distinct($process.principal.process.pid)
      $principal_process_command_line = array_distinct($process.principal.process.command_line)
      $principal_process_file_sha256 = array_distinct($process.principal.process.file.sha256)
      $principal_process_file_full_path = array_distinct($process.principal.process.file.full_path)
      $principal_process_product_specfic_process_id = array_distinct($process.principal.process.product_specific_process_id)
      $principal_process_parent_process_product_specfic_process_id = array_distinct($process.principal.process.parent_process.product_specific_process_id)
      $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_specfic_process_id = array_distinct($process.target.process.product_specific_process_id)
      $principal_user_userid = array_distinct($process.principal.user.userid)
      $log_type = array_distinct(strings.concat($process.metadata.log_type,"/",$process.metadata.product_event_type))

  condition:
    $process
}

YARA-L Rule Structure

Condition

Fires when at least one $process event in the 5m window.

Events

$process PROCESS_LAUNCH (1, 4688)

  • target.process.file.full_path matches "\\certutil\.exe$"
  • src.process.file.full_path = "certutil.exe"
  • target.process.command_line contains "urlcache "
  • target.process.command_line contains "verifyctl "
  • target.process.command_line contains ".githubusercontent.com"
  • target.process.command_line contains "anonfiles.com"
  • target.process.command_line contains "cdn.discordapp.com"
  • target.process.command_line contains "ddns.net"
  • target.process.command_line contains "dl.dropboxusercontent.com"
  • target.process.command_line contains "ghostbin.co"
  • target.process.command_line contains "glitch.me"
  • target.process.command_line contains "gofile.io"
  • target.process.command_line contains "hastebin.com"
  • target.process.command_line contains "mediafire.com"
  • target.process.command_line contains "mega.nz"
  • target.process.command_line contains "onrender.com"
  • target.process.command_line contains "pages.dev"
  • target.process.command_line contains "paste.ee"
  • target.process.command_line contains "pastebin.com"
  • target.process.command_line contains "pastebin.pl"
  • target.process.command_line contains "pastetext.net"
  • target.process.command_line contains "privatlab.com"
  • target.process.command_line contains "privatlab.net"
  • target.process.command_line contains "send.exploit.in"
  • target.process.command_line contains "sendspace.com"
  • target.process.command_line contains "storage.googleapis.com"
  • target.process.command_line contains "storjshare.io"
  • target.process.command_line contains "supabase.co"
  • target.process.command_line contains "temp.sh"
  • target.process.command_line contains "transfer.sh"
  • target.process.command_line contains "trycloudflare.com"
  • target.process.command_line contains "ufile.io"
  • target.process.command_line contains "w3spaces.com"
  • target.process.command_line contains "workers.dev"

Match and Correlation

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

Outcome

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

FieldExpression
risk_scoremax(if($process.principal.user.userid = "user" and $process.principal.hostname = "hostname", 0, 15))
principal_process_pidarray_distinct($process.principal.process.pid)
principal_process_command_linearray_distinct($process.principal.process.command_line)
principal_process_file_sha256array_distinct($process.principal.process.file.sha256)
principal_process_file_full_patharray_distinct($process.principal.process.file.full_path)
principal_process_product_specfic_process_idarray_distinct($process.principal.process.product_specific_process_id)
principal_process_parent_process_product_specfic_process_idarray_distinct($process.principal.process.parent_process.product_specific_process_id)
target_process_pidarray_distinct($process.target.process.pid)
target_process_command_linearray_distinct($process.target.process.command_line)
target_process_file_sha256array_distinct($process.target.process.file.sha256)
target_process_file_full_patharray_distinct($process.target.process.file.full_path)
target_process_product_specfic_process_idarray_distinct($process.target.process.product_specific_process_id)
principal_user_useridarray_distinct($process.principal.user.userid)
log_typearray_distinct(strings.concat($process.metadata.log_type,"/",$process.metadata.product_event_type))

Back to all YARA-L rules