Feature/#187 change allowlist regexes filenames (#189)
* add risk level filter arguments #45 * fix default level in help #45 * add test yaml files #45 * refactoring and fix level argument usage. * cargo fmt --all * add risk level filter arguments #45 * fix default level in help #45 * add test yaml files #45 * refactoring and fix level argument usage. * cargo fmt --all * update * change filename * fix regexe and allowlist filename in document #187 Co-authored-by: DustInDark <nextsasasa@gmail.com>
This commit is contained in:
@@ -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.
|
* 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.
|
* 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
|
### regexes and allowlist
|
||||||
Hayabusa provides built-in rules using regular expressions (defined in `regexes.txt`) and allowlisting (defined in `allowlist.txt`).
|
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.txt and allowlist.txt can be edited to change the behavior of all referenced rules at once.
|
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.
|
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
|
## 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.
|
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.
|
||||||
|
|||||||
@@ -238,10 +238,10 @@ detection:
|
|||||||
* regexes: 指定したファイルに記載された正規表現のリストにひとつでも一致すれば、`条件に一致した`ものとして処理されます。
|
* regexes: 指定したファイルに記載された正規表現のリストにひとつでも一致すれば、`条件に一致した`ものとして処理されます。
|
||||||
* allowlist: 指定したファイルに記載された正規表現のリストにひとつでも一致すれば、`条件に一致していない`ものとして処理されます。
|
* allowlist: 指定したファイルに記載された正規表現のリストにひとつでも一致すれば、`条件に一致していない`ものとして処理されます。
|
||||||
|
|
||||||
### regexes.txtとallowlist.txt
|
### regexesとallowlist
|
||||||
hayabusaではregexesやallowlistを使用した組み込みのルールを用意しており、それらのルールはregexes.txtとallowlist.txtを参照しています。regexes.txtとallowlist.txtを書き換えることで、参照する全てのルールの挙動を一度に変更することが可能です。
|
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
|
## condition
|
||||||
これまでの記法を用いると、AND条件やOR条件を表現することができますが、ANDやOR等が複雑に入り組んだ条件を定義することは難しい場合があります。その場合、conditionというキーワードを使用することで、複雑な条件式を定義することができます。
|
これまでの記法を用いると、AND条件やOR条件を表現することができますが、ANDやOR等が複雑に入り組んだ条件を定義することは難しい場合があります。その場合、conditionというキーワードを使用することで、複雑な条件式を定義することができます。
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ detection:
|
|||||||
Channel: System
|
Channel: System
|
||||||
EventID: 7030
|
EventID: 7030
|
||||||
param1:
|
param1:
|
||||||
regexes: ./regexes.txt
|
regexes: ./config/regex/regexes_suspicous_service.txt
|
||||||
# condition: selection
|
# condition: selection
|
||||||
falsepositives:
|
falsepositives:
|
||||||
- unknown
|
- unknown
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ detection:
|
|||||||
Channel: System
|
Channel: System
|
||||||
EventID: 7036
|
EventID: 7036
|
||||||
param1:
|
param1:
|
||||||
regexes: ./regexes.txt
|
regexes: ./config/regex/regexes_suspicous_service.txt
|
||||||
condition: selection
|
condition: selection
|
||||||
falsepositives:
|
falsepositives:
|
||||||
- unknown
|
- unknown
|
||||||
|
|||||||
@@ -6,10 +6,10 @@ detection:
|
|||||||
Channel: System
|
Channel: System
|
||||||
EventID: 7045
|
EventID: 7045
|
||||||
ServiceName:
|
ServiceName:
|
||||||
regexes: ./regexes.txt
|
regexes: ./config/regex/regexes_suspicous_service.txt
|
||||||
ImagePath:
|
ImagePath:
|
||||||
min_length: 1000
|
min_length: 1000
|
||||||
allowlist: ./allowlist.txt
|
allowlist: ./config/regex/allowlist_legimate_serviceimage.txt
|
||||||
condition: selection
|
condition: selection
|
||||||
falsepositives:
|
falsepositives:
|
||||||
- unknown
|
- unknown
|
||||||
|
|||||||
@@ -519,8 +519,8 @@ mod tests {
|
|||||||
- ホスト アプリケーション
|
- ホスト アプリケーション
|
||||||
ImagePath:
|
ImagePath:
|
||||||
min_length: 1234321
|
min_length: 1234321
|
||||||
regexes: ./regexes.txt
|
regexes: ./config/regex/regexes_suspicous_service.txt
|
||||||
allowlist: ./allowlist.txt
|
allowlist: ./config/regex/allowlist_legimate_serviceimage.txt
|
||||||
falsepositives:
|
falsepositives:
|
||||||
- unknown
|
- unknown
|
||||||
level: medium
|
level: medium
|
||||||
@@ -1081,7 +1081,7 @@ mod tests {
|
|||||||
selection:
|
selection:
|
||||||
EventID: 4103
|
EventID: 4103
|
||||||
Channel:
|
Channel:
|
||||||
- allowlist: allowlist.txt
|
- allowlist: ./config/regex/allowlist_legimate_serviceimage.txt
|
||||||
output: 'command=%CommandLine%'
|
output: 'command=%CommandLine%'
|
||||||
"#;
|
"#;
|
||||||
|
|
||||||
@@ -1113,7 +1113,7 @@ mod tests {
|
|||||||
selection:
|
selection:
|
||||||
EventID: 4103
|
EventID: 4103
|
||||||
Channel:
|
Channel:
|
||||||
- allowlist: allowlist.txt
|
- allowlist: ./config/regex/allowlist_legimate_serviceimage.txt
|
||||||
output: 'command=%CommandLine%'
|
output: 'command=%CommandLine%'
|
||||||
"#;
|
"#;
|
||||||
|
|
||||||
@@ -1145,7 +1145,7 @@ mod tests {
|
|||||||
selection:
|
selection:
|
||||||
EventID: 4103
|
EventID: 4103
|
||||||
Channel:
|
Channel:
|
||||||
- allowlist: allowlist.txt
|
- allowlist: ./config/regex/allowlist_legimate_serviceimage.txt
|
||||||
output: 'command=%CommandLine%'
|
output: 'command=%CommandLine%'
|
||||||
"#;
|
"#;
|
||||||
|
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_check_regex() {
|
fn test_check_regex() {
|
||||||
let regexes = utils::read_txt("regexes.txt")
|
let regexes = utils::read_txt("./config/regex/regexes_suspicous_service.txt")
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|regex_str| Regex::new(®ex_str).unwrap())
|
.map(|regex_str| Regex::new(®ex_str).unwrap())
|
||||||
@@ -168,7 +168,7 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn test_check_allowlist() {
|
fn test_check_allowlist() {
|
||||||
let commandline = "\"C:\\Program Files\\Google\\Update\\GoogleUpdate.exe\"";
|
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()
|
.unwrap()
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|allow_str| Regex::new(&allow_str).unwrap())
|
.map(|allow_str| Regex::new(&allow_str).unwrap())
|
||||||
|
|||||||
Reference in New Issue
Block a user