whois_dns_query_to_typosquatting_domain
Description
Provides example usage of WHOIS data, detecting a DNS query for a domain that contains a specific string and is not registered with the defined domain registrar.
Query · yara_l
events:
// Match on DNS queries for domains that contain a specific string or company name(s).
$dns.metadata.event_type = "NETWORK_DNS"
// Customize the value for $dns.network.dns.questions.name to fit your environment.
$dns.network.dns.questions.name = /threatpunter/ nocase
$dns.network.dns.questions.name = $dns_query_name
// Join DNS query events with WHOIS data.
$whois.graph.entity.hostname = $dns_query_name
$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"
// Check if the domain is registered with a registrar other than Mark Monitor.
// Customize the values for $whois.graph.entity.domain.registrar based on the approved/expected registrar(s) used by your organization.
$whois.graph.entity.domain.registrar != "MarkMonitor Inc."
// Check if the domain was first seen in our environment within the last 30 days (2592000 seconds).
$seen.graph.entity.domain.name = $dns_query_name
$seen.graph.entity.domain.first_seen_time.seconds > 0
2592000 > timestamp.current_seconds() - $seen.graph.entity.domain.first_seen_time.seconds
match:
// Return the DNS query name when the rule finds a match within a 1 hour time window.
$dns_query_name over 1h
outcome:
$event_count = count_distinct($dns.metadata.id)
$principal_hostname = array_distinct($dns.principal.hostname)
$network_dns_questions_name = array_distinct($dns.network.dns.questions.name)
$network_dns_answers_data = array_distinct($dns.network.dns.answers.data)
$principal_ip = array_distinct($dns.principal.ip)
$target_ip = array_distinct($dns.target.ip)
$principal_process_pid = array_distinct($dns.principal.process.pid)
$principal_process_file_full_path = array_distinct($dns.principal.process.file.full_path)
$principal_process_product_specific_process_id = array_distinct($dns.principal.process.product_specific_process_id)
$principal_process_command_line = array_distinct($dns.principal.process.command_line)
$principal_process_file_sha256 = array_distinct($dns.principal.process.file.sha256)
$principal_process_parent_process_product_specific_process_id = array_distinct($dns.principal.process.parent_process.product_specific_process_id)
$principal_user_userid = array_distinct($dns.principal.user.userid)
condition:
// Trigger rule if a match is found for the following events.
$dns and $whois and $seen