rule test_corelight_logs_with_malicious_hash_Virus_Total {
meta:
author = "NastyaS"
description = "Detects files with malicious hash, by matching against Virus Total"
short_description = "IoC Virus Total Match files"
severity = "Medium"
priority = "Medium"
status = "Testing"
created_date = "2023-09-14T00:00:00Z"
rule_version = "1.3"
yara_version = "YL2.0"
data_source = "Firewall events"
confidence_threshold = "50"
events:
$e1.metadata.event_type = "NETWORK_CONNECTION"
$e1.target.ip = $ip
$e1.principal.user.userid = $userid
$e2.principal.user.userid = $userid
$e2.target.process.file.sha256 = $hash
/*$e3.metadata.log_type = "CORELIGHT"
$e3.security_result.action = "ALLOW"
$e3.principal.hostname = $host
$e3.target.ip = $ip*/
// get virus total data
$vt.graph.metadata.source_type = "GLOBAL_CONTEXT"
$vt.graph.metadata.entity_type = "FILE"
$vt.graph.metadata.vendor_name = "VirusTotal"
$vt.graph.metadata.product_name = "VirusTotal Relationships"
$vt.graph.entity.file.sha256 = $hash
//find relation between ip address and file hash from VT duet
$vt.graph.relations.entity_type = "IP_ADDRESS"
$vt.graph.relations.entity.ip = $ip
match:
$ip,$hash over 15m
outcome:
$soar_rule_entities = array_distinct($userid)
// standard outcomes
$risk_score = 60
$event_count = count_distinct($e1.metadata.id)
// principal
$principal_ip = array_distinct($e1.principal.ip)
$principal_hostname = array_distinct($e1.principal.hostname)
$principal_user_userid = array_distinct($e1.principal.user.userid)
$principal_resource_name = array_distinct($e1.principal.resource.name)
// target
$target_ip = array_distinct($e1.target.ip)
$target_hostname = array_distinct($e1.target.hostname)
$target_user_userid = array_distinct($e1.target.user.userid)
$target_resource_name = array_distinct($e1.target.resource.name)
$target_url = array_distinct($e1.target.url)
condition:
$e1 and $e2 and $vt
}
I need to specify that I am looking for Corelight logs.
I tried to add this code:
$e3.metadata.log_type = "CORELIGHT"
$e3.security_result.action = "ALLOW"
$e3.principal.hostname = $host
$e3.target.ip = $ip ,
but it didn't work out, since the rule doesn't detect any logs.