diff --git a/allowlist.txt b/config/regex/allowlist_legimate_serviceimage.txt similarity index 100% rename from allowlist.txt rename to config/regex/allowlist_legimate_serviceimage.txt diff --git a/regexes.txt b/config/regex/regexes_suspicous_service.txt similarity index 100% rename from regexes.txt rename to config/regex/regexes_suspicous_service.txt diff --git a/doc/AboutRuleCreation-English.md b/doc/AboutRuleCreation-English.md index 3696926a..a6e46bdd 100644 --- a/doc/AboutRuleCreation-English.md +++ b/doc/AboutRuleCreation-English.md @@ -243,12 +243,12 @@ Currently, the following keywords can be specified. * regexes: matches if one of the regular expressions in the file that you specify in this field matches. * allowlist: rule will be skipped if there is any match found in the list of regular expressions in the file that you specify in this field. -### regexes.txt and allowlist.txt -Hayabusa provides built-in rules using regular expressions (defined in `regexes.txt`) and allowlisting (defined in `allowlist.txt`). -regexes.txt and allowlist.txt can be edited to change the behavior of all referenced rules at once. +### regexes and allowlist +Hayabusa provides built-in rules using regular expressions (defined in `config/regex/regexes_suspicous_service.txt`) and allowlisting (defined in `config/regex/allowlist_legimate_serviceimage.txt`). +regexes and allowlist can be edited to change the behavior of all referenced rules at once. You can also specify to use different regexes and allowlist textfiles. -Please refer to the default regexes.txt and allowlist.txt when creating your own. +Please refer to the default regexes_suspicous_service.txt and allowlist_legimate_serviceimage.txt when creating your own. ## condition With the notation we explained above, you can express AND and OR logic but it will be confusing if you are trying to define complex logic. diff --git a/doc/AboutRuleCreation-Japanese.md b/doc/AboutRuleCreation-Japanese.md index 0b5023fe..acdaec18 100644 --- a/doc/AboutRuleCreation-Japanese.md +++ b/doc/AboutRuleCreation-Japanese.md @@ -238,10 +238,10 @@ detection: * regexes: 指定したファイルに記載された正規表現のリストにひとつでも一致すれば、`条件に一致した`ものとして処理されます。 * allowlist: 指定したファイルに記載された正規表現のリストにひとつでも一致すれば、`条件に一致していない`ものとして処理されます。 -### regexes.txtとallowlist.txt -hayabusaではregexesやallowlistを使用した組み込みのルールを用意しており、それらのルールはregexes.txtとallowlist.txtを参照しています。regexes.txtとallowlist.txtを書き換えることで、参照する全てのルールの挙動を一度に変更することが可能です。 +### regexesとallowlist +hayabusaではregexesやallowlistを使用した組み込みのルールを用意しており、それらのルールはhayabusa/config/regex内にあるregexes_suspicous_service.txtとallowlist_legimate_serviceimage.txtを参照しています。これらのファイルを書き換えることで、参照する全てのルールの挙動を一度に変更することが可能です。 -また、regexesやallowlistに指定するファイルは、ユーザーが独自に作成することも可能です。作成する場合、regexes.txtとallowlist.txtを参考にしてください。 +また、regexesやallowlistに指定するファイルは、ユーザーが独自に作成することも可能です。作成する場合、regexes_suspicous_service.txtとallowlist_legimate_serviceimage.txtを参考にしてください。 ## condition これまでの記法を用いると、AND条件やOR条件を表現することができますが、ANDやOR等が複雑に入り組んだ条件を定義することは難しい場合があります。その場合、conditionというキーワードを使用することで、複雑な条件式を定義することができます。 diff --git a/rules/System/7030.yml b/rules/System/7030.yml index 57e94a09..5c617130 100644 --- a/rules/System/7030.yml +++ b/rules/System/7030.yml @@ -6,7 +6,7 @@ detection: Channel: System EventID: 7030 param1: - regexes: ./regexes.txt + regexes: ./config/regex/regexes_suspicous_service.txt # condition: selection falsepositives: - unknown diff --git a/rules/System/7036.yml b/rules/System/7036.yml index 7d1753df..c4f8d6b4 100644 --- a/rules/System/7036.yml +++ b/rules/System/7036.yml @@ -6,7 +6,7 @@ detection: Channel: System EventID: 7036 param1: - regexes: ./regexes.txt + regexes: ./config/regex/regexes_suspicous_service.txt condition: selection falsepositives: - unknown diff --git a/rules/System/7045.yml b/rules/System/7045.yml index e0a9fe8a..e5a33e5b 100644 --- a/rules/System/7045.yml +++ b/rules/System/7045.yml @@ -6,10 +6,10 @@ detection: Channel: System EventID: 7045 ServiceName: - regexes: ./regexes.txt + regexes: ./config/regex/regexes_suspicous_service.txt ImagePath: min_length: 1000 - allowlist: ./allowlist.txt + allowlist: ./config/regex/allowlist_legimate_serviceimage.txt condition: selection falsepositives: - unknown diff --git a/src/detections/rule/matchers.rs b/src/detections/rule/matchers.rs index e38aa35c..f260f267 100644 --- a/src/detections/rule/matchers.rs +++ b/src/detections/rule/matchers.rs @@ -519,8 +519,8 @@ mod tests { - ホスト アプリケーション ImagePath: min_length: 1234321 - regexes: ./regexes.txt - allowlist: ./allowlist.txt + regexes: ./config/regex/regexes_suspicous_service.txt + allowlist: ./config/regex/allowlist_legimate_serviceimage.txt falsepositives: - unknown level: medium @@ -1081,7 +1081,7 @@ mod tests { selection: EventID: 4103 Channel: - - allowlist: allowlist.txt + - allowlist: ./config/regex/allowlist_legimate_serviceimage.txt output: 'command=%CommandLine%' "#; @@ -1113,7 +1113,7 @@ mod tests { selection: EventID: 4103 Channel: - - allowlist: allowlist.txt + - allowlist: ./config/regex/allowlist_legimate_serviceimage.txt output: 'command=%CommandLine%' "#; @@ -1145,7 +1145,7 @@ mod tests { selection: EventID: 4103 Channel: - - allowlist: allowlist.txt + - allowlist: ./config/regex/allowlist_legimate_serviceimage.txt output: 'command=%CommandLine%' "#; diff --git a/src/detections/utils.rs b/src/detections/utils.rs index 202e7410..aada5520 100644 --- a/src/detections/utils.rs +++ b/src/detections/utils.rs @@ -153,7 +153,7 @@ mod tests { #[test] fn test_check_regex() { - let regexes = utils::read_txt("regexes.txt") + let regexes = utils::read_txt("./config/regex/regexes_suspicous_service.txt") .unwrap() .into_iter() .map(|regex_str| Regex::new(®ex_str).unwrap()) @@ -168,7 +168,7 @@ mod tests { #[test] fn test_check_allowlist() { let commandline = "\"C:\\Program Files\\Google\\Update\\GoogleUpdate.exe\""; - let allowlist = utils::read_txt("allowlist.txt") + let allowlist = utils::read_txt("./config/regex/allowlist_legimate_serviceimage.txt") .unwrap() .into_iter() .map(|allow_str| Regex::new(&allow_str).unwrap())