Cline rules
.clinerules/OVERVIEW_OF_YARAL_LANGUAGE.mdCline rules
Quality
45/100
Scores the file, not the repository.Length
3,306 words
24 headings · 25 code blocksRepository
2
— · pushed 178 days agoLast changed
3 days ago
First indexed 3 days ago.1# Overview of the YARA-L 2.0 language23Supported in:45Google secops6[Siem](/chronicle/docs/secops/google-secops-siem-toc)78YARA-L 2.0 is a computer language used to create rules for searching through your enterprise log data as it is ingested into your Google Security Operations instance. The YARA-L syntax is derived from the YARA language developed by VirusTotal.9The language works in conjunction with the Google SecOps Detection Engine and enables you to hunt for threats and other events across large volumes of data.1011For more information, see the following:1213* [YARA-L 2.0 language syntax](/chronicle/docs/detection/yara-l-2-0-syntax)14* [Best practices](/chronicle/docs/detection/yara-l-best-practices)1516**Note:** YARA-L 2.0 is incompatible with previous versions of the YARA-L language. Rules written in older versions of YARA-L will not work with the current version of the Detection Engine and need to be revised to use the new syntax.1718## YARA-L 2.0 example rules1920The following examples show rules written in YARA-L 2.0. Each demonstrates how to correlate events within the rule language.2122### Rules and tuning2324The following rule checks for specific patterns in event data and creates a detection25if it finds the patterns. This rule includes a variable `$e1` for tracking event26type and `metadata.event_type` UDM field. The rule checks for specific occurrences27of regular expression matches with `e1`. When the event `$e1` takes place, a detection is created.28A `not` condition is included in the rule to exclude certain non-malicious paths.29You can add `not` conditions to prevent false positives.3031```32rule suspicious_unusual_location_svchost_execution33{3435 meta:36 author = "Google Cloud Security"37 description = "Windows 'svchost' executed from an unusual location"38 yara_version = "YL2.0"39 rule_version = "1.0"4041 events:4243 $e1.metadata.event_type = "PROCESS_LAUNCH"44 re.regex($e1.principal.process.command_line, `\bsvchost(\.exe)?\b`) nocase45 not re.regex($e1.principal.process.command_line, `\\Windows\\System32\\`) nocase4647condition:4849 $e150}515253```5455### Logins from different cities5657The following rule searches for users that have logged in to your enterprise from two or more cities in less than 5 minutes:5859```60rule DifferentCityLogin {61 meta:6263 events:64 $udm.metadata.event_type = "USER_LOGIN"65 $udm.principal.user.userid = $user66 $udm.principal.location.city = $city6768 match:69 $user over 5m7071 condition:72 $udm and #city > 173}7475```7677**Match variable**: `$user`7879**Event variable**:`$udm`8081**Placeholder variable**: `$city` and `$user`8283The following describes how this rule works:8485* Groups events with username (`$user`) and returns it (`$user`) when a match is found.86* Timespan is 5 minutes, meaning only events that are less than 5 minutes apart are correlated.87* Searching for an event group (`$udm`) whose event type is *USER\_LOGIN*.88* For that event group, the rule calls the user ID as `$user` and the login city as `$city.`89* Returns a match if the distinct number of `city` values (denoted by `#city`) is greater than 1 in the event group (`$udm`) within the 5 minute time range.9091### Rapid user creation and deletion9293The following rule searches for users that have been created and then deleted within 4 hours:9495```96rule UserCreationThenDeletion {97 meta:9899 events:100 $create.target.user.userid = $user101 $create.metadata.event_type = "USER_CREATION"102103 $delete.target.user.userid = $user104 $delete.metadata.event_type = "USER_DELETION"105106 $create.metadata.event_timestamp.seconds <=107 $delete.metadata.event_timestamp.seconds108109 match:110 $user over 4h111112 condition:113 $create and $delete114}115116```117118**Event variables**:`$create` and `$delete`119120**Match variable**: `$user`121122**Placeholder variable**: N/A123124The following describes how this rule works:125126* Groups events with username (`$user`) and returns it (`$user`) when a match is found.127* Time window is 4 hours, meaning only events separated by less than 4 hours are correlated.128* Searches for two event groups (`$create` and `$delete`, where `$create` is equivalent to `#create >= 1`).129* `$create` corresponds to `USER_CREATION` events and calls the user ID as `$user`.130* `$user` is used to join the two groups of events together.131* `$delete` corresponds to `USER_DELETION` events and calls the user ID as `$user`. This rule looks for a match where the user identifier in the two event groups is the same.132* This rule looks for cases where the event from `$delete` happens later than the event from `$create`, returning a match when discovered.133134### Single event rule135136Single event rules are rules that correlate over a single event. A single event rule can be:137138* Any rule without a match section.139* Rule with a `match` section and a `condition` section only checking for the existence of 1 event (for example, "$e", "#e > 0", "#e >= 1", "1 <= #e", "0 < #e").140141For example, the following rule searches for a user login event and would return the first one it encounters within the enterprise data stored within your Google SecOps account:142143```144rule SingleEventRule {145 meta:146 author = "noone@altostrat.com"147148 events:149 $e.metadata.event_type = "USER_LOGIN"150151 condition:152 $e153}154155```156157Here is another example of a single event rule with a match section. This rule searches for a user who has logged in at least once in less than 5 minutes. It checks for the simple existence of a user login event.158159```160rule SingleEventRule {161 meta:162 author = "alice@example.com"163 description = "windowed single event example rule"164165 events:166 $e.metadata.event_type = "USER_LOGIN"167 $e.principal.user.userid = $user168169 match:170 $user over 5m171172 condition:173 #e > 0174}175176```177178**Note:** Rules with a `match` section and a `condition` section that includes outcome variables in addition to simple existence on 1 event are classified as [multi-event rules](#multiple_event_rule). In these rules, detection generation logic depends on all events in a match window (for example, many events), rather than any event in a match window (for example, single event). The following example of such rules generates the same detections as the first multi-event rule example in the next section.179180```181rule MultiEventRule{182 meta:183 author = "alice@example.com"184 description = "Rule with outcome condition and simple existence condition on one event variable"185186 events:187 $e.metadata.event_type = "USER_LOGIN"188 $e.principal.user.userid = $user189190 match:191 $user over 10m192193 outcome:194 $num_events_in_match_window = count($e.metadata.id)195196 condition:197 #e > 0 and $num_events_in_match_window >= 10 // Could be rewritten as #e >= 10198}199200```201202### Multiple event rule203204Use multiple event rules to group many events over a specified time window and try to find correlations between events. A typical multiple event rule will have the following:205206* A `match` section which specifies the time range over which events need to be grouped.207* A `condition` section specifying what condition should trigger the detection and checking for the existence of multiple events.208209For example, the following rule searches for a user who has logged in at least 10 times in less than 10 minutes:210211```212rule MultiEventRule {213 meta:214 author = "noone@altostrat.com"215216 events:217 $e.metadata.event_type = "USER_LOGIN"218 $e.principal.user.userid = $user219220 match:221 $user over 10m222223 condition:224 #e >= 10225}226227```228229### Single event within range of IP addresses230231The following example shows a single event rule searching for a match between two specific users and a specific range of IP addresses:232233```234rule OrsAndNetworkRange {235 meta:236 author = "noone@altostrat.com"237238 events:239 // Checks CIDR ranges.240 net.ip_in_range_cidr($e.principal.ip, "203.0.113.0/24")241242 // Detection when the hostname field matches either value using or.243 $e.principal.hostname = /pbateman/ or $e.principal.hostname = /sspade/244245 condition:246 $e247}248249```250251### any and all rule example252253The following rule searches for login events where all source IP addresses do not match an IP address known to be secure within a timespan of 5 minutes.254255```256rule SuspiciousIPLogins {257 meta:258 author = "alice@example.com"259260 events:261 $e.metadata.event_type = "USER_LOGIN"262263 // Detects if all source IP addresses in an event do not match "100.97.16.0"264 // For example, if an event has source IP addresses265 // ["100.97.16.1", "100.97.16.2", "100.97.16.3"],266 // it will be detected since "100.97.16.1", "100.97.16.2",267 // and "100.97.16.3" all do not match "100.97.16.0".268269 all $e.principal.ip != "100.97.16.0"270271 // Assigns placeholder variable $ip to the $e.principal.ip repeated field.272 // There will be one detection per source IP address.273 // For example, if an event has source IP addresses274 // ["100.97.16.1", "100.97.16.2", "100.97.16.3"],275 // there will be one detection per address.276277 $e.principal.ip = $ip278279 match:280 $ip over 5m281282 condition:283 $e284}285286```287288### Regular expressions in a rule289290The following YARA-L 2.0 regular expression example searches for events with emails received from the altostrat.com domain. Since `nocase` has been added to the `$host` variable `regex` comparison and the `regex` function, both these comparisons are case insensitive.291292```293rule RegexRuleExample {294 meta:295 author = "noone@altostrat.com"296297 events:298 $e.principal.hostname = $host299 $host = /.*HoSt.*/ nocase300 re.regex($e.network.email.from, `.*altostrat\.com`) nocase301302 match:303 $host over 10m304305 condition:306 #e > 10307}308309```310311### Composite rule examples312313**Note:** This feature is covered by [Pre-GA Offerings Terms](https://chronicle.security/legal/service-terms/) of the Google Security Operations Service314Specific Terms. Pre-GA features might have limited support, and changes to pre-GA features might not be compatible with other pre-GA versions.315For more information, see the [Google SecOps Technical Support Service guidelines](https://chronicle.security/legal/technical-support-services-guidelines/)316and the [Google SecOps Service Specific Terms](https://chronicle.security/legal/service-terms/).317318Composite detections enhance threat detection by using composite rules.319These composite rules use detections from other rules as their input. This enables320the detection of complex threats that individual rules might not detect. For321more information, see [Overview of composite detections](/chronicle/docs/detection/composite-detections).322323#### Tripwire detections324325Tripwire composite detections are the simplest form of a composite detection326that operates on fields within detection findings, such as outcome variables or327rule metadata. They help filter detections for conditions that may indicate328higher risk, such as an administrator user or a production environment.329330```331rule composite_admin_detection {332 meta:333 rule_name = "Detection with Admin User"334 author = "Google Cloud Security"335 description = "Composite rule that looks for any detections where the actor is an admin user"336 severity = "Medium"337338 events:339 $rule_name = $d.detection.detection.rule_name340 $principal_user = $d.detection.detection.outcomes["principal_users"]341 $principal_user = /admin|root/ nocase342343 match:344 $principal_user over 1h345346 outcome:347 $risk_score = 75348 $upstream_rules = array_distinct($rule_name)349350 condition:351 $d352}353354```355356#### Threshold and Aggregation detections357358Aggregation composite detection rules let you group detection findings based359on shared attributes, such as a hostname or username, and analyze the aggregated360data. The following are common use cases:361362* Identifying users who generate a high volume of security alerts or aggregated risk.363* Detecting hosts with unusual activity patterns by aggregating related detections.364365Risk aggregation example:366367```368rule composite_risk_aggregation {369 meta:370 rule_name = "Risk Aggregation Composite"371 author = "Google Cloud Security"372 description = "Composite detection that aggregates risk of a user over 48 hours"373 severity = "High"374375 events:376 $rule_name = $d.detection.detection.rule_name377 $principal_user = $d.detection.detection.outcomes["principal_users"]378 $risk = $d.detection.detection.risk_score379380 match:381 $principal_user over 48h382383 outcome:384 $risk_score = 90385 $cumulative_risk = sum($risk)386 $principal_users = array_distinct($principal_users)387 $upstream_rules = array_distinct($rule_name)388389 condition:390 $d and $cumulative_risk > 500391}392393```394395Tactic aggregation example:396397```398rule composite_tactic_aggregation {399 meta:400 rule_name = "MITRE Tactic Aggregation Composite"401 author = "Google Cloud Security"402 description = "Composite detection that detects if a user has triggered detections over multiple mitre tactics."403 severity = "Medium"404405 events:406 $principal_user = $d.detection.detection.outcomes["principal_users"]407 $tactic = $d.detection.detection.rule_labels["tactic"]408 $rule_name = $d.detection.detection.rule_name409410 match:411 $principal_user over 48h412413 outcome:414 $mitre_tactics_count = count_distinct($tactic)415 $mitre_tactics = array_distinct($d.detection.rule_labels["tactic"])416 $risk_score = min(100, (50+15*$mitre_tactics_count))417 $upstream_rules = array_distinct($rule_name)418419 condition:420 $d and $mitre_tactics_count > 1421}422423```424425### Sequential composite detections426427Sequential composite detections identify patterns of related events where the428sequence of detections is important, such as a brute-force login attempt429detection, followed by a successful login. These patterns can involve multiple430base detections or a combination of base detections and events.431432```433rule composite_bruteforce_login {434 meta:435 rule_name = "Bruteforce Login Composite"436 author = "Google Cloud Security"437 description = "Detects when an IP address associated with a Workspace brute force attempt successfully logs in"438 severity = "High"439440 events:441 $bruteforce_detection.detection.detection.rule_name = /Workspace Anomalous Failed Logins/442 $bruteforce_ip = $d.detection.detection.outcomes["principal_ips"]443444 $login_event.metadata.product_name = "login"445 $login_event.metadata.product_event_type = "login_success"446 $login_event.metadata.vendor_name = "Google Workspace"447 $login_ip = $login_event.principal.ip448449 // Ensure the brute force detection and successful login occurred from the same IP450 $login_ip = $bruteforce_ip451452 $target_account = $login_event.target.user.email_addresses453454 // Ensure the brute force detection occurred before the successful login455 $bruteforce_detection.detection.detection_time.seconds < $login_event.metadata.event_timestamp.seconds456457 match:458 $bruteforce_ip over 24h459460 outcome:461 $risk_score = 90462 $principal_users = array_distinct($target_account)463464 condition:465 $bruteforce_detection and $login_event466}467468469```470471#### Context-aware detections472473Context-aware composite detections enrich detections with additional context,474such as IP addresses found in threat feeds.475476```477rule composite_tor_enrichment {478 meta:479 rule_name = "Detection with IP from TOR Feed"480 author = "Google Cloud Security"481 description = "Adds additional context from the TOR intel feed to detections"482 severity = "High"483484 events:485 $detection_ip = $d.detection.detection.outcomes["principal_ips"]486 $gcti.graph.metadata.entity_type = "IP_ADDRESS"487 $gcti.graph.metadata.vendor_name = "Google Cloud Threat Intelligence"488 $gcti_feed.graph.metadata.source_type = "GLOBAL_CONTEXT"489 $gcti.graph.metadata.product_name = "GCTI Feed"490 $gcti.graph.metadata.threat.threat_feed_name = "Tor Exit Nodes"491492 $detection_ip = $gcti.graph.entity.ip493494 $rule_name = $d.detection.detection.rule_name495 $risk = $d.detection.detection.outcomes["risk_score"]496497 match:498 $detection_ip, $rule_name over 1h499500 outcome:501 $risk_score = 80502 $upstream_rule = array_distinct($rule_name)503504 condition:505 $d and $gcti506}507508```509510#### Co-occurrence detections511512Co-occurrence composite detections are a form of aggregation that can detect a513combination of related events, such as a combination of privilege escalation514and data exfiltration detections triggered by a user.515516```517rule composite_privesc_exfil_sequential {518 meta:519 rule_name = "Privilege Escalation and Exfiltration Composite"520 author = "Google Cloud Security"521 description = "Looks for a detection sequence of privilege escalation followed by exfiltration."522 severity = "High"523524 events:525 $privilege_escalation.detection.detection.rule_labels["tactic"] = "TA0004"526 $exfiltration.detection.detection.rule_labels["tactic"] = "TA0010"527528 $pe_user = $privilege_escalation.detection.detection.outcomes["principal_users"]529 $ex_user = $exfiltration.detection.detection.outcomes["principal_users"]530531 $pe_user = $ex_user532533 match:534 $pe_user over 48h535536 outcome:537 $risk_score = 75538 $privesc_rules = array_distinct($privilege_escalation.detection.detection.rule_name)539 $exfil_rules = array_distinct($exfiltration.detection.detection.rule_name)540541 condition:542 $privilege_escalation and $exfiltration543}544545```546547### Sliding window rule example548549The following YARA-L 2.0 sliding window example searches for the absence of550`firewall_2` events after `firewall_1` events. The `after` keyword is used with551the pivot event variable `$e1` to specify that only 10 minute windows after each552`firewall_1` event should be checked when correlating events.553554```555rule SlidingWindowRuleExample {556 meta:557 author = "alice@example.com"558559 events:560 $e1.metadata.product_name = "firewall_1"561 $e1.principal.hostname = $host562563 $e2.metadata.product_name = "firewall_2"564 $e2.principal.hostname = $host565566 match:567 $host over 10m after $e1568569 condition:570 $e1 and !$e2571}572573```574575### Zero value exclusion example576577Rules Engine implicitly filters out the zero values for all placeholders578that are used in the `match` section.579For more information, see [zero value handling in the `match` section](/chronicle/docs/detection/yara-l-2-0-syntax#zero_value_handling_in_the_match_section).580This can be disabled by using the `allow_zero_values` option as581described in [allow\_zero\_values](/chronicle/docs/detection/yara-l-2-0-syntax#allow_zero_values).582583However, for other referenced event fields,584zero values are not excluded unless you explicitly specify such conditions.585586```587rule ExcludeZeroValues {588 meta:589 author = "alice@example.com"590591 events:592 $e1.metadata.event_type = "NETWORK_DNS"593 $e1.principal.hostname = $hostname594595 // $e1.principal.user.userid may be empty string.596 $e1.principal.user.userid != "Guest"597598 $e2.metadata.event_type = "NETWORK_HTTP"599 $e2.principal.hostname = $hostname600601 // $e2.target.asset_id cannot be empty string as explicitly specified.602 $e2.target.asset_id != ""603604 match:605 // $hostname cannot be empty string. The rule behaves as if the606 // predicate, `$hostname != ""` was added to the events section, because607 // `$hostname` is used in the match section.608 $hostname over 1h609610 condition:611 $e1 and $e2612}613614```615616### Rule with `outcome` section example617618You can add the optional `outcome` section in a YARA-L 2.0 rule to extract619additional information of each detection. In the condition section, you can also specify620conditionals on outcome variables. You can use the `outcome` section of a detection621rule to set variables for downstream consumption. For example, you can set a622severity score based on data from the events being analyzed.623624For more information, see the following:625626* [Outcome section syntax](/chronicle/docs/detection/yara-l-2-0-syntax#outcome_section_syntax)627* [Outcome conditionals syntax](/chronicle/docs/detection/yara-l-2-0-syntax#outcome_conditionals)628* [Overview of the `outcome` section](/chronicle/docs/detection/context-aware-analytics#outcome_section)629630#### Multi-event rule with outcome section:631632The following rule looks at two events to get the value of633`$hostname`. If the value of `$hostname` matches over a 5-minute period,634then a severity score is applied. When including a time period in the `match` section,635the rule checks within the specified time period.636637```638rule OutcomeRuleMultiEvent {639 meta:640 author = "Google Cloud Security"641 events:642 $u.udm.principal.hostname = $hostname643 $asset_context.graph.entity.hostname = $hostname644645 $severity = $asset_context.graph.entity.asset.vulnerabilities.severity646647 match:648 $hostname over 5m649650 outcome:651 $risk_score =652 max(653 100654 + if($hostname = "my-hostname", 100, 50)655 + if($severity = "HIGH", 10)656 + if($severity = "MEDIUM", 5)657 + if($severity = "LOW", 1)658 )659660 $asset_id_list =661 array(662 if($u.principal.asset_id = "",663 "Empty asset id",664 $u.principal.asset_id665 )666 )667668 $asset_id_distinct_list = array_distinct($u.principal.asset_id)669670 $asset_id_count = count($u.principal.asset_id)671672 $asset_id_distinct_count = count_distinct($u.principal.asset_id)673674 condition:675 $u and $asset_context and $risk_score > 50 and not arrays.contains($asset_id_list, "id_1234")676}677678679```680681```682rule OutcomeRuleMultiEvent {683 meta:684 author = "alice@example.com"685 events:686 $u.udm.principal.hostname = $hostname687 $asset_context.graph.entity.hostname = $hostname688689 $severity = $asset_context.graph.entity.asset.vulnerabilities.severity690691 match:692 $hostname over 5m693694 outcome:695 $total_network_bytes = sum($u.network.sent_bytes) + sum($u.network.received_bytes)696697 $risk_score = if(total_network_bytes > 1024, 100, 50) +698 max(699 if($severity = "HIGH", 10)700 + if($severity = "MEDIUM", 5)701 + if($severity = "LOW", 1)702 )703704 $asset_id_list =705 array(706 if($u.principal.asset_id = "",707 "Empty asset id",708 $u.principal.asset_id709 )710 )711712 $asset_id_distinct_list = array_distinct($u.principal.asset_id)713714 $asset_id_count = count($u.principal.asset_id)715716 $asset_id_distinct_count = count_distinct($u.principal.asset_id)717718 condition:719 $u and $asset_context and $risk_score > 50 and not arrays.contains($asset_id_list, "id_1234")720}721722```723724#### Single-event rule with outcome section:725726```727rule OutcomeRuleSingleEvent {728 meta:729 author = "alice@example.com"730 events:731 $u.metadata.event_type = "FILE_COPY"732 $u.principal.file.size = $file_size733 $u.principal.hostname = $hostname734735 outcome:736 $suspicious_host = $hostname737 $admin_severity = if($u.principal.userid in %admin_users, "SEVERE", "MODERATE")738 $severity_tag = if($file_size > 1024, $admin_severity, "LOW")739740 condition:741 $u742}743744```745746#### Refactoring a multi-event outcome rule into a single-event outcome rule.747748You can use the `outcome` section for both single-event rules (rules without a749`match` section), and multi-event rules (rules with a `match` section).750If you previously designed a rule to be multi-event just so you could751use the outcome section, you can optionally refactor those rules by deleting752the `match` section to improve performance. Be aware that because your rule no753longer has a `match` section that applies grouping,754you might receive more detections. This refactor is only755possible for rules that use one event variable as shown in the756following example.757758Multi-event outcome rule which uses only one event variable (a759good candidate for a refactor):760761```762rule OutcomeMultiEventPreRefactor {763 meta:764 author = "alice@example.com"765 description = "Outcome refactor rule, before the refactor"766767 events:768 $u.udm.principal.hostname = $hostname769770 match:771 $hostname over 5m772773 outcome:774 $risk_score = max(if($hostname = "my-hostname", 100, 50))775776 condition:777 $u778}779780```781782You can refactor the rule by deleting the `match` section. Note that you783must also remove the aggregate in the `outcome` section since the rule will now be784single-event. For more information on aggregations, see [outcome aggregations](/chronicle/docs/detection/yara-l-2-0-syntax#aggregations).785786```787rule OutcomeSingleEventPostRefactor {788 meta:789 author = "alice@example.com"790 description = "Outcome refactor rule, after the refactor"791792 events:793 $u.udm.principal.hostname = $hostname794795 // We deleted the match section.796797 outcome:798 // We removed the max() aggregate.799 $risk_score = if($hostname = "my-hostname", 100, 50)800801 condition:802 $u803}804805```806807### Function to placeholder rule example808809You can assign a placeholder variable to the result of a function call and810can use the placeholder variable in other sections of the rule, such as the811`match` section, `outcome` section, or `condition` section. See the following example:812813```814rule FunctionToPlaceholderRule {815 meta:816 author = "alice@example.com"817 description = "Rule that uses function to placeholder assignments"818819 events:820 $u.metadata.event_type = "EMAIL_TRANSACTION"821822 // Use function-placeholder assignment to extract the823 // address from an email.824 // address@website.com -> address825 $email_to_address_only = re.capture($u.network.email.from , "(.*)@")826827 // Use function-placeholder assignment to normalize an email:828 // uid@??? -> uid@company.com829 $email_from_normalized = strings.concat(830 re.capture($u.network.email.from , "(.*)@"),831 "@company.com"832 )833834 // Use function-placeholder assignment to get the day of the week of the event.835 // 1 = Sunday, 7 = Saturday.836 $dayofweek = timestamp.get_day_of_week($u.metadata.event_timestamp.seconds)837838 match:839 // Use placeholder (from function-placeholder assignment) in match section.840 // Group by the normalized from email, and expose it in the detection.841 $email_from_normalized over 5m842843 outcome:844 // Use placeholder (from function-placeholder assignment) in outcome section.845 // Assign more risk if the event happened on weekend.846 $risk_score = max(847 if($dayofweek = 1, 10, 0) +848 if($dayofweek = 7, 10, 0)849 )850851 condition:852 // Use placeholder (from function-placeholder assignment) in condition section.853 // Match if an email was sent to multiple addresses.854 #email_to_address_only > 1855}856857```858859### Outcome conditionals example rule860861In the `condition` section, you can use outcome variables that were defined862in the `outcome` section. The following example demonstrates how to filter on863risk scores to reduce noise in detections by using outcome conditionals.864865```866rule OutcomeConditionalRule {867 meta:868 author = "alice@example.com"869 description = "Rule that uses outcome conditionals"870871 events:872 $u.metadata.event_type = "FILE_COPY"873 $u.principal.file.size = $file_size874 $u.principal.hostname = $hostname875876 // 1 = Sunday, 7 = Saturday.877 $dayofweek = timestamp.get_day_of_week($u.metadata.collected_timestamp.seconds)878879 outcome:880 $risk_score =881 if($file_size > 500*1024*1024, 2) + // Files 500MB are moderately risky882 if($file_size > 1024*1024*1024, 3) + // Files over 1G get assigned extra risk883 if($dayofweek=1 or $dayofweek=7, 4) + // Events from the weekend are suspicious884 if($hostname = /highly-privileged/, 5) // Check for files from highly privileged devices885886 condition:887 $u and $risk_score >= 10888}889890891```892893Last updated 2025-06-05 UTC.894895
Also in repulsivityy/elevate_2025
Diff this repo’s formatsOne repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| repulsivityy/elevate_2025.clinerules/YARA_RULES_STYLE_GUIDE.md · 2 | Cline rules | buildstylearchtypes | 46/100 | 3 days ago | |
| repulsivityy/elevate_2025ai-runbooks-elevate25/.clinerules/suggested_mcp_tools.md · 2 | Cline rules | no sections | 34/100 | 3 days ago | |
| repulsivityy/elevate_2025.clinerules/SECOPS_YARAL_STYLE_GUIDE.md · 2 | Cline rules | lint-formatstyledo-not | 61/100 | 3 days ago | |
| repulsivityy/elevate_2025.clinerules/YARAL_SYNTAX.md · 2 | Cline rules | archtypesdo-notdocs | 45/100 | 3 days ago | |
| repulsivityy/elevate_2025.clinerules/coding_conventions.md · 2 | Cline rules | styledocs | 34/100 | 3 days ago | |
| repulsivityy/elevate_2025.clinerules/project_plan.md · 2 | Cline rules | agent-behaviour | 26/100 | 3 days ago | |
| repulsivityy/elevate_2025.clinerules/readme.md · 2 | Cline rules | setuparch | 52/100 | 3 days ago | |
| repulsivityy/elevate_2025.clinerules/reporting_templates.md · 2 | Cline rules | typessecurity | 44/100 | 3 days ago | |
| repulsivityy/elevate_2025.clinerules/suggested_mcp_tools.md · 2 | Cline rules | no sections | 34/100 | 3 days ago | |
| repulsivityy/elevate_2025ai-runbooks-elevate25/.clinerules/coding_conventions.md · 2 | Cline rules | styledocs | 34/100 | 3 days ago | |
| repulsivityy/elevate_2025ai-runbooks-elevate25/.clinerules/project_plan.md · 2 | Cline rules | agent-behaviour | 26/100 | 3 days ago | |
| repulsivityy/elevate_2025ai-runbooks-elevate25/.clinerules/readme.md · 2 | Cline rules | setuparch | 52/100 | 3 days ago | |
| repulsivityy/elevate_2025ai-runbooks-elevate25/.clinerules/reporting_templates.md · 2 | Cline rules | typessecurity | 44/100 | 3 days ago |
Diff against .clinerules/YARA_RULES_STYLE_GUIDE.md Diff against ai-runbooks-elevate25/.clinerules/suggested_mcp_tools.md Diff against .clinerules/SECOPS_YARAL_STYLE_GUIDE.md Diff against .clinerules/YARAL_SYNTAX.md Diff against .clinerules/coding_conventions.md Diff against .clinerules/project_plan.md Diff against .clinerules/readme.md Diff against .clinerules/reporting_templates.md Diff against .clinerules/suggested_mcp_tools.md Diff against ai-runbooks-elevate25/.clinerules/coding_conventions.md Diff against ai-runbooks-elevate25/.clinerules/project_plan.md Diff against ai-runbooks-elevate25/.clinerules/readme.md Diff against ai-runbooks-elevate25/.clinerules/reporting_templates.md
Similar configs
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| bashdeban/fastmind.clinerules/.project-consistency-keeper2.md · 5 | Cline rules | setupbuildtestlint-format+11 | 100/100 | 3 days ago | |
| JCodesMore/ai-website-cloner-template.clinerules · 31k | Cline rules | buildlint-formatstylearch+3 | 97/100 | 2 days ago | |
| BryaanF/LiantPortfolio.clinerules/project-guidelines.md · 0 | Cline rules | buildstylearchgit+2 | 96/100 | 3 days ago | |
| u9401066/zotero-keeper.clinerules/50-pubmed-project.md · 6 | Cline rules | testlint-formatstylearch+1 | 94/100 | 3 days ago | |
| u9401066/zotero-keepervscode-extension/resources/repo-assets/pubmed-search-mcp/.clinerules/50-pubmed-project.md · 6 | Cline rules | testlint-formatstylearch+1 | 94/100 | 3 days ago | |
| u9401066/pubmed-search-mcp.clinerules/50-pubmed-project.md · 23 | Cline rules | testlint-formatstylearch+1 | 94/100 | 3 days ago | |
| HerringtonDarkholme/megarepo.clinerules/02-development.md · 17 | Cline rules | setupbuildteststyle+3 | 92/100 | 3 days ago | |
| blendsdk/codeops-mcp.clinerules/project.md · 0 | Cline rules | buildteststylearch+7 | 91/100 | 3 days ago |
