opensearch-project / opensearch-project/security-analytics

SIGMA rule translation -> lucene query replaces spaces " " with "_ws_" which lucene doesnt understand.

Open
#1,024 12 comments 0 reactions 1 assignee View on GitHub

@sbcd90 is already working on this.

Since Oct 6, 2024.

bug
Dominant language
Java
Stars
111
Forks
111
Avg merge
1d 17h
Merged PRs (30d)
13

Description

What is the bug?
A sigma rules with a whitespace gets incorrectly translated to a search query with "ws" instead of a whitespace.

How can one reproduce the bug?
detection:
condition: (selection and selection_evt) and not filter_main_known_locations
filter_main_known_locations:
process.executable|contains:
- C:\Program Files (x86)\Windows Defender\
- C:\Program Files\Microsoft Security Client\
- C:\Program Files\Windows Defender\
- C:\ProgramData\Microsoft\Windows Defender\Platform\
- C:\Windows\WinSxS\
selection:
process.name:
- MpCmdRun.exe
- NisSrv.exe
selection_evt:
event.code: 1
event.module: sysmon

Results in:
(((process.name: "MpCmdRun.exe") OR (process.name: "NisSrv.exe")) AND ((event.code: 1) AND (event.module: "sysmon"))) AND ((((NOT process.executable: C:\Program_ws_Files_ws_(x86)\Windows_ws_Defender\ AND exists: process.executable) AND (NOT process.executable: C:\Program_ws_Files\Microsoft_ws_Security_ws_Client\ AND exists: process.executable) AND (NOT process.executable: C:\Program_ws_Files\Windows_ws_Defender\ AND exists: process.executable) AND (NOT process.executable: C:\ProgramData\Microsoft\Windows_ws_Defender\Platform\ AND exists: process.executable) AND (NOT process.executable: C:\Windows\WinSxS\ AND exists: process.executable))))

What is the expected behavior?
A whitespace should work properly in a sigma rule that is translated to a lucene query

What is your host/environment?
OS 2.13

Do you have any additional context?
Looking in github, I can see where the "ws" is being set. Not sure why.
https://github.com/search?q=repo%3Aopensearch-project%2Fsecurity-analytics%20%20_ws_&type=code

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.