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

Logic conversion issues #11

Open
theflakes opened this issue Apr 11, 2022 · 4 comments
Open

Logic conversion issues #11

theflakes opened this issue Apr 11, 2022 · 4 comments

Comments

@theflakes
Copy link
Owner

See: https://github.com/SigmaHQ/sigma/blob/b4cb047ae720b37b11f8506de7965dc29d5920be/rules/windows/registry/registry_set/registry_set_outlook_registry_todaypage.yml

detection:
selection1:
TargetObject|contains:
- 'Software\Microsoft\Office'
- '\Outlook\Today'
selectionStamp:
EventType: SetValue
TargetObject|endswith: Stamp
Details: DWORD (0x00000001)
selectionUserDefined:
TargetObject|endswith: UserDefinedUrl
filter_office:
Image|startswith:
- 'C:\Program Files\Common Files\Microsoft Shared\ClickToRun'
- 'C:\Program Files\Common Files\Microsoft Shared\ClickToRun\Updates'
Image|endswith: '\OfficeClickToRun.exe'
condition: selection1 and (selectionStamp or selectionUserDefined) and not 1 of filter_*

@theflakes
Copy link
Owner Author

Also see: https://github.com/SigmaHQ/sigma/blob/master/rules/windows/registry/registry_set/registry_set_persistence_search_order.yml

Problem is with lists and negation being converted correctly to Wazuh AND negation logic.

@theflakes
Copy link
Owner Author

theflakes commented Apr 14, 2022

Need to add check for detection token to see if it is a list (OR logic) or dictionary (AND logic).

OR Logic:
See: https://github.com/SigmaHQ/sigma/blob/master/rules/windows/registry/registry_set/registry_set_globalflags_persistence.yml

   {
      "selection_reg1": {
         "TargetObject|contains": [
            "\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion"
         ]
      },
      "selection_reg2": [
         {
            "TargetObject|contains|all": [
               "\\Image File Execution Options\\",
               "\\GlobalFlag"
            ]
         },
         {
            "TargetObject|contains|all": [
               "SilentProcessExit\\",
               "\\ReportingMode"
            ]
         },
         {
            "TargetObject|contains|all": [
               "SilentProcessExit\\",
               "\\MonitorProcess"
            ]
         }
      ],
      "condition": "selection_reg1 and selection_reg2"
   }

AND Logic:
See: https://github.com/SigmaHQ/sigma/blob/b4cb047ae720b37b11f8506de7965dc29d5920be/rules/windows/registry/registry_set/registry_set_outlook_registry_todaypage.yml

   {
      "selection1": {
         "TargetObject|contains": [
            "Software\\Microsoft\\Office\\",
            "\\Outlook\\Today\\"
         ]
      },
      "selectionStamp": {
         "EventType": "SetValue",
         "TargetObject|endswith": "Stamp",
         "Details": "DWORD (0x00000001)"
      },
      "selectionUserDefined": {
         "TargetObject|endswith": "UserDefinedUrl"
      },
      "filter_office": {
         "Image|startswith": [
            "C:\\Program Files\\Common Files\\Microsoft Shared\\ClickToRun\\",
            "C:\\Program Files\\Common Files\\Microsoft Shared\\ClickToRun\\Updates\\"
         ],
         "Image|endswith": "\\OfficeClickToRun.exe"
      },
      "condition": "selection1 and (selectionStamp or selectionUserDefined) and not 1 of filter_*"
   }

@theflakes
Copy link
Owner Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant