Skip to content

Definition of "logsource" values like product or category. #107

Description

@Maspital

Hey,

I am currently using chainsaw + SIGMA to evaluate log datasets and stumbled upon the following issue:
Certain SIGMA rules produce an abnormally high number of false positives, to the point where I suspect that it just triggers on most events. The rule in question is

title: Sysmon Blocked Executable
id: 23b71bc5-953e-4971-be4c-c896cda73fc2
description: Triggers on any Sysmon file block executable event. Which should indicates a violation of the block policy set
status: experimental
author: Nasreddine Bencherchali
date: 2022/08/16
references:
    - https://medium.com/@olafhartong/sysmon-14-0-fileblockexecutable-13d7ba3dff3e
tags:
    - attack.defense_evasion
logsource:
    product: windows
    category: file_block
detection:
    selection:
        Image: '*'
    condition: selection
falsepositives:
    - Unlikely
level: high

I think the problem is that the category in question (file_block) is not mapped to anything - where and how can I define this?
In this example, the category should be file_block iff "provider_name": "Microsoft-Windows-Sysmon" and event_id: 27, which would clearly identify the category.

I have a similar problem for several other rules. Am I perhaps misunderstanding how certain things work?

Any help on this would be much appreciated :)

Activity

  1. FranticTyping commented on Oct 12, 2022

    @FranticTyping
    Collaborator

    Hey @Maspital

    I'm guessing you're running chainsaw with the sigma-event-logs-all.yml mapping file. This mapping file does not filter based on provider name or category which means that some Sigma rules (like the file block one you mentioned above) cause a huge number of false positives.

    You could either extend the sigma rule to also require a specific event ID (which should cut down the number of FPs), or you could use the sigma-event-logs-legacy.yml mapping file instead which supports "Provider" mappings.

    I don't think either of these two options will completely solve your issue, but it should reduce the number of FPs that you face.

  2. alexkornitzer commented on Oct 12, 2022

    @alexkornitzer
    Collaborator

    There is also potential to add category support to the mapping to apply 'x' filter when category 'y' is set. But this would require code enhancements.

  3. Maspital commented on Oct 13, 2022

    @Maspital
    Author

    Yes, I'm using a modified version of sigma_event_logs.all (because winlogbeat likes to name stuff differently). Changing SIGMA rules themselves even slightly is something I would like to avoid because I want to be able to say "this dataset was created with SIGMA vXX" so it can be reproduced easily (though this is probably the easiest solution). In this case the change would be simple, but I wouldn't say I'm competent enough to confidently say that whatever change I intend to do does not change the intended result/logic of a given SIGMA rule :D

    Using the legacy mapping file seems like it both has a lot of duplicate entries and prevents any novel alerts from being shown because they are blocked by the manually set filters(?).

    Having category support like you mentioned @alexkornitzer would be a really nice and useful feature imo, but I dont know how much effort this would require on your part.

  4. added
    enhancementNew feature or request
    and removed
    questionFurther information is requested
    on Oct 13, 2022
  5. alexkornitzer commented on Oct 13, 2022

    @alexkornitzer
    Collaborator

    So adding this code wise is pretty easy the challenge comes from how to extend the mapping schema in a clear way, my current thinking is something like this:

    ---
    name: Chainsaw's groupless Sigma mappings for Event Logs
    kind: evtx
    rules: sigma
    ...
    
    extensions:
      preconditions:
        - for:
            category: file_block
          filter:
            int(EventID): 27
            Provider: Microsoft-Windows-Sysmon
    ...
    groups:
    ...
    

    Where the for block can consist of different identifiable fields of a Sigma rule.

  6. Maspital commented on Oct 13, 2022

    @Maspital
    Author

    That looks great! Assuming knowledge of Sigma rules in general, this is nice and understandable in my opinion.

    So this would work for whatever field may be defined within the logsource of a rule?

  7. alexkornitzer commented on Oct 13, 2022

    @alexkornitzer
    Collaborator

    Ah good spot nah I would wanna support things like name too, so it should be this:

    ---
    name: Chainsaw's groupless Sigma mappings for Event Logs
    kind: evtx
    rules: sigma
    ...
    
    extensions:
      preconditions:
        - for:
            logsource.category: file_block
          filter:
            int(EventID): 27
            Provider: Microsoft-Windows-Sysmon
    ...
    groups:
    ...
    

    But awesome, okay i'll see if I can do this when I get time otherwise i'll lob it at someone else :)

  8. Maspital commented on Oct 19, 2022

    @Maspital
    Author

    Any news regarding this? :) @alexkornitzer

  9. alexkornitzer commented on Oct 19, 2022

    @alexkornitzer
    Collaborator

    @Maspital can you give the feature/extensions branch a try?

  10. Maspital commented on Oct 19, 2022

    @Maspital
    Author

    Seems to work nicely, at least for the things I tested 👍 I will try it out in more detail tomorrow

  11. alexkornitzer commented on Oct 19, 2022

    @alexkornitzer
    Collaborator

    Awesome. If it all seems fine tomorrow i'll get that merged in and released.

  12. Maspital commented on Oct 20, 2022

    @Maspital
    Author

    I'm sure I didn't test for everything, but so far everything did what it was supposed to do. Two more things:

    • can the filter handle negated input? Might be useful for certain cases, it's not really important right now. Something like

      extensions:
      preconditions:
      - for:
          logsource.category: some_category
        filter:
          int(EventID): NOT 1337
      

      though there probably exists better/clearer syntax than that

    • One would probably only ever write these filters with one or a few specific rule in mind. Sadly, keywords like "file_block" are basically free text with no hard meaning attached to them - though this is more a flaw of Sigma in general imo. This means there could be other rules using the same keyword that now unintentionally get blocked by this filter

      To help with this, would it be possible to additionally declare a set of rules ["Some rule name", "Another rule name"] a filter should be assigned to? Or something similar.

    Both of these things are just afterthoughts, I think the new feature perfectly solves the original issue. Thank you so much for implementing it so quickly!

  13. alexkornitzer commented on Oct 20, 2022

    @alexkornitzer
    Collaborator

    Thanks for checking that all out. Right so the first one is probably not doable because I don't think I have put support in to handle nested syntax for a filter so this not(int(EventID)) probably won't work. We would need to upgrade the filter to be a full Tau block with condition support, so maybe that can come in later as its not too difficult to add. I should add array support into the for block as well but that can for now just be handled with copy paste, at the cost of duplication.

    I don't have a ton of time at the moment so I will merge the current work, and then your two above improvements can be added at a later date. For now I will keep this issue open as a reminder.

  14. Fuzzdkk commented on Apr 27, 2026

    @Fuzzdkk
    Contributor

    Triage note: this was implemented. The extensions.preconditions schema Alex sketched out is live in mappings/sigma-event-logs-all.yml and parsed in src/hunt.rs. The for: logsource.category: ... form Alex landed on is exactly what's in the file:

    extensions:
      preconditions:
        - for:
            logsource.category: process_creation
          filter:
            - Provider: Microsoft-Windows-Sysmon
              int(EventID): 1
            - Provider: Microsoft-Windows-Security-Auditing
              int(EventID): 4688

    Multiple categories covered (process_creation, network_connection, image_load, driver_load, etc.), so the original FP problem this was meant to address is handled in the default mapping. @Maspital probably safe to close unless you're hitting something the precondition system doesn't cover.

  15. alexkornitzer commented on Apr 28, 2026

    @alexkornitzer
    Collaborator

    @Fuzzdkk the reason this issue is still open was as a reminder about the 2 additional feature requests:

    1. negation operations, i.e. would this still not work (off the top of my head I can't remember, would need to check the code):
    extensions:
      preconditions:
        - for:
            logsource.category: process_creation
          filter:
              not(int(EventID)): 4688
    1. Additionally the preconditions needs to be extended with the ability to only apply to some Sigma rules.
  16. Fuzzdkk commented on Apr 28, 2026

    @Fuzzdkk
    Contributor

    On (1): doesn't work today. The precondition filter: is deserialized via crate::ext::tau::deserialize_expression (hunt.rs:38), which goes straight to tau's parse_identifier. The not(...) and ! prefix handling lives in parse_kv in src/ext/tau.rs, which preconditions skip. So not(int(EventID)): 4688 parses as a literal field key called not(int(EventID)) and never matches.

    Should be a small change: a precondition-specific deserializer that reuses the parse_kv path the same way Sigma rule fields do. There are no precondition tests either, worth adding some at the same time.

    On (2): partially possible already. for_ matches against anything Sigma::Document::find exposes (sigma.rs:44-72), so for: { id: "abc-..." } or for: { title: "Some Rule" } works for individual rules today. What's missing is list-of-rules in a single precondition (for: { id: [a, b] }) and the FIXME at hunt.rs:208-209: when two preconditions both match the same rule, the second silently overwrites the first via preconds.insert(...). Probably wants AND.

    Want me to take a stab at the negation one?

  17. alexkornitzer commented on Apr 28, 2026

    @alexkornitzer
    Collaborator

    Yep I am happy with that approach, parse_kv is what the search feature uses for its -t arguments. Using that function the syntax would be int(EventID): !4688 which is fine.

  18. alexkornitzer commented on May 2, 2026

    @alexkornitzer
    Collaborator

    As noted in the above PR, I changed my mind on this and went with an approach that reduces code and tau-chainsaw language fracturing, so we can now do:

    extensions:
      preconditions:
        - for:
            logsource.category: process_creation
          filter:
            not int(EventID): 1337
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions