Yamato-Security / hayabusa-rules

Curated Windows event log Sigma rules used in Hayabusa and Velociraptor.
Other
135 stars 23 forks source link

[bug] `converter.py` does not convert `aggregation condition` correctly which has replaced fields #397

Closed fukusuket closed 1 year ago

fukusuket commented 1 year ago

Describe the bug converter.py does not convert aggregation condition correctly which has replaced fields🤔

https://github.com/Yamato-Security/hayabusa-rules/blob/805af2523d308cc18c4640536b538741b6e8498c/sigma/builtin/unsupported/windows/proc_creation_win_correlation_dnscat2_powershell_implementation.yml#L13-L22

In the above example, the field name conversion is done as follows in the selection ,

but condition's aggregation fields name does not converted.

Step to Reproduce

  1. execute convert.py
  2. check builtin/unsupported/windows/proc_creation_win_correlation_dnscat2_powershell_implementation.yml

Expected behavior condition's aggregation fields name converted as follows.

 SELECTION_3: 
     ParentProcessName: 
     - '*\powershell.exe' 
     - '*\pwsh.exe' 
 SELECTION_4: 
     NewProcessName: '*\nslookup.exe' 
 SELECTION_5: 
     CommandLine: '*\nslookup.exe' 
 condition: (SELECTION_1 and SELECTION_2 and SELECTION_3 and SELECTION_4 and SELECTION_5) 
     | count(NewProcessName) by ParentProcessName > 100 

Environment

Additional context Sigma original rule is https://github.com/SigmaHQ/sigma/blob/master/unsupported/windows/proc_creation_win_correlation_dnscat2_powershell_implementation.yml

fukusuket commented 1 year ago

This issue will be fixed in the following PR