Skip to main content
Solved

Yara-L: Output the exact value for repeated field that was found in data table

  • September 26, 2025
  • 3 replies
  • 108 views

nazarii-plebanskyi
Forum|alt.badge.img+2

Hey, I want to output (with outcome section) the exact value for the repeated field (e.g. target.ip) that was found in the data table with IN operator.

Is it even possible? Maybe you have some suggestions?

Example rule:

rule rule_name {
meta:
severity = "MEDIUM"

events:
$e.metadata.event_type = "NETWORK_CONNECTION"
$e.target.ip = $target_ip
$target_ip IN %dt.ioc

outcome:
$matched_value = ? // one of the IPs from target_ip that was actually found in data table

condition:
$e
}

 

Best answer by nazarii-plebanskyi

That’s correct, my test environment contains several events with multiple IPs in target.ip field.

But actually it seems like in the outcome we get only the “correct” IP, so no problem anymore 😀
Example of my rule if anyone is curious:
 

rule rule_123 {
meta:
...

events:
$e.metadata.event_type = "NETWORK_CONNECTION"
$ioc = $e.target.ip
%dt_123.type = "ip"
%dt_123.ioc = $ioc

match:
$ioc over 1m

outcome:
$ioc_value = array($ioc)

condition:
$e
}

 

3 replies

AbdElHafez
Staff
Forum|alt.badge.img+12
  • Staff
  • October 1, 2025

Hi ​@nazarii-plebanskyi ,
So your events have multiple target.ip fields not just the only zero index one target.ip[0] ? and you want to outcome only the ip that is present in your data table instead of All the existing target.ip[*] ?


nazarii-plebanskyi
Forum|alt.badge.img+2

That’s correct, my test environment contains several events with multiple IPs in target.ip field.

But actually it seems like in the outcome we get only the “correct” IP, so no problem anymore 😀
Example of my rule if anyone is curious:
 

rule rule_123 {
meta:
...

events:
$e.metadata.event_type = "NETWORK_CONNECTION"
$ioc = $e.target.ip
%dt_123.type = "ip"
%dt_123.ioc = $ioc

match:
$ioc over 1m

outcome:
$ioc_value = array($ioc)

condition:
$e
}

 


AbdElHafez
Staff
Forum|alt.badge.img+12
  • Staff
  • October 3, 2025

Nice I see you defined $ioc then captured the specific data table value in line 9.