Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Sigma Null Filters Not Translated To Query Properly #684

Closed
mimicbox opened this issue Oct 24, 2023 · 1 comment
Closed

[BUG] Sigma Null Filters Not Translated To Query Properly #684

mimicbox opened this issue Oct 24, 2023 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@mimicbox
Copy link

What is the bug?
Null filters in Sigma rules are not translated properly to queries leading to False Positives and broken detections.

Example:
Pre-packaged rule Wmiprvse Spawning Process contains a null filter
image

By sigma syntax this should only hit on documents where the LogonId field exists (As in NOT null)

The query is translated to this by OpenSearch:
((winlog.event_data.ParentImage: *\\WmiPrvSe.exe) AND ((NOT (((winlog.event_data.LogonId: "0x3e7") OR (winlog.event_data.LogonId: "null")) OR ((winlog.user.name: *AUTHORI*) OR (winlog.user.name: *AUTORI*)) OR ((winlog.event_data.Image: *\\WmiPrvSE.exe) OR (winlog.event_data.Image: *\\WerFault.exe)))))) AND ((NOT winlog.event_data.LogonId: null))

This is not working as intended. The NOT winlog.event_data.LogonId: null section is actually looking for null as a string. This query will return all documents that dont have winlog.event_data.LogonId equal to the string "null"

How can one reproduce the bug?
Steps to reproduce the behavior:

  1. Create any Sigma rule that uses a null filter (or use the prepackaged rule noted above)
  2. View its query and note the null filter is translated to NOT : null
  3. Go to discover
  4. Query for NOT <field>:null or simply: NOT winlog.event_data.LogonId:null
  5. All documents where the specified field is not the string "null" are returned (Nearly all data)

What is the expected behavior?
The sigma to be properly translated to something along the lines of:
winlog.event_data.LogonId:* where this returns results where the field being queried exists in the data

What is your host/environment?

  • OS: 2.11 fresh install

Thanks,
Jay

@mimicbox mimicbox added bug Something isn't working untriaged labels Oct 24, 2023
@eirsep eirsep self-assigned this Nov 21, 2023
@eirsep eirsep removed the untriaged label Nov 21, 2023
@engechas
Copy link
Collaborator

engechas commented Apr 9, 2024

Resolved by #722

@engechas engechas closed this as completed Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants