Detection rules › YARA-L

WHOIS Recently Created Domain Access

Severity
info
Type
alert
Time window
1h
Match by
domain
Author
Google Cloud Security
Source
github.com/chronicle/detection-rules

Detects access attempts to a newly created domain via WHOIS enrichment.

Event coverage

Rule body yaral

/*
 * Copyright 2023 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

rule whois_recently_created_domain_access {

  meta:
    author = "Google Cloud Security"
    description = "Detects access attempts to a newly created domain via WHOIS enrichment."
    rule_id = "mr_209a5ab1-a0ea-473c-bfae-7beb67673e99"
    rule_name = "WHOIS Recently Created Domain Access"
    type = "alert"
    tags = "whois"
    data_source = "zscalar"
    severity = "Info"
    priority = "Info"

  events:
    ($access.metadata.event_type = "NETWORK_HTTP" or $access.metadata.event_type = "NETWORK_CONNECTION")

    // join access event to entity graph to use WHOIS data
    $access.target.hostname = $domain

    // Whois domains provided by GCTI Feed
    $whois.graph.entity.domain.name = $domain
    $whois.graph.metadata.entity_type = "DOMAIN_NAME"
    $whois.graph.metadata.vendor_name = "WHOIS"
    $whois.graph.metadata.product_name = "WHOISXMLAPI Simple Whois"
    $whois.graph.metadata.source_type = "GLOBAL_CONTEXT"
    $whois.graph.entity.domain.creation_time.seconds > 0

    // domain was created in the last 30 days
    2592000 > timestamp.current_seconds() - $whois.graph.entity.domain.creation_time.seconds

  match:
    $domain over 1h

  outcome:
    $risk_score = 20
    $event_count = count_distinct($access.metadata.id)
    //added to populate alert graph with additional context
    $principal_hostname = array_distinct($access.principal.hostname)
    // Commented out target.hostname because it is already represented in graph as match variable. If match changes, can uncomment to add to results
    //$target_hostname = array_distinct($access.target.hostname)
    $principal_process_pid = array_distinct($access.principal.process.pid)
    $principal_process_command_line = array_distinct($access.principal.process.command_line)
    $principal_process_file_sha256 = array_distinct($access.principal.process.file.sha256)
    $principal_process_file_full_path = array_distinct($access.principal.process.file.full_path)
    $principal_process_product_specific_process_id = array_distinct($access.principal.process.product_specific_process_id)
    $principal_process_parent_process_product_specific_process_id = array_distinct($access.principal.process.parent_process.product_specific_process_id)
    $target_process_pid = array_distinct($access.target.process.pid)
    $target_process_command_line = array_distinct($access.target.process.command_line)
    $target_process_file_sha256 = array_distinct($access.target.process.file.sha256)
    $target_process_file_full_path = array_distinct($access.target.process.file.full_path)
    $target_process_product_specific_process_id = array_distinct($access.target.process.product_specific_process_id)
    $target_process_parent_process_product_specific_process_id = array_distinct($access.target.process.parent_process.product_specific_process_id)
    $principal_user_userid = array_distinct($access.principal.user.userid)
    $target_user_userid = array_distinct($access.target.user.userid)
    $target_url = array_distinct($access.target.url)

  condition:
    $access and $whois
}

Detection logic

Fires when at least one $access event in the 1h window and $whois matches entity context.

Events

$access NETWORK_HTTP (3, 5156)

No field filters (binds the event for correlation only).

$whois entity context (DOMAIN_NAME)

  • graph.metadata.entity_type = "DOMAIN_NAME"
  • graph.metadata.vendor_name = "WHOIS"
  • graph.metadata.product_name = "WHOISXMLAPI Simple Whois"
  • graph.metadata.source_type = "GLOBAL_CONTEXT"
  • graph.entity.domain.creation_time.seconds > "0"
  • timestamp.current_seconds() time_arithmetic "graph.entity.domain.creation_time.seconds" or "2592000"

Correlation

Match key
$domain (target.hostname)
Within
1h

Outcome

Fields the detection emits on a match. $risk_score drives alerting; Chronicle surfaces the rest on the detection.

FieldExpression
risk_score20
event_countcount_distinct($access.metadata.id)
principal_hostnamearray_distinct($access.principal.hostname)
principal_process_pidarray_distinct($access.principal.process.pid)
principal_process_command_linearray_distinct($access.principal.process.command_line)
principal_process_file_sha256array_distinct($access.principal.process.file.sha256)
principal_process_file_full_patharray_distinct($access.principal.process.file.full_path)
principal_process_product_specific_process_idarray_distinct($access.principal.process.product_specific_process_id)
principal_process_parent_process_product_specific_process_idarray_distinct($access.principal.process.parent_process.product_specific_process_id)
target_process_pidarray_distinct($access.target.process.pid)
target_process_command_linearray_distinct($access.target.process.command_line)
target_process_file_sha256array_distinct($access.target.process.file.sha256)
target_process_file_full_patharray_distinct($access.target.process.file.full_path)
target_process_product_specific_process_idarray_distinct($access.target.process.product_specific_process_id)
target_process_parent_process_product_specific_process_idarray_distinct($access.target.process.parent_process.product_specific_process_id)
principal_user_useridarray_distinct($access.principal.user.userid)
target_user_useridarray_distinct($access.target.user.userid)
target_urlarray_distinct($access.target.url)