From a5a055d75cfc3f56c88ab409c69d712c63aa5105 Mon Sep 17 00:00:00 2001
From: DastInDark <2350416+hitenkoku@users.noreply.github.com>
Date: Mon, 8 Aug 2022 23:40:57 +0900
Subject: [PATCH 01/12] Changed previous codename
---
src/detections/rule/matchers.rs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/detections/rule/matchers.rs b/src/detections/rule/matchers.rs
index 27d98c69..c881aa32 100644
--- a/src/detections/rule/matchers.rs
+++ b/src/detections/rule/matchers.rs
@@ -218,7 +218,7 @@ impl DefaultMatcher {
});
}
- /// YEAのルールファイルのフィールド名とそれに続いて指定されるパイプを、正規表現形式の文字列に変換します。
+ /// Hayabusaのルールファイルのフィールド名とそれに続いて指定されるパイプを、正規表現形式の文字列に変換します。
/// ワイルドカードの文字列を正規表現にする処理もこのメソッドに実装されています。patternにワイルドカードの文字列を指定して、pipesにPipeElement::Wildcardを指定すればOK!!
fn from_pattern_to_regex_str(pattern: String, pipes: &[PipeElement]) -> String {
// パターンをPipeで処理する。
From d6443ae14455a3e15fec501daa8455df3199dddb Mon Sep 17 00:00:00 2001
From: DastInDark <2350416+hitenkoku@users.noreply.github.com>
Date: Wed, 10 Aug 2022 00:44:05 +0900
Subject: [PATCH 02/12] added exist check when rule value is null #643
---
src/detections/rule/matchers.rs | 73 +++++++++++++++++++++++++++++++--
1 file changed, 70 insertions(+), 3 deletions(-)
diff --git a/src/detections/rule/matchers.rs b/src/detections/rule/matchers.rs
index c881aa32..cef96ee5 100644
--- a/src/detections/rule/matchers.rs
+++ b/src/detections/rule/matchers.rs
@@ -346,14 +346,18 @@ impl LeafMatcher for DefaultMatcher {
return false;
}
- if event_value.is_none() {
+ // yamlにnullが設定されていた場合
+ if self.re.is_none() {
+ for v in self.key_list.iter() {
+ if recinfo.get_value(v).is_none() {return true;}
+ }
return false;
- }
+ }
let event_value_str = event_value.unwrap();
if self.key_list.is_empty() {
// この場合ただのgrep検索なので、ただ正規表現に一致するかどうか調べればよいだけ
- return self.re.as_ref().unwrap().is_match(event_value_str);
+ self.re.as_ref().unwrap().is_match(event_value_str)
} else {
// 通常の検索はこっち
self.is_regex_fullmatch(event_value_str)
@@ -1984,4 +1988,67 @@ mod tests {
}
}
}
+
+ #[test]
+ fn test_eq_field_null() {
+ // 値でnullであった場合に対象のフィールドが存在しないことを確認
+ let rule_str = r#"
+ enabled: true
+ detection:
+ selection:
+ Channel:
+ value: Security
+ Takoyaki:
+ value: null
+ details: 'command=%CommandLine%'
+ "#;
+
+ let record_json_str = r#"
+ {
+ "Event": {"System": {"EventID": 4103, "Channel": "Security", "Computer": "Powershell" }},
+ "Event_attributes": {"xmlns": "http://schemas.microsoft.com/win/2004/08/events/event"}
+ }"#;
+
+ let mut rule_node = parse_rule_from_str(rule_str);
+ match serde_json::from_str(record_json_str) {
+ Ok(record) => {
+ let keys = detections::rule::get_detection_keys(&rule_node);
+ let recinfo = utils::create_rec_info(record, "testpath".to_owned(), &keys);
+ assert!(rule_node.select(&recinfo));
+ }
+ Err(_) => {
+ panic!("Failed to parse json record.");
+ }
+ }
+ }
+ #[test]
+ fn test_eq_field_null_not_detect() {
+ // 値でnullであった場合に対象のフィールドが存在しないことを確認するテスト
+ let rule_str = r#"
+ enabled: true
+ detection:
+ selection:
+ EventID: null
+ details: 'command=%CommandLine%'
+ "#;
+
+ let record_json_str = r#"{
+ "Event": {"System": {"EventID": 4103, "Channel": "Security", "Computer": "Powershell"}},
+ "Event_attributes": {"xmlns": "http://schemas.microsoft.com/win/2004/08/events/event"}
+ }"#;
+
+ let mut rule_node = parse_rule_from_str(rule_str);
+ match serde_json::from_str(record_json_str) {
+ Ok(record) => {
+ let keys = detections::rule::get_detection_keys(&rule_node);
+ let recinfo = utils::create_rec_info(record, "testpath".to_owned(), &keys);
+ println!("test :: keys {:?} | recinfo {:?}\n", keys, recinfo.record["Takoyaki"]);
+ assert!(!rule_node.select(&recinfo));
+ }
+ Err(e) => {
+ panic!("Failed to parse json record.{:?}", e );
+ }
+ }
+ }
+
}
From 506b2ce283ab0dff6a996e741a3fc07f10fe22bc Mon Sep 17 00:00:00 2001
From: DastInDark <2350416+hitenkoku@users.noreply.github.com>
Date: Wed, 10 Aug 2022 00:45:49 +0900
Subject: [PATCH 03/12] cargo fmt
---
src/detections/rule/matchers.rs | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/detections/rule/matchers.rs b/src/detections/rule/matchers.rs
index cef96ee5..074986c0 100644
--- a/src/detections/rule/matchers.rs
+++ b/src/detections/rule/matchers.rs
@@ -349,10 +349,12 @@ impl LeafMatcher for DefaultMatcher {
// yamlにnullが設定されていた場合
if self.re.is_none() {
for v in self.key_list.iter() {
- if recinfo.get_value(v).is_none() {return true;}
+ if recinfo.get_value(v).is_none() {
+ return true;
+ }
}
return false;
- }
+ }
let event_value_str = event_value.unwrap();
if self.key_list.is_empty() {
@@ -2042,13 +2044,11 @@ mod tests {
Ok(record) => {
let keys = detections::rule::get_detection_keys(&rule_node);
let recinfo = utils::create_rec_info(record, "testpath".to_owned(), &keys);
- println!("test :: keys {:?} | recinfo {:?}\n", keys, recinfo.record["Takoyaki"]);
assert!(!rule_node.select(&recinfo));
}
Err(e) => {
- panic!("Failed to parse json record.{:?}", e );
+ panic!("Failed to parse json record.{:?}", e);
}
}
}
-
}
From 67525f0b8284c0884a46a1cc9318d8fcc940ab34 Mon Sep 17 00:00:00 2001
From: DastInDark <2350416+hitenkoku@users.noreply.github.com>
Date: Wed, 10 Aug 2022 00:54:11 +0900
Subject: [PATCH 04/12] updated changelog #643
---
CHANGELOG-Japanese.md | 1 +
CHANGELOG.md | 3 ++-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/CHANGELOG-Japanese.md b/CHANGELOG-Japanese.md
index b79fafdc..d21e3709 100644
--- a/CHANGELOG-Japanese.md
+++ b/CHANGELOG-Japanese.md
@@ -5,6 +5,7 @@
**新機能:**
- `config/profiles.yaml`と`config/default_profile.yaml`の設定ファイルで、出力内容をカスタマイズできる。 (#165) (@hitenkoku)
+- 対象のフィールドがレコード内に存在しないことを確認する `null` キーワードに対応した。 (#643) (@hitenkoku)
**改善:**
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f27030c9..2dffc9a2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,7 +4,8 @@
**New Features:**
-- Customizable output of fields defined at `config/profiles.yaml` and `config/default_profile.yaml` (#165) (@hitenkoku)
+- Customizable output of fields defined at `config/profiles.yaml` and `config/default_profile.yaml`. (#165) (@hitenkoku)
+- Implemented `null` keyword in rule. This paramter is used to check target field is not exist in record. (#643) (@hitenkoku)
**Enhancements:**
From 7b4f2f3717a204043a40e158371c3183f2aa4245 Mon Sep 17 00:00:00 2001
From: DastInDark <2350416+hitenkoku@users.noreply.github.com>
Date: Wed, 10 Aug 2022 01:06:39 +0900
Subject: [PATCH 05/12] reverted removed event_value none check
---
src/detections/rule/matchers.rs | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/detections/rule/matchers.rs b/src/detections/rule/matchers.rs
index 074986c0..8dc94bc1 100644
--- a/src/detections/rule/matchers.rs
+++ b/src/detections/rule/matchers.rs
@@ -348,6 +348,7 @@ impl LeafMatcher for DefaultMatcher {
// yamlにnullが設定されていた場合
if self.re.is_none() {
+ // レコード内に対象のフィールドが存在しなければ検知したものとして扱う
for v in self.key_list.iter() {
if recinfo.get_value(v).is_none() {
return true;
@@ -356,6 +357,10 @@ impl LeafMatcher for DefaultMatcher {
return false;
}
+ if event_value.is_none() {
+ return false;
+ }
+
let event_value_str = event_value.unwrap();
if self.key_list.is_empty() {
// この場合ただのgrep検索なので、ただ正規表現に一致するかどうか調べればよいだけ
From 86c3770b5a07a97438acf9076350cc42299ded30 Mon Sep 17 00:00:00 2001
From: Tanaka Zakku <71482215+YamatoSecurity@users.noreply.github.com>
Date: Wed, 10 Aug 2022 10:29:21 +0900
Subject: [PATCH 06/12] updated changelog
---
CHANGELOG.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c3a72e40..a14081c8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,13 +5,13 @@
**New Features:**
- Customizable output of fields defined at `config/profiles.yaml` and `config/default_profile.yaml`. (#165) (@hitenkoku)
-- Implemented `null` keyword in rule. This paramter is used to check target field is not exist in record. (#643) (@hitenkoku)
+- Implemented the `null` keyword for rule detection. It is used to check if a target field exists or not. (#643) (@hitenkoku)
**Enhancements:**
- Removed ./ from rule path when updating. (#642) (@hitenkoku)
- Added new output alias for MITRE ATT&CK tags and other tags. (#637) (@hitenkoku)
-- Changed output summary numbers from without commas to with commas. (#649) (@hitenkoku)
+- Added commas to summary numbers to make them easier to read. (#649) (@hitenkoku)
**Bug Fixes:**
From e7f29a8c3083361c5f8ab027a0fe8137b841500a Mon Sep 17 00:00:00 2001
From: Tanaka Zakku <71482215+YamatoSecurity@users.noreply.github.com>
Date: Wed, 10 Aug 2022 10:38:31 +0900
Subject: [PATCH 07/12] ignore hayabusa binaries
---
.gitignore | 3 ++-
README-Japanese.md | 2 +-
README.md | 2 +-
hayabusa-logo.png => logo.png | Bin
4 files changed, 4 insertions(+), 3 deletions(-)
rename hayabusa-logo.png => logo.png (100%)
diff --git a/.gitignore b/.gitignore
index eafef81f..eec35107 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,4 +6,5 @@
test_*
.env
/logs
-*.csv
\ No newline at end of file
+*.csv
+hayabusa*
\ No newline at end of file
diff --git a/README-Japanese.md b/README-Japanese.md
index 1759e3f5..ad8f7b8a 100644
--- a/README-Japanese.md
+++ b/README-Japanese.md
@@ -1,6 +1,6 @@
diff --git a/README.md b/README.md
index e3e6ff89..0f23c0dc 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
-
+
[
English ] | [
日本語]
diff --git a/hayabusa-logo.png b/logo.png
similarity index 100%
rename from hayabusa-logo.png
rename to logo.png
From c7f44bd315acabcf4cdb0ecdb89f31f1c2d43c4e Mon Sep 17 00:00:00 2001
From: Tanaka Zakku <71482215+YamatoSecurity@users.noreply.github.com>
Date: Wed, 10 Aug 2022 10:48:32 +0900
Subject: [PATCH 08/12] updated menu
---
src/detections/configs.rs | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/detections/configs.rs b/src/detections/configs.rs
index 7518db47..637bf772 100644
--- a/src/detections/configs.rs
+++ b/src/detections/configs.rs
@@ -185,7 +185,7 @@ pub struct Config {
/// Tune alert levels (default: ./rules/config/level_tuning.txt)
#[clap(
- help_heading = Some("ADVANCED"),
+ help_heading = Some("OTHER-ACTIONS"),
long = "level-tuning",
hide_default_value = true,
value_name = "FILE"
@@ -216,12 +216,12 @@ pub struct Config {
#[clap(help_heading = Some("FILTERING"), long = "exclude-status", multiple_values = true, value_name = "STATUS")]
pub exclude_status: Option>,
- /// Specify output profile
- #[clap(help_heading = Some("OUTPUT-SETTINGS"), short = 'P', long = "profile")]
+ /// Specify output profile (minimal, standard, verbose, verbose-all-field-info, verbose-details-and-all-field-info)
+ #[clap(help_heading = Some("OUTPUT"), short = 'P', long = "profile")]
pub profile: Option,
- /// Set default output profile
- #[clap(help_heading = Some("OUTPUT-SETTINGS"), long = "set-default-profile", value_name = "PROFILE")]
+ /// Set default output profile (minimal, standard, verbose, verbose-all-field-info, verbose-details-and-all-field-info)
+ #[clap(help_heading = Some("OTHER-ACTIONS"), long = "set-default-profile", value_name = "PROFILE")]
pub set_default_profile: Option,
}
From 5d48ad4a2612d334108a49eee979b6eff18293d5 Mon Sep 17 00:00:00 2001
From: Yamato Security <71482215+YamatoSecurity@users.noreply.github.com>
Date: Thu, 11 Aug 2022 00:29:48 +0900
Subject: [PATCH 09/12] update readme
---
Cargo.lock | 85 +++++++++++---
README-Japanese.md | 223 +++++++++++++++++++++++--------------
README.md | 226 +++++++++++++++++++++++---------------
src/detections/configs.rs | 2 +-
4 files changed, 343 insertions(+), 193 deletions(-)
diff --git a/Cargo.lock b/Cargo.lock
index 809de233..8e1386c1 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -28,6 +28,15 @@ dependencies = [
"memchr",
]
+[[package]]
+name = "android_system_properties"
+version = "0.1.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d7ed72e1635e121ca3e79420540282af22da58be50de153d36f81ddc6b83aa9e"
+dependencies = [
+ "libc",
+]
+
[[package]]
name = "ansi_term"
version = "0.12.1"
@@ -200,15 +209,17 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "chrono"
-version = "0.4.19"
+version = "0.4.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73"
+checksum = "3f725f340c3854e3cb3ab736dc21f0cca183303acea3b3ffec30f141503ac8eb"
dependencies = [
- "libc",
+ "iana-time-zone",
+ "js-sys",
"num-integer",
"num-traits",
"serde",
"time 0.1.44",
+ "wasm-bindgen",
"winapi",
]
@@ -292,6 +303,22 @@ version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc"
+[[package]]
+name = "core-foundation"
+version = "0.9.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146"
+dependencies = [
+ "core-foundation-sys",
+ "libc",
+]
+
+[[package]]
+name = "core-foundation-sys"
+version = "0.8.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc"
+
[[package]]
name = "crc32fast"
version = "1.3.2"
@@ -793,7 +820,7 @@ checksum = "75f43d41e26995c17e71ee126451dd3941010b0514a81a9d11f3b341debc2399"
dependencies = [
"bytes",
"fnv",
- "itoa 1.0.2",
+ "itoa 1.0.3",
]
[[package]]
@@ -842,7 +869,7 @@ dependencies = [
"http-body",
"httparse",
"httpdate",
- "itoa 1.0.2",
+ "itoa 1.0.3",
"pin-project-lite",
"tokio",
"tower-service",
@@ -850,6 +877,19 @@ dependencies = [
"want",
]
+[[package]]
+name = "iana-time-zone"
+version = "0.1.41"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "1779539f58004e5dba1c1f093d44325ebeb244bfc04b791acdc0aaeca9c04570"
+dependencies = [
+ "android_system_properties",
+ "core-foundation",
+ "js-sys",
+ "wasm-bindgen",
+ "winapi",
+]
+
[[package]]
name = "idna"
version = "0.2.3"
@@ -930,9 +970,9 @@ checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4"
[[package]]
name = "itoa"
-version = "1.0.2"
+version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "112c678d4050afce233f4f2852bb2eb519230b3cf12f33585275537d7e41578d"
+checksum = "6c8af84674fe1f223a982c933a0ee1086ac4d4052aa0fb8060c12c6ad838e754"
[[package]]
name = "jemalloc-sys"
@@ -964,6 +1004,15 @@ dependencies = [
"libc",
]
+[[package]]
+name = "js-sys"
+version = "0.3.59"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "258451ab10b34f8af53416d1fdab72c22e805f0c92a1136d59470ec0b11138b2"
+dependencies = [
+ "wasm-bindgen",
+]
+
[[package]]
name = "krapslog"
version = "0.4.0"
@@ -993,9 +1042,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]]
name = "libc"
-version = "0.2.126"
+version = "0.2.129"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836"
+checksum = "64de3cc433455c14174d42e554d4027ee631c4d046d43e3ecc6efc4636cdc7a7"
[[package]]
name = "libgit2-sys"
@@ -1586,18 +1635,18 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
[[package]]
name = "serde"
-version = "1.0.141"
+version = "1.0.143"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7af873f2c95b99fcb0bd0fe622a43e29514658873c8ceba88c4cb88833a22500"
+checksum = "53e8e5d5b70924f74ff5c6d64d9a5acd91422117c60f48c4e07855238a254553"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
-version = "1.0.141"
+version = "1.0.143"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "75743a150d003dd863b51dc809bcad0d73f2102c53632f1e954e738192a3413f"
+checksum = "d3d8e8de557aee63c26b85b947f5e59b690d0454c753f3adeb5cd7835ab88391"
dependencies = [
"proc-macro2",
"quote",
@@ -1606,11 +1655,11 @@ dependencies = [
[[package]]
name = "serde_json"
-version = "1.0.82"
+version = "1.0.83"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "82c2c1fdcd807d1098552c5b9a36e425e42e9fbd7c6a37a8425f390f781f7fa7"
+checksum = "38dd04e3c8279e75b31ef29dbdceebfe5ad89f4d0937213c53f7d49d01b3d5a7"
dependencies = [
- "itoa 1.0.2",
+ "itoa 1.0.3",
"ryu",
"serde",
]
@@ -2002,9 +2051,9 @@ checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992"
[[package]]
name = "unicode-ident"
-version = "1.0.2"
+version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "15c61ba63f9235225a22310255a29b806b907c9b8c964bcbd0a2c70f3f2deea7"
+checksum = "c4f5b37a154999a8f3f98cc23a628d850e154479cd94decf3414696e12e31aaf"
[[package]]
name = "unicode-normalization"
diff --git a/README-Japanese.md b/README-Japanese.md
index ad8f7b8a..2dee460d 100644
--- a/README-Japanese.md
+++ b/README-Japanese.md
@@ -48,19 +48,28 @@ Hayabusaは、日本の[Yamato Security](https://yamatosecurity.connpass.com/)
- [32ビットWindowsバイナリのクロスコンパイル](#32ビットwindowsバイナリのクロスコンパイル)
- [macOSでのコンパイルの注意点](#macosでのコンパイルの注意点)
- [Linuxでのコンパイルの注意点](#linuxでのコンパイルの注意点)
+ - [LinuxのMUSLバイナリのクロスコンパイル](#linuxのmuslバイナリのクロスコンパイル)
+ - [Linuxでのコンパイルの注意点](#linuxでのコンパイルの注意点-1)
- [Hayabusaの実行](#hayabusaの実行)
- [注意: アンチウィルス/EDRの誤検知と遅い初回実行](#注意-アンチウィルスedrの誤検知と遅い初回実行)
- [Windows](#windows)
- [Linux](#linux)
- [macOS](#macos)
- [使用方法](#使用方法)
+ - [主なコマンド](#主なコマンド)
- [コマンドラインオプション](#コマンドラインオプション)
- [使用例](#使用例)
- [ピボットキーワードの作成](#ピボットキーワードの作成)
- [ログオン情報の要約](#ログオン情報の要約)
- [サンプルevtxファイルでHayabusaをテストする](#サンプルevtxファイルでhayabusaをテストする)
-- [Hayabusaの出力](#hayabusaの出力)
- - [プロファイルによる出力のカスタマイズ](#プロファイルによる出力のカスタマイズ)
+- [Hayabusaの出力プロファイル](#hayabusaの出力プロファイル)
+ - [1. `minimal`プロファイルの出力](#1-minimalプロファイルの出力)
+ - [2. `standard`プロファイルの出力](#2-standardプロファイルの出力)
+ - [3. `verbose`プロファイルの出力](#3-verboseプロファイルの出力)
+ - [4. `verbose-all-field-info`プロファイルの出力](#4-verbose-all-field-infoプロファイルの出力)
+ - [5. `verbose-details-and-all-field-info`プロファイルの出力](#5-verbose-details-and-all-field-infoプロファイルの出力)
+ - [プロファイルの比較](#プロファイルの比較)
+ - [Profile Field Aliases](#profile-field-aliases)
- [Levelの省略](#levelの省略)
- [MITRE ATT&CK戦術の省略](#mitre-attck戦術の省略)
- [Channel情報の省略](#channel情報の省略)
@@ -183,7 +192,7 @@ git clone https://github.com/Yamato-Security/hayabusa.git --recursive
`git pull --recurse-submodules`コマンド、もしくは以下のコマンドで`rules`フォルダを同期し、Hayabusaの最新のルールを更新することができます:
```bash
-hayabusa-1.4.3-win-x64.exe -u
+hayabusa-1.5.0-win-x64.exe -u
```
アップデートが失敗した場合は、`rules`フォルダの名前を変更してから、もう一回アップデートしてみて下さい。
@@ -198,7 +207,6 @@ hayabusa-1.4.3-win-x64.exe -u
Rustがインストールされている場合、以下のコマンドでソースコードからコンパイルすることができます:
```bash
-cargo clean
cargo build --release
```
@@ -254,6 +262,24 @@ Fedora系のディストロ:
sudo yum install openssl-devel
```
+## LinuxのMUSLバイナリのクロスコンパイル
+
+まず、Linux OSでターゲットをインストールします。
+
+```bash
+rustup install stable-x86_64-unknown-linux-musl
+rustup target add x86_64-unknown-linux-musl
+```
+
+以下のようにコンパイルします:
+
+```
+rustup run stable-x86_64-unknown-linux-musl cargo build --release
+```
+
+## Linuxでのコンパイルの注意点
+
+
# Hayabusaの実行
## 注意: アンチウィルス/EDRの誤検知と遅い初回実行
@@ -268,20 +294,20 @@ Windows PC起動後の初回実行時に時間がかかる場合があります
コマンドプロンプトやWindows Terminalから32ビットもしくは64ビットのWindowsバイナリをHayabusaのルートディレクトリから実行します。
-例: `hayabusa-1.4.3-windows-x64.exe`
+例: `hayabusa-1.5.0-windows-x64.exe`
## Linux
まず、バイナリに実行権限を与える必要があります。
```bash
-chmod +x ./hayabusa-1.4.3-linux-x64-gnu
+chmod +x ./hayabusa-1.5.0-linux-x64-gnu
```
次に、Hayabusaのルートディレクトリから実行します:
```bash
-./hayabusa-1.4.3-linux-x64-gnu
+./hayabusa-1.5.0-linux-x64-gnu
```
## macOS
@@ -289,13 +315,13 @@ chmod +x ./hayabusa-1.4.3-linux-x64-gnu
まず、ターミナルやiTerm2からバイナリに実行権限を与える必要があります。
```bash
-chmod +x ./hayabusa-1.4.3-mac-intel
+chmod +x ./hayabusa-1.5.0-mac-intel
```
次に、Hayabusaのルートディレクトリから実行してみてください:
```bash
-./hayabusa-1.4.3-mac-intel
+./hayabusa-1.5.0-mac-intel
```
macOSの最新版では、以下のセキュリティ警告が出る可能性があります:
@@ -309,7 +335,7 @@ macOSの環境設定から「セキュリティとプライバシー」を開き
その後、ターミナルからもう一回実行してみてください:
```bash
-./hayabusa-1.4.3-mac-intel
+./hayabusa-1.5.0-mac-intel
```
以下の警告が出るので、「開く」をクリックしてください。
@@ -319,6 +345,15 @@ macOSの環境設定から「セキュリティとプライバシー」を開き
これで実行できるようになります。
# 使用方法
+## 主なコマンド
+
+* デフォルト: ファストフォレンジックタイムラインの作成。
+* `--level-tuning`: アラート`level`のカスタムチューニング
+* `-L, --logon-summary`: ログオンイベントのサマリを出力する。
+* `-P, --pivot-keywords-list`: ピボットする不審なキーワードのリスト作成。
+* `-s, --statistics`: イベントIDに基づくイベントの合計と割合の集計を出力する。
+* `--set-default-profile`: デフォルトプロファイルを変更する。
+* `-u, --update`: GitHubの[hayabusa-rules](https://github.com/Yamato-Security/hayabusa-rules)リポジトリにある最新のルールに同期させる。
## コマンドラインオプション
@@ -326,10 +361,6 @@ macOSの環境設定から「セキュリティとプライバシー」を開き
USAGE:
hayabusa.exe [OTHER-ACTIONS] [OPTIONS]
-OPTIONS:
- -h, --help ヘルプ情報を表示する
- --version バージョン情報を表示する
-
INPUT:
-d, --directory .evtxファイルを持つディレクトリのパス
-f, --file 1つの.evtxファイルに対して解析を行う
@@ -337,14 +368,14 @@ INPUT:
ADVANCED:
-c, --rules-config ルールフォルダのコンフィグディレクトリ (デフォルト: ./rules/config)
- --level-tuning [] ルールlevelのチューニング (デフォルト: ./rules/config/level_tuning.txt)
-Q, --quiet-errors Quiet errorsモード: エラーログを保存しない
-r, --rules ルールファイルまたはルールファイルを持つディレクトリ (デフォルト: ./rules)
-t, --thread-number スレッド数 (デフォルト: パフォーマンスに最適な数値)
--target-file-ext ... evtx以外の拡張子を解析対象に追加する。 (例1: evtx_data 例2:evtx1 evtx2)
OUTPUT:
- -o, --output タイムラインをCSV形式で保存する (例: results.csv)
+ -o, --output タイムラインをCSV形式で保存する (例: results.csv)
+ -P, --profile 利用する出力プロファイル名を指定する (minimal, standard, verbose, verbose-all-field-info, verbose-details-and-all-field-info)
DISPLAY-SETTINGS:
--no-color カラー出力を無効にする
@@ -353,7 +384,7 @@ DISPLAY-SETTINGS:
-V, --visualize-timeline イベント頻度タイムラインを出力する
FILTERING:
- -D, --deep-scan すべてのイベントIDを対象にしたスキャンを行う
+ -D, --deep-scan すべてのイベントIDを対象にしたスキャンを行う(遅くなる)
--enable-deprecated-rules Deprecatedルールを有効にする
--exclude-status ... 読み込み対象外とするルール内でのステータス (ex: experimental) (ex: stable test)
-m, --min-level 結果出力をするルールの最低レベル (デフォルト: informational)
@@ -364,8 +395,10 @@ FILTERING:
OTHER-ACTIONS:
--contributors コントリビュータの一覧表示
-L, --logon-summary 成功と失敗したログオン情報の要約を出力する
+ --level-tuning [] ルールlevelのチューニング (デフォルト: ./rules/config/level_tuning.txt)
-p, --pivot-keywords-list ピボットキーワードの一覧作成
-s, --statistics イベントIDの統計情報を表示する
+ --set-default-profile デフォルトの出力コンフィグを設定する
-u, --update-rules rulesフォルダをhayabusa-rulesのgithubリポジトリの最新版に更新する
TIME-FORMAT:
@@ -375,10 +408,6 @@ TIME-FORMAT:
--US-military-time 24時間制(ミリタリータイム)のアメリカ形式で日付と時刻を出力する (例: 02-22-2022 22:00:00.123 -06:00)
--US-time アメリカ形式で日付と時刻を出力する (例: 02-22-2022 10:00:00.123 PM -06:00)
-U, --UTC UTC形式で日付と時刻を出力する (デフォルト: 現地時間)
-
-OUTPUT-SETTINGS:
- -P, --profile 利用する出力プロファイル名を指定する
- --set-default-profile デフォルトの出力コンフィグを設定する
```
## 使用例
@@ -386,79 +415,84 @@ OUTPUT-SETTINGS:
* 1つのWindowsイベントログファイルに対してHayabusaを実行します:
```bash
-hayabusa-1.4.3-win-x64.exe -f eventlog.evtx
+hayabusa-1.5.0-win-x64.exe -f eventlog.evtx
```
-* 複数のWindowsイベントログファイルのあるsample-evtxディレクトリに対して、Hayabusaを実行します:
+* `verbose`プロファイルで複数のWindowsイベントログファイルのあるsample-evtxディレクトリに対して、Hayabusaを実行します:
```bash
-hayabusa-1.4.3-win-x64.exe -d .\hayabusa-sample-evtx
+hayabusa-1.5.0-win-x64.exe -d .\hayabusa-sample-evtx -P verbose
```
-* 全てのフィールド情報も含めて1つのCSVファイルにエクスポートして、Excel、Timeline Explorer、Elastic Stack等でさらに分析することができます(注意: `-F`を有効にすると、出力するファイルのサイズがとても大きくなります!):
+* 全てのフィールド情報も含めて1つのCSVファイルにエクスポートして、Excel、Timeline Explorer、Elastic Stack等でさらに分析することができます(注意: `verbose-details-and-all-field-info`プロファイルを使すると、出力するファイルのサイズがとても大きくなります!):
```bash
-hayabusa-1.4.3-win-x64.exe -d .\hayabusa-sample-evtx -o results.csv -F
+hayabusa-1.5.0-win-x64.exe -d .\hayabusa-sample-evtx -o results.csv -P `verbose-details-and-all-field-info`
```
-* Hayabusaルールのみを実行します(デフォルトでは `-r .\rules` にあるすべてのルールが利用されます):
+* Hayabusaルールのみを実行します(デフォルトでは`-r .\rules`にあるすべてのルールが利用されます):
```bash
-hayabusa-1.4.3-win-x64.exe -d .\hayabusa-sample-evtx -r .\rules\hayabusa -o results.csv
+hayabusa-1.5.0-win-x64.exe -d .\hayabusa-sample-evtx -r .\rules\hayabusa -o results.csv
```
* Windowsでデフォルトで有効になっているログに対してのみ、Hayabusaルールを実行します:
```bash
-hayabusa-1.4.3-win-x64.exe -d .\hayabusa-sample-evtx -r .\rules\hayabusa\default -o results.csv
+hayabusa-1.5.0-win-x64.exe -d .\hayabusa-sample-evtx -r .\rules\hayabusa\default -o results.csv
```
* Sysmonログに対してのみHayabusaルールを実行します:
```bash
-hayabusa-1.4.3-win-x64.exe -d .\hayabusa-sample-evtx -r .\rules\hayabusa\sysmon -o results.csv
+hayabusa-1.5.0-win-x64.exe -d .\hayabusa-sample-evtx -r .\rules\hayabusa\sysmon -o results.csv
```
* Sigmaルールのみを実行します:
```bash
-hayabusa-1.4.3-win-x64.exe -d .\hayabusa-sample-evtx -r .\rules\sigma -o results.csv
+hayabusa-1.5.0-win-x64.exe -d .\hayabusa-sample-evtx -r .\rules\sigma -o results.csv
```
* 廃棄(deprecated)されたルール(`status`が`deprecated`になっているルール)とノイジールール(`.\rules\config\noisy_rules.txt`にルールIDが書かれているルール)を有効にします:
```bash
-hayabusa-1.4.3-win-x64.exe -d .\hayabusa-sample-evtx --enable-deprecated-rules --enable-noisy-rules -o results.csv
+hayabusa-1.5.0-win-x64.exe -d .\hayabusa-sample-evtx --enable-deprecated-rules --enable-noisy-rules -o results.csv
```
* ログオン情報を分析するルールのみを実行し、UTCタイムゾーンで出力します:
```bash
-hayabusa-1.4.3-win-x64.exe -d .\hayabusa-sample-evtx -r .\rules\hayabusa\default\events\Security\Logons -U -o results.csv
+hayabusa-1.5.0-win-x64.exe -d .\hayabusa-sample-evtx -r .\rules\hayabusa\default\events\Security\Logons -U -o results.csv
```
* 起動中のWindows端末上で実行し(Administrator権限が必要)、アラート(悪意のある可能性のある動作)のみを検知します:
```bash
-hayabusa-1.4.3-win-x64.exe -l -m low
+hayabusa-1.5.0-win-x64.exe -l -m low
```
* criticalレベルのアラートからピボットキーワードの一覧を作成します(結果は結果毎に`keywords-Ip Address.txt`や`keywords-Users.txt`等に出力されます):
```bash
-hayabusa-1.4.3-win-x64.exe -l -m critical -p -o keywords
+hayabusa-1.5.0-win-x64.exe -l -m critical -p -o keywords
```
-* イベントIDの統計情報を取得します:
+* イベントIDの統計情報を出力します:
```bash
-hayabusa-1.4.3-win-x64.exe -f Security.evtx -s
+hayabusa-1.5.0-win-x64.exe -f Security.evtx -s
+```
+* ログオンサマリを出力します:
+
+```bash
+hayabusa-1.5.0-win-x64.exe -L -f Security.evtx -s
```
* 詳細なメッセージを出力します(処理に時間がかかるファイル、パースエラー等を特定するのに便利):
```bash
-hayabusa-1.4.3-win-x64.exe -d .\hayabusa-sample-evtx -v
+hayabusa-1.5.0-win-x64.exe -d .\hayabusa-sample-evtx -v
```
* Verbose出力の例:
@@ -512,57 +546,77 @@ Hayabusaをテストしたり、新しいルールを作成したりするため
git clone https://github.com/Yamato-Security/hayabusa-sample-evtx.git
```
-# Hayabusaの出力
+# Hayabusaの出力プロファイル
-Hayabusaの結果を標準出力に表示しているとき(デフォルト)は、以下の情報を表示することができます:
+Hayabusaの`config/profiles.yaml`設定ファイルでは、5つのプロファイルが定義されています:
-* `Timestamp`: デフォルトでは`YYYY-MM-DD HH:mm:ss.sss +hh:mm`形式になっています。イベントログの``フィールドから来ています。デフォルトのタイムゾーンはローカルのタイムゾーンになりますが、`--utc` オプションで UTC に変更することができます。
-* `Computer`: イベントログの``フィールドから来ています。
-* `Channel`: ログ名です。イベントログの``フィールドから来ています。
-* `Event ID`: イベントログの``フィールドから来ています。
-* `Level`: YML検知ルールの`level`フィールドから来ています。(例:`informational`, `low`, `medium`, `high`, `critical`) デフォルトでは、すべてのレベルのアラートとイベントが出力されますが、`-m`オプションで最低のレベルを指定することができます。例えば`-m high`オプションを付けると、`high`と`critical`アラートしか出力されません。
-* `Title`: YML検知ルールの`title`フィールドから来ています。
-* `RecordID`: イベントレコードIDです。``フィールドから来ています。
-* `Details`: YML検知ルールの`details`フィールドから来ていますが、このフィールドはHayabusaルールにしかありません。このフィールドはアラートとイベントに関する追加情報を提供し、ログのフィールドから有用なデータを抽出することができます。イベントキーのマッピングが間違っている場合、もしくはフィールドが存在しない場合で抽出ができなかった箇所は`n/a` (not available)と記載されます。YML検知ルールに`details`フィールドが存在しない時のdetailsのメッセージを`./rules/config/default_details.txt`で設定できます。`default_details.txt`では`Provider Name`、`EventID`、`details`の組み合わせで設定することができます。default_details.txt`やYML検知ルールに対応するルールが記載されていない場合はすべてのフィールド情報を出力します。
-* `MitreTactics`: MITRE ATT&CKの戦術。
-* `MitreTags`: MITRE ATT&CKの戦術以外の情報。attack.g(グループ)、attack.t(技術)、attack.s(ソフトウェア)の情報を出力します。
-* `OtherTags`: YML検知ルールの`tags` フィールドから`MitreTactics`, `MitreTags` 以外の月情報を出力します。
-* `RuleFile`: アラートまたはイベントを生成した検知ルールのファイル名。
-* `EvtxFile`: アラートまたはイベントを起こしたevtxファイルへのパス。
-* `RecordInformation`: すべてのフィールド情報。
+1. `minimal`
+2. `standard` (デフォルト)
+3. `verbose`
+4. `verbose-all-field-info`
+5. `verbose-details-and-all-field-info`
-## プロファイルによる出力のカスタマイズ
+このファイルを編集することで、簡単に独自のプロファイルをカスタマイズしたり、追加したりすることができます。
+`--set-default-profile `オプションでデフォルトのプロファイルを変更することもできます。
-Hayabusaの出力内容はconfig/profiles.txtとconfig/default_profile.txtを変更することでカスタマイズできます。カスタマイズではHayabusaの出力で用いられている内容を以下のエイリアスで呼び出すことができます。
-もし、`config/profiles.txt`に書いてるプロファイルを用いたい場合は`-P/--profile`オプションを利用してください。
-default_profiles.txtをprofile.txtに書かれているプロファイルで上書きしたい場合は`--set-default-profile`オプションを利用してください。
+## 1. `minimal`プロファイルの出力
-|エイリアス名|Haysbusaの出力にある情報|
-|:---|:---|
-|%Timestamp% | `Timestamp` |
-|%Computer% | `Computer` |
-|%Channel% | `Channel` |
-|%Level% | `Level` |
-|%EventID% | `EventID` |
-|%MitreTactics% | `MitreTactics` |
-|%MitreTags% | `MitreTags` |
-|%OtherTags% | `OtherTags` |
-|%RecordID% | `RecordID` |
-|%RuleTitle% | `Title` |
-|%Details% | `Details` |
-|%RecordInformation% | `RecordInformation` |
-|%RuleFile% | `RuleFile` |
-|%EvtxFile% | `EvtxFile` |
+`%Timestamp%`, `%Computer%`, `%Channel%`, `%EventID%`, `%Level%`, `%RuleTitle%`, `%Details%`
-profiles.txtへの記載例:
+## 2. `standard`プロファイルの出力
-```yaml
-(profilename):
- (column name): '%Timestamp%'
- (column name2): '%Computer%'
- (column name3): '%Channel%'
-```
+`%Timestamp%`, `%Computer%`, `%Channel%`, `%EventID%`, `%Level%`, `%MitreTactics%`, `%RecordID%`, `%RuleTitle%`, `%Details%`
+## 3. `verbose`プロファイルの出力
+
+`%Timestamp%`, `%Computer%`, `%Channel%`, `%EventID%`, `%Level%`, `%MitreTactics`, `%MitreTags%`, `%OtherTags%`, `%RecordID%`, `%RuleTitle%`, `%Details%`, `%RuleFile%`, `%EvtxFile%`
+
+## 4. `verbose-all-field-info`プロファイルの出力
+
+最小限の`details`情報を出力する代わりに、イベントにあるすべての`EventData`フィールド情報が出力されます。
+
+`%Timestamp%`, `%Computer%`, `%Channel%`, `%EventID%`, `%Level%`, `%MitreTactics`, `%MitreTags%`, `%OtherTags%`, `%RecordID%`, `%RuleTitle%`, `%AllFieldInfo%`, `%RuleFile%`, `%EvtxFile%`
+
+## 5. `verbose-details-and-all-field-info`プロファイルの出力
+
+`verbose`プロファイルで出力される情報とイベントにあるすべての`EventData`フィールド情報が出力されます。
+(注意: 出力ファイルサイズは2倍になります!)
+
+`%Timestamp%`, `%Computer%`, `%Channel%`, `%EventID%`, `%Level%`, `%MitreTactics`, `%MitreTags%`, `%OtherTags%`, `%RecordID%`, `%RuleTitle%`, `%Details%`, `%RuleFile%`, `%EvtxFile%`, `%AllFieldInfo%`
+
+### プロファイルの比較
+
+以下のベンチマークは、2018年製のマックブックプロ上で7.5GBのEVTXデータに対して実施されました。
+
+| プロファイル | 処理時間 | 結果のファイルサイズ |
+| :---: | :---: | :---: |
+| minimal | 16分18秒 | 690 MB |
+| standard | 16分23秒 | 710 MB |
+| verbose | 17分 | 990 MB |
+| verbose-all-field-info | 16分50秒 | 1.6 GB |
+| verbose-details-and-all-field-info | 17分12秒 | 2.1 GB |
+
+## Profile Field Aliases
+
+| エイリアス名 | Hayabusaの出力情報 |
+| :--- | :--- |
+|%Timestamp% | デフォルトでは`YYYY-MM-DD HH:mm:ss.sss +hh:mm`形式になっている。イベントログの``フィールドから来ている。デフォルトのタイムゾーンはローカルのタイムゾーンになるが、`--UTC`オプションでUTCに変更することができる。 |
+|%Computer% | イベントログの``フィールド。 |
+|%Channel% | ログ名。イベントログの``フィールド。 |
+|%EventID% | イベントログの``フィールド。 |
+|%Level% | YML検知ルールの`level`フィールド。(例:`informational`、`low`、`medium`、`high`、`critical`) |
+|%MitreTactics% | MITRE ATT&CKの[戦術](https://attack.mitre.org/tactics/enterprise/) (例: Initial Access、Lateral Movement等々) |
+|%MitreTags% | MITRE ATT&CKの戦術以外の情報。attack.g(グループ)、attack.t(技術)、attack.s(ソフトウェア)の情報を出力する。 |
+|%OtherTags% | YML検知ルールの`tags`フィールドから`MitreTactics`、`MitreTags`以外のキーワードを出力する。|
+|%RecordID% | ``フィールドのイベントレコードID。 |
+|%RuleTitle% | YML検知ルールの`title`フィールド。 |
+|%Details% | YML検知ルールの`details`フィールドから来ていますが、このフィールドはHayabusaルールにしかありません。このフィールドはアラートとイベントに関する追加情報を提供し、ログのフィールドから有用なデータを抽出することができます。イベントキーのマッピングが間違っている場合、もしくはフィールドが存在しない場合で抽出ができなかった箇所は`n/a` (not available)と記載されます。YML検知ルールに`details`フィールドが存在しない時のdetailsのメッセージを`./rules/config/default_details.txt`で設定できます。`default_details.txt`では`Provider Name`、`EventID`、`details`の組み合わせで設定することができます。default_details.txt`やYML検知ルールに対応するルールが記載されていない場合はすべてのフィールド情報を出力します。 |
+|%AllFieldInfo% | すべてのフィールド情報。 |
+|%RuleFile% | アラートまたはイベントを生成した検知ルールのファイル名。 |
+|%EvtxFile% | アラートまたはイベントを起こしたevtxファイルへのパス。 |
+
+これらのエイリアスは、出力プロファイルで使用することができます。また、他の[イベントキーアライズ](https://github.com/Yamato-Security/hayabusa-rules/blob/main/README-Japanese.md#%E3%82%A4%E3%83%99%E3%83%B3%E3%83%88%E3%82%AD%E3%83%BC%E3%82%A8%E3%82%A4%E3%83%AA%E3%82%A2%E3%82%B9)を定義し、他のフィールドを出力することもできます。
+
## Levelの省略
簡潔に出力するためにLevelを以下のように省略し出力しています。
@@ -707,7 +761,7 @@ Hayabusaルールは、Windowsのイベントログ解析専用に設計され
## 検知レベルのlevelチューニング
Hayabusaルール、Sigmaルールはそれぞれの作者が検知した際のリスクレベルを決めています。
-ユーザが独自のリスクレベルに設定するには`./rules/config/level_tuning.txt`に変換情報を書き、`hayabusa-1.4.3-win-x64.exe --level-tuning`を実行することでルールファイルが書き換えられます。
+ユーザが独自のリスクレベルに設定するには`./rules/config/level_tuning.txt`に変換情報を書き、`hayabusa-1.5.0-win-x64.exe --level-tuning`を実行することでルールファイルが書き換えられます。
ルールファイルが直接書き換えられることに注意して使用してください。
`./rules/config/level_tuning.txt`の例:
@@ -720,9 +774,8 @@ id,new_level
## イベントIDフィルタリング
-バージョン1.4.3以降では、デフォルトでパフォーマンスを上げるために、検知ルールでイベントIDが定義されていないイベントを無視しています。
-デフォルトでは`./rules/config/target_event_IDs.txt`で定義されたIDがスキャンされます。
-If you want to scan all events, please use the `-D, --deep-scan` option.
+デフォルトではパフォーマンスを上げるために、検知ルールでイベントIDが定義されていないイベントを無視しています。
+`./rules/config/target_event_IDs.txt`で定義されたIDがスキャンされます。
すべてのイベントをスキャンしたい場合は、`-D, --deep-scan`オプションを使用してください。
# その他のWindowsイベントログ解析ツールおよび関連リソース
diff --git a/README.md b/README.md
index 0f23c0dc..78a24a64 100644
--- a/README.md
+++ b/README.md
@@ -47,19 +47,27 @@ Hayabusa is a **Windows event log fast forensics timeline generator** and **thre
- [Cross-compiling 32-bit Windows Binaries](#cross-compiling-32-bit-windows-binaries)
- [macOS Compiling Notes](#macos-compiling-notes)
- [Linux Compiling Notes](#linux-compiling-notes)
+ - [Cross-compiling Linux MUSL Binaries](#cross-compiling-linux-musl-binaries)
- [Running Hayabusa](#running-hayabusa)
- [Caution: Anti-Virus/EDR Warnings and Slow Runtimes](#caution-anti-virusedr-warnings-and-slow-runtimes)
- [Windows](#windows)
- [Linux](#linux)
- [macOS](#macos)
- [Usage](#usage)
+ - [Main commands](#main-commands)
- [Command Line Options](#command-line-options)
- [Usage Examples](#usage-examples)
- [Pivot Keyword Generator](#pivot-keyword-generator)
- [Logon Summary Generator](#logon-summary-generator)
- [Testing Hayabusa on Sample Evtx Files](#testing-hayabusa-on-sample-evtx-files)
-- [Hayabusa Output](#hayabusa-output)
- - [Output customize by profile](#output-customize-by-profile)
+- [Hayabusa Output Profiles](#hayabusa-output-profiles)
+ - [1. `minimal` profile output](#1-minimal-profile-output)
+ - [2. `standard` profile output](#2-standard-profile-output)
+ - [3. `verbose` profile output](#3-verbose-profile-output)
+ - [4. `verbose-all-field-info` profile output](#4-verbose-all-field-info-profile-output)
+ - [5. `verbose-details-and-all-field-info` profile output](#5-verbose-details-and-all-field-info-profile-output)
+ - [Profile Comparison](#profile-comparison)
+ - [Profile Field Aliases](#profile-field-aliases)
- [Level Abbrevations](#level-abbrevations)
- [MITRE ATT&CK Tactics Abbreviations](#mitre-attck-tactics-abbreviations)
- [Channel Abbreviations](#channel-abbreviations)
@@ -176,7 +184,7 @@ Note: If you forget to use --recursive option, the `rules` folder, which is mana
You can sync the `rules` folder and get latest Hayabusa rules with `git pull --recurse-submodules` or use the following command:
```bash
-hayabusa-1.4.3-win-x64.exe -u
+hayabusa-1.5.0-win-x64.exe -u
```
If the update fails, you may need to rename the `rules` folder and try again.
@@ -191,7 +199,6 @@ If the update fails, you may need to rename the `rules` folder and try again.
If you have Rust installed, you can compile from source with the following command:
```bash
-cargo clean
cargo build --release
```
@@ -250,6 +257,21 @@ Fedora-based distros:
sudo yum install openssl-devel
```
+## Cross-compiling Linux MUSL Binaries
+
+On a Linux OS, first install the target.
+
+```bash
+rustup install stable-x86_64-unknown-linux-musl
+rustup target add x86_64-unknown-linux-musl
+```
+
+Compile with:
+
+```
+rustup run stable-x86_64-unknown-linux-musl cargo build --release
+```
+
# Running Hayabusa
## Caution: Anti-Virus/EDR Warnings and Slow Runtimes
@@ -264,20 +286,20 @@ You may experience slow runtime especially on the first run after a reboot due t
In a Command/PowerShell Prompt or Windows Terminal, just run the appropriate 32-bit or 64-bit Windows binary.
-Example: `hayabusa-1.4.3-windows-x64.exe`
+Example: `hayabusa-1.5.0-windows-x64.exe`
## Linux
You first need to make the binary executable.
```bash
-chmod +x ./hayabusa-1.4.3-linux-x64-gnu
+chmod +x ./hayabusa-1.5.0-linux-x64-gnu
```
Then run it from the Hayabusa root directory:
```bash
-./hayabusa-1.4.3-linux-x64-gnu
+./hayabusa-1.5.0-linux-x64-gnu
```
## macOS
@@ -285,13 +307,13 @@ Then run it from the Hayabusa root directory:
From Terminal or iTerm2, you first need to make the binary executable.
```bash
-chmod +x ./hayabusa-1.4.3-mac-intel
+chmod +x ./hayabusa-1.5.0-mac-intel
```
Then, try to run it from the Hayabusa root directory:
```bash
-./hayabusa-1.4.3-mac-intel
+./hayabusa-1.5.0-mac-intel
```
On the latest version of macOS, you may receive the following security error when you try to run it:
@@ -305,7 +327,7 @@ Click "Cancel" and then from System Preferences, open "Security & Privacy" and f
After that, try to run it again.
```bash
-./hayabusa-1.4.3-mac-intel
+./hayabusa-1.5.0-mac-intel
```
The following warning will pop up, so please click "Open".
@@ -315,6 +337,15 @@ The following warning will pop up, so please click "Open".
You should now be able to run hayabusa.
# Usage
+## Main commands
+
+* default: Create a fast forensics timeline.
+* `--level-tuning`: Custom tune the alerts' `level`.
+* `-L, --logon-summary`: Print a summary of logon events.
+* `-P, --pivot-keywords-list`: Print a list of suspicious keywords to pivot on.
+* `-s, --statistics`: Print metrics of the count and percentage of events based on Event ID.
+* `--set-default-profile`: Change the default profile.
+* `-u, --update`: Sync the rules to the latest rules in the [hayabusa-rules](https://github.com/Yamato-Security/hayabusa-rules) GitHub repository.
## Command Line Options
@@ -322,10 +353,6 @@ You should now be able to run hayabusa.
USAGE:
hayabusa.exe [OTHER-ACTIONS] [OPTIONS]
-OPTIONS:
- -h, --help Print help information
- --version Print version information
-
INPUT:
-d, --directory Directory of multiple .evtx files
-f, --file File path to one .evtx file
@@ -333,14 +360,14 @@ INPUT:
ADVANCED:
-c, --rules-config Specify custom rule config directory (default: ./rules/config)
- --level-tuning [] Tune alert levels (default: ./rules/config/level_tuning.txt)
-Q, --quiet-errors Quiet errors mode: do not save error logs
-r, --rules Specify a custom rule directory or file (default: ./rules)
-t, --thread-number Thread number (default: optimal number for performance)
--target-file-ext ... Specify additional target file extensions (ex: evtx_data) (ex: evtx1 evtx2)
OUTPUT:
- -o, --output Save the timeline in CSV format (ex: results.csv)
+ -o, --output Save the timeline in CSV format (ex: results.csv)
+ -P, --profile Specify output profile (minimal, standard, verbose, verbose-all-field-info, verbose-details-and-all-field-info)
DISPLAY-SETTINGS:
--no-color Disable color output
@@ -349,7 +376,7 @@ DISPLAY-SETTINGS:
-V, --visualize-timeline Output event frequency timeline
FILTERING:
- -D, --deep-scan Disable event ID filter to scan all events
+ -D, --deep-scan Disable event ID filter to scan all events (slower)
--enable-deprecated-rules Enable rules marked as deprecated
--exclude-status ... Ignore rules according to status (ex: experimental) (ex: stable test)
-m, --min-level Minimum level for rules (default: informational)
@@ -358,11 +385,13 @@ FILTERING:
--timeline-start Start time of the event logs to load (ex: "2020-02-22 00:00:00 +09:00")
OTHER-ACTIONS:
- --contributors Print the list of contributors
- -L, --logon-summary Print a summary of successful and failed logons
- -p, --pivot-keywords-list Create a list of pivot keywords
- -s, --statistics Print statistics of event IDs
- -u, --update-rules Update to the latest rules in the hayabusa-rules github repository
+ --contributors Print the list of contributors
+ -L, --logon-summary Print a summary of successful and failed logons
+ --level-tuning [] Tune alert levels (default: ./rules/config/level_tuning.txt)
+ -p, --pivot-keywords-list Create a list of pivot keywords
+ -s, --statistics Print statistics of event IDs
+ --set-default-profile Set default output profile
+ -u, --update-rules Update to the latest rules in the hayabusa-rules github repository
TIME-FORMAT:
--European-time Output timestamp in European time format (ex: 22-02-2022 22:00:00.123 +02:00)
@@ -371,90 +400,92 @@ TIME-FORMAT:
--US-military-time Output timestamp in US military time format (ex: 02-22-2022 22:00:00.123 -06:00)
--US-time Output timestamp in US time format (ex: 02-22-2022 10:00:00.123 PM -06:00)
-U, --UTC Output time in UTC format (default: local time)
-
-OUTPUT-SETTINGS:
- -P, --profile Specify output profile
- --set-default-profile Set default output profile
```
## Usage Examples
-* Run hayabusa against one Windows event log file:
+* Run hayabusa against one Windows event log file with default standard profile:
```bash
-hayabusa-1.4.3-win-x64.exe -f eventlog.evtx
+hayabusa-1.5.0-win-x64.exe -f eventlog.evtx
```
-* Run hayabusa against the sample-evtx directory with multiple Windows event log files:
+* Run hayabusa against the sample-evtx directory with multiple Windows event log files with the verbose profile:
```bash
-hayabusa-1.4.3-win-x64.exe -d .\hayabusa-sample-evtx
+hayabusa-1.5.0-win-x64.exe -d .\hayabusa-sample-evtx -P verbose
```
-* Export to a single CSV file for further analysis with excel, timeline explorer, elastic stack, etc... and include all field information (Warning: your file output size will become much larger with `-F` enabled!):
+* Export to a single CSV file for further analysis with excel, timeline explorer, elastic stack, etc... and include all field information (Warning: your file output size will become much larger with the `verbose-details-and-all-field-info` profile!):
```bash
-hayabusa-1.4.3-win-x64.exe -d .\hayabusa-sample-evtx -o results.csv -F
+hayabusa-1.5.0-win-x64.exe -d .\hayabusa-sample-evtx -o results.csv -F
```
* Only run hayabusa rules (the default is to run all the rules in `-r .\rules`):
```bash
-hayabusa-1.4.3-win-x64.exe -d .\hayabusa-sample-evtx -r .\rules\hayabusa -o results.csv
+hayabusa-1.5.0-win-x64.exe -d .\hayabusa-sample-evtx -r .\rules\hayabusa -o results.csv
```
* Only run hayabusa rules for logs that are enabled by default on Windows:
```bash
-hayabusa-1.4.3-win-x64.exe -d .\hayabusa-sample-evtx -r .\rules\hayabusa\default -o results.csv
+hayabusa-1.5.0-win-x64.exe -d .\hayabusa-sample-evtx -r .\rules\hayabusa\default -o results.csv
```
* Only run hayabusa rules for sysmon logs:
```bash
-hayabusa-1.4.3-win-x64.exe -d .\hayabusa-sample-evtx -r .\rules\hayabusa\sysmon -o results.csv
+hayabusa-1.5.0-win-x64.exe -d .\hayabusa-sample-evtx -r .\rules\hayabusa\sysmon -o results.csv
```
* Only run sigma rules:
```bash
-hayabusa-1.4.3-win-x64.exe -d .\hayabusa-sample-evtx -r .\rules\sigma -o results.csv
+hayabusa-1.5.0-win-x64.exe -d .\hayabusa-sample-evtx -r .\rules\sigma -o results.csv
```
* Enable deprecated rules (those with `status` marked as `deprecated`) and noisy rules (those whose rule ID is listed in `.\rules\config\noisy_rules.txt`):
```bash
-hayabusa-1.4.3-win-x64.exe -d .\hayabusa-sample-evtx --enable-noisy-rules --enable-deprecated-rules -o results.csv
+hayabusa-1.5.0-win-x64.exe -d .\hayabusa-sample-evtx --enable-noisy-rules --enable-deprecated-rules -o results.csv
```
* Only run rules to analyze logons and output in the UTC timezone:
```bash
-hayabusa-1.4.3-win-x64.exe -d .\hayabusa-sample-evtx -r .\rules\hayabusa\default\events\Security\Logons -U -o results.csv
+hayabusa-1.5.0-win-x64.exe -d .\hayabusa-sample-evtx -r .\rules\hayabusa\default\events\Security\Logons -U -o results.csv
```
* Run on a live Windows machine (requires Administrator privileges) and only detect alerts (potentially malicious behavior):
```bash
-hayabusa-1.4.3-win-x64.exe -l -m low
+hayabusa-1.5.0-win-x64.exe -l -m low
```
* Create a list of pivot keywords from critical alerts and save the results. (Results will be saved to `keywords-Ip Addresses.txt`, `keywords-Users.txt`, etc...):
```bash
-hayabusa-1.4.3-win-x64.exe -l -m critical -p -o keywords
+hayabusa-1.5.0-win-x64.exe -l -m critical -p -o keywords
```
* Print Event ID statistics:
```bash
-hayabusa-1.4.3-win-x64.exe -f Security.evtx -s
+hayabusa-1.5.0-win-x64.exe -f Security.evtx -s
+```
+
+* Print logon summary:
+
+```bash
+hayabusa-1.5.0-win-x64.exe -L -f Security.evtx -s
```
* Print verbose information (useful for determining which files take long to process, parsing errors, etc...):
```bash
-hayabusa-1.4.3-win-x64.exe -d .\hayabusa-sample-evtx -v
+hayabusa-1.5.0-win-x64.exe -d .\hayabusa-sample-evtx -v
```
* Verbose output example:
@@ -509,58 +540,75 @@ You can download the sample evtx files to a new `hayabusa-sample-evtx` sub-direc
git clone https://github.com/Yamato-Security/hayabusa-sample-evtx.git
```
-# Hayabusa Output
+# Hayabusa Output Profiles
-When hayabusa output is being displayed to the screen (the default), it can display the following information:
+Hayabusa has 5 pre-defined profiles to use in `config/profiles.yaml`:
-* `Timestamp`: Default is `YYYY-MM-DD HH:mm:ss.sss +hh:mm` format. This comes from the `` field in the event log. The default timezone will be the local timezone but you can change the timezone to UTC with the `--utc` option.
-* `Computer`: This comes from the `` field in the event log.
-* `Channel`: The name of log. This comes from the `` field in the event log.
-* `Event ID`: This comes from the `` field in the event log.
-* `Level`: This comes from the `level` field in the YML detection rule. (`informational`, `low`, `medium`, `high`, `critical`) By default, all level alerts will be displayed but you can set the minimum level with `-m`. For example, you can set `-m high`) in order to only scan for and display high and critical alerts.
-* `RecordID`: This comes from the `` field in the event log.
-* `Title`: This comes from the `title` field in the YML detection rule.
-* `Details`: This comes from the `details` field in the YML detection rule, however, only hayabusa rules have this field. This field gives extra information about the alert or event and can extract useful data from the fields in event logs. For example, usernames, command line information, process information, etc... When a placeholder points to a field that does not exist or there is an incorrect alias mapping, it will be outputted as `n/a` (not available). If the `details` field is not specified (i.e. sigma rules), default `details` messages to extract fields defined in `./rules/config/default_details.txt` will be outputted. You can add more default `details` messages by adding the `Provider Name`, `EventID` and `details` message you want to output in `default_details.txt`. When no `details` field is defined in a rule nor in `default_details.txt`, all fields will be outputted to the `details` column.
-* `MitreTactics`: MITRE ATT&CK tactics.
-* `MitreTags`: MITRE ATT&CK group, technique, software.
-* `OtherTags`: This comes from the `tags` field in YML detection rule which is excluded `MitreTactics` and `MitreTags`.
-* `RuleFile`: The filename of the detection rule that generated the alert or event.
-* `EvtxFile`: The evtx filename that caused the alert or event.
-* `RecordInformation`: All field information.
+1. `minimal`
+2. `standard` (default)
+3. `verbose`
+4. `verbose-all-field-info`
+5. `verbose-details-and-all-field-info`
-## Output customize by profile
+You can easily customize or add your own profiles by editing this file.
+You can also easily change the default profile with `--set-default-profile `.
-You can customize the output by modifiy `config/profiles.txt` and `config/default_profile.txt`.
-You can be setting following alias.
-If you want to use profile in `config/profiles.txt` , you use `-P/--profile` option.
-Please use `--set-default-profile` option when you want to overwrite `default_profiles.txt` by profile in `config/profiles.txt`.
+## 1. `minimal` profile output
-|alias name| Hayabusa output information|
-|:---|:---|
-|%Timestamp% | `Timestamp` |
-|%Computer% | `Computer` |
-|%Channel% | `Channel` |
-|%Level% | `Level` |
-|%EventID% | `EventID` |
-|%MitreTactics% | `MitreTactics` |
-|%MitreTags% | `MitreTags` |
-|%OtherTags% | `OtherTags` |
-|%RecordID% | `RecordID` |
-|%RuleTitle% | `Title` |
-|%Details% | `Details` |
-|%RecordInformation% | `RecordInformation` |
-|%RuleFile% | `RuleFile` |
-|%EvtxFile% | `EvtxFile` |
+`%Timestamp%`, `%Computer%`, `%Channel%`, `%EventID%`, `%Level%`, `%RuleTitle%`, `%Details%`
-e.g. profile customize
+## 2. `standard` profile output
-```yaml
-(profilename):
- (column name): '%Timestamp%'
- (column name2): '%Computer%'
- (column name3): '%Channel%'
-```
+`%Timestamp%`, `%Computer%`, `%Channel%`, `%EventID%`, `%Level%`, `%MitreTactics%`, `%RecordID%`, `%RuleTitle%`, `%Details%`
+## 3. `verbose` profile output
+
+`%Timestamp%`, `%Computer%`, `%Channel%`, `%EventID%`, `%Level%`, `%MitreTactics`, `%MitreTags%`, `%OtherTags%`, `%RecordID%`, `%RuleTitle%`, `%Details%`, `%RuleFile%`, `%EvtxFile%`
+
+## 4. `verbose-all-field-info` profile output
+
+Instead of outputting the minimal `details` information, all field information in the `EventData` section will be outputted.
+
+`%Timestamp%`, `%Computer%`, `%Channel%`, `%EventID%`, `%Level%`, `%MitreTactics`, `%MitreTags%`, `%OtherTags%`, `%RecordID%`, `%RuleTitle%`, `%AllFieldInfo%`, `%RuleFile%`, `%EvtxFile%`
+
+## 5. `verbose-details-and-all-field-info` profile output
+
+`verbose` profile plus all field information. (Warning: this will usually double the output file size!)
+
+`%Timestamp%`, `%Computer%`, `%Channel%`, `%EventID%`, `%Level%`, `%MitreTactics`, `%MitreTags%`, `%OtherTags%`, `%RecordID%`, `%RuleTitle%`, `%Details%`, `%RuleFile%`, `%EvtxFile%`, `%AllFieldInfo%`
+
+### Profile Comparison
+
+The following benchmarks were conducted on a 2018 MBP with 7.5GB of evtx data.
+
+| Profile | Processing Time | Output Filesize |
+| :---: | :---: | :---: |
+| minimal | 16 minutes 18 seconds | 690 MB |
+| standard | 16 minutes 23 seconds | 710 MB |
+| verbose | 17 minutes | 990 MB |
+| verbose-all-field-info | 16 minutes 50 seconds | 1.6 GB |
+| verbose-details-and-all-field-info | 17 minutes 12 seconds | 2.1 GB |
+
+## Profile Field Aliases
+
+| Alias name | Hayabusa output information|
+| :--- | :--- |
+|%Timestamp% | Default is `YYYY-MM-DD HH:mm:ss.sss +hh:mm` format. `` field in the event log. The default timezone will be the local timezone but you can change the timezone to UTC with the `--UTC` option. |
+|%Computer% | The `` field. |
+|%Channel% | The name of log. `` field. |
+|%EventID% | The `` field. |
+|%Level% | The `level` field in the YML detection rule. (`informational`, `low`, `medium`, `high`, `critical`) |
+|%MitreTactics% | MITRE ATT&CK [tactics](https://attack.mitre.org/tactics/enterprise/) (Ex: Initial Access, Lateral Movement, etc...). |
+|%MitreTags% | MITRE ATT&CK Group ID, Technique ID and Software ID. |
+|%OtherTags% | Any keyword in the `tags` field in a YML detection rule which is not included in `MitreTactics` or `MitreTags`. |
+|%RecordID% | The Event Record ID from `` field. |
+|%RuleTitle% | The `title` field in the YML detection rule. |
+|%Details% | The `details` field in the YML detection rule, however, only hayabusa rules have this field. This field gives extra information about the alert or event and can extract useful data from the fields in event logs. For example, usernames, command line information, process information, etc... When a placeholder points to a field that does not exist or there is an incorrect alias mapping, it will be outputted as `n/a` (not available). If the `details` field is not specified (i.e. sigma rules), default `details` messages to extract fields defined in `./rules/config/default_details.txt` will be outputted. You can add more default `details` messages by adding the `Provider Name`, `EventID` and `details` message you want to output in `default_details.txt`. When no `details` field is defined in a rule nor in `default_details.txt`, all fields will be outputted to the `details` column. |
+|%AllFieldInfo% | All field information. |
+|%RuleFile% | The filename of the detection rule that generated the alert or event. |
+|%EvtxFile% | The evtx filename that caused the alert or event. |
+
+You can use these aliases in your output profiles, as well as define other [event key alises](https://github.com/Yamato-Security/hayabusa-rules/blob/main/README.md#eventkey-aliases) to output other fields.
## Level Abbrevations
@@ -705,7 +753,7 @@ You can also add a rule ID to `./rules/config/noisy_rules.txt` in order to ignor
Hayabusa and Sigma rule authors will determine the risk level of the alert when writing their rules.
However, the actual risk level will differ between environments.
-You can tune the risk level of the rules by adding them to `./rules/config/level_tuning.txt` and executing `hayabusa-1.4.3-win-x64.exe --level-tuning` which will update the `level` line in the rule file.
+You can tune the risk level of the rules by adding them to `./rules/config/level_tuning.txt` and executing `hayabusa-1.5.0-win-x64.exe --level-tuning` which will update the `level` line in the rule file.
Please note that the rule file will be updated directly.
`./rules/config/level_tuning.txt` sample line:
@@ -719,8 +767,8 @@ In this case, the risk level of the rule with an `id` of `00000000-0000-0000-000
## Event ID Filtering
-As of version 1.4.3, by default, events are filtered by ID to improve performance by ignorning events that have no detection rules.
-The IDs defined in `./rules/config/target_event_IDs.txt` will be scanned by default.
+By default, events are filtered by ID to improve performance by ignorning events that have no detection rules.
+The IDs defined in `./rules/config/target_event_IDs.txt` will be scanned.
If you want to scan all events, please use the `-D, --deep-scan` option.
# Other Windows Event Log Analyzers and Related Resources
diff --git a/src/detections/configs.rs b/src/detections/configs.rs
index 637bf772..01d6786d 100644
--- a/src/detections/configs.rs
+++ b/src/detections/configs.rs
@@ -220,7 +220,7 @@ pub struct Config {
#[clap(help_heading = Some("OUTPUT"), short = 'P', long = "profile")]
pub profile: Option,
- /// Set default output profile (minimal, standard, verbose, verbose-all-field-info, verbose-details-and-all-field-info)
+ /// Set default output profile
#[clap(help_heading = Some("OTHER-ACTIONS"), long = "set-default-profile", value_name = "PROFILE")]
pub set_default_profile: Option,
}
From c2807e36e45bd26fdba060aa0eb6e8cdb2c3ab8e Mon Sep 17 00:00:00 2001
From: Yamato Security <71482215+YamatoSecurity@users.noreply.github.com>
Date: Thu, 11 Aug 2022 00:40:34 +0900
Subject: [PATCH 10/12] update readme
---
README-Japanese.md | 45 +++++++++++++++++++++++++--------------------
README.md | 46 ++++++++++++++++++++++++++--------------------
2 files changed, 51 insertions(+), 40 deletions(-)
diff --git a/README-Japanese.md b/README-Japanese.md
index 2dee460d..c5b25a41 100644
--- a/README-Japanese.md
+++ b/README-Japanese.md
@@ -62,22 +62,24 @@ Hayabusaは、日本の[Yamato Security](https://yamatosecurity.connpass.com/)
- [ピボットキーワードの作成](#ピボットキーワードの作成)
- [ログオン情報の要約](#ログオン情報の要約)
- [サンプルevtxファイルでHayabusaをテストする](#サンプルevtxファイルでhayabusaをテストする)
-- [Hayabusaの出力プロファイル](#hayabusaの出力プロファイル)
- - [1. `minimal`プロファイルの出力](#1-minimalプロファイルの出力)
- - [2. `standard`プロファイルの出力](#2-standardプロファイルの出力)
- - [3. `verbose`プロファイルの出力](#3-verboseプロファイルの出力)
- - [4. `verbose-all-field-info`プロファイルの出力](#4-verbose-all-field-infoプロファイルの出力)
- - [5. `verbose-details-and-all-field-info`プロファイルの出力](#5-verbose-details-and-all-field-infoプロファイルの出力)
+- [Hayabusaの出力](#hayabusaの出力)
+ - [プロファイル](#プロファイル)
+ - [1. `minimal`プロファイルの出力](#1-minimalプロファイルの出力)
+ - [2. `standard`プロファイルの出力](#2-standardプロファイルの出力)
+ - [3. `verbose`プロファイルの出力](#3-verboseプロファイルの出力)
+ - [4. `verbose-all-field-info`プロファイルの出力](#4-verbose-all-field-infoプロファイルの出力)
+ - [5. `verbose-details-and-all-field-info`プロファイルの出力](#5-verbose-details-and-all-field-infoプロファイルの出力)
- [プロファイルの比較](#プロファイルの比較)
- - [Profile Field Aliases](#profile-field-aliases)
+ - [Profile Field Aliases](#profile-field-aliases)
- [Levelの省略](#levelの省略)
- [MITRE ATT&CK戦術の省略](#mitre-attck戦術の省略)
- [Channel情報の省略](#channel情報の省略)
- [プログレスバー](#プログレスバー)
- [標準出力へのカラー設定](#標準出力へのカラー設定)
- - [イベント頻度タイムライン](#イベント頻度タイムライン)
- - [最多検知日の出力](#最多検知日の出力)
- - [最多検知端末名の出力](#最多検知端末名の出力)
+ - [結果のサマリ](#結果のサマリ)
+ - [イベント頻度タイムライン](#イベント頻度タイムライン)
+ - [最多検知日の出力](#最多検知日の出力)
+ - [最多検知端末名の出力](#最多検知端末名の出力)
- [Hayabusaルール](#hayabusaルール)
- [Hayabusa v.s. 変換されたSigmaルール](#hayabusa-vs-変換されたsigmaルール)
- [検知ルールのチューニング](#検知ルールのチューニング)
@@ -546,7 +548,8 @@ Hayabusaをテストしたり、新しいルールを作成したりするため
git clone https://github.com/Yamato-Security/hayabusa-sample-evtx.git
```
-# Hayabusaの出力プロファイル
+# Hayabusaの出力
+## プロファイル
Hayabusaの`config/profiles.yaml`設定ファイルでは、5つのプロファイルが定義されています:
@@ -559,25 +562,25 @@ Hayabusaの`config/profiles.yaml`設定ファイルでは、5つのプロフ
このファイルを編集することで、簡単に独自のプロファイルをカスタマイズしたり、追加したりすることができます。
`--set-default-profile `オプションでデフォルトのプロファイルを変更することもできます。
-## 1. `minimal`プロファイルの出力
+### 1. `minimal`プロファイルの出力
`%Timestamp%`, `%Computer%`, `%Channel%`, `%EventID%`, `%Level%`, `%RuleTitle%`, `%Details%`
-## 2. `standard`プロファイルの出力
+### 2. `standard`プロファイルの出力
`%Timestamp%`, `%Computer%`, `%Channel%`, `%EventID%`, `%Level%`, `%MitreTactics%`, `%RecordID%`, `%RuleTitle%`, `%Details%`
-## 3. `verbose`プロファイルの出力
+### 3. `verbose`プロファイルの出力
`%Timestamp%`, `%Computer%`, `%Channel%`, `%EventID%`, `%Level%`, `%MitreTactics`, `%MitreTags%`, `%OtherTags%`, `%RecordID%`, `%RuleTitle%`, `%Details%`, `%RuleFile%`, `%EvtxFile%`
-## 4. `verbose-all-field-info`プロファイルの出力
+### 4. `verbose-all-field-info`プロファイルの出力
最小限の`details`情報を出力する代わりに、イベントにあるすべての`EventData`フィールド情報が出力されます。
`%Timestamp%`, `%Computer%`, `%Channel%`, `%EventID%`, `%Level%`, `%MitreTactics`, `%MitreTags%`, `%OtherTags%`, `%RecordID%`, `%RuleTitle%`, `%AllFieldInfo%`, `%RuleFile%`, `%EvtxFile%`
-## 5. `verbose-details-and-all-field-info`プロファイルの出力
+### 5. `verbose-details-and-all-field-info`プロファイルの出力
`verbose`プロファイルで出力される情報とイベントにあるすべての`EventData`フィールド情報が出力されます。
(注意: 出力ファイルサイズは2倍になります!)
@@ -596,7 +599,7 @@ Hayabusaの`config/profiles.yaml`設定ファイルでは、5つのプロフ
| verbose-all-field-info | 16分50秒 | 1.6 GB |
| verbose-details-and-all-field-info | 17分12秒 | 2.1 GB |
-## Profile Field Aliases
+### Profile Field Aliases
| エイリアス名 | Hayabusaの出力情報 |
| :--- | :--- |
@@ -694,16 +697,18 @@ Hayabusaの結果は`level`毎に文字色が変わります。
形式は`level名,(6桁のRGBのカラーhex)`です。
カラー出力をしないようにしたい場合は`--no-color`オプションをご利用ください。
-## イベント頻度タイムライン
+## 結果のサマリ
+
+### イベント頻度タイムライン
`-V`または`--visualize-timeline`オプションを使うことで、検知したイベントの数が5以上の時、頻度のタイムライン(スパークライン)を画面に出力します。
マーカーの数は最大10個です。デフォルトのCommand PromptとPowerShell Promptでは文字化けがでるので、Windows TerminalやiTerm2等のターミナルをご利用ください。
-## 最多検知日の出力
+### 最多検知日の出力
各レベルで最も検知された日付を画面に出力します。
-## 最多検知端末名の出力
+### 最多検知端末名の出力
各レベルで多く検知されたユニークなイベントが多い端末名上位5つを画面に出力します。
diff --git a/README.md b/README.md
index 78a24a64..e3b65770 100644
--- a/README.md
+++ b/README.md
@@ -60,22 +60,24 @@ Hayabusa is a **Windows event log fast forensics timeline generator** and **thre
- [Pivot Keyword Generator](#pivot-keyword-generator)
- [Logon Summary Generator](#logon-summary-generator)
- [Testing Hayabusa on Sample Evtx Files](#testing-hayabusa-on-sample-evtx-files)
-- [Hayabusa Output Profiles](#hayabusa-output-profiles)
- - [1. `minimal` profile output](#1-minimal-profile-output)
- - [2. `standard` profile output](#2-standard-profile-output)
- - [3. `verbose` profile output](#3-verbose-profile-output)
- - [4. `verbose-all-field-info` profile output](#4-verbose-all-field-info-profile-output)
- - [5. `verbose-details-and-all-field-info` profile output](#5-verbose-details-and-all-field-info-profile-output)
+- [Hayabusa Output](#hayabusa-output)
+ - [Profiles](#profiles)
+ - [1. `minimal` profile output](#1-minimal-profile-output)
+ - [2. `standard` profile output](#2-standard-profile-output)
+ - [3. `verbose` profile output](#3-verbose-profile-output)
+ - [4. `verbose-all-field-info` profile output](#4-verbose-all-field-info-profile-output)
+ - [5. `verbose-details-and-all-field-info` profile output](#5-verbose-details-and-all-field-info-profile-output)
- [Profile Comparison](#profile-comparison)
- - [Profile Field Aliases](#profile-field-aliases)
+ - [Profile Field Aliases](#profile-field-aliases)
- [Level Abbrevations](#level-abbrevations)
- [MITRE ATT&CK Tactics Abbreviations](#mitre-attck-tactics-abbreviations)
- [Channel Abbreviations](#channel-abbreviations)
- [Progress Bar](#progress-bar)
- [Color Output](#color-output)
- - [Event Fequency Timeline](#event-fequency-timeline)
- - [Dates with most total detections](#dates-with-most-total-detections)
- - [Top 5 computers with most unique detections](#top-5-computers-with-most-unique-detections)
+ - [Results Summary](#results-summary-1)
+ - [Event Fequency Timeline](#event-fequency-timeline)
+ - [Dates with most total detections](#dates-with-most-total-detections)
+ - [Top 5 computers with most unique detections](#top-5-computers-with-most-unique-detections)
- [Hayabusa Rules](#hayabusa-rules)
- [Hayabusa v.s. Converted Sigma Rules](#hayabusa-vs-converted-sigma-rules)
- [Detection Rule Tuning](#detection-rule-tuning)
@@ -540,7 +542,9 @@ You can download the sample evtx files to a new `hayabusa-sample-evtx` sub-direc
git clone https://github.com/Yamato-Security/hayabusa-sample-evtx.git
```
-# Hayabusa Output Profiles
+# Hayabusa Output
+
+## Profiles
Hayabusa has 5 pre-defined profiles to use in `config/profiles.yaml`:
@@ -553,25 +557,25 @@ Hayabusa has 5 pre-defined profiles to use in `config/profiles.yaml`:
You can easily customize or add your own profiles by editing this file.
You can also easily change the default profile with `--set-default-profile `.
-## 1. `minimal` profile output
+### 1. `minimal` profile output
`%Timestamp%`, `%Computer%`, `%Channel%`, `%EventID%`, `%Level%`, `%RuleTitle%`, `%Details%`
-## 2. `standard` profile output
+### 2. `standard` profile output
`%Timestamp%`, `%Computer%`, `%Channel%`, `%EventID%`, `%Level%`, `%MitreTactics%`, `%RecordID%`, `%RuleTitle%`, `%Details%`
-## 3. `verbose` profile output
+### 3. `verbose` profile output
`%Timestamp%`, `%Computer%`, `%Channel%`, `%EventID%`, `%Level%`, `%MitreTactics`, `%MitreTags%`, `%OtherTags%`, `%RecordID%`, `%RuleTitle%`, `%Details%`, `%RuleFile%`, `%EvtxFile%`
-## 4. `verbose-all-field-info` profile output
+### 4. `verbose-all-field-info` profile output
Instead of outputting the minimal `details` information, all field information in the `EventData` section will be outputted.
`%Timestamp%`, `%Computer%`, `%Channel%`, `%EventID%`, `%Level%`, `%MitreTactics`, `%MitreTags%`, `%OtherTags%`, `%RecordID%`, `%RuleTitle%`, `%AllFieldInfo%`, `%RuleFile%`, `%EvtxFile%`
-## 5. `verbose-details-and-all-field-info` profile output
+### 5. `verbose-details-and-all-field-info` profile output
`verbose` profile plus all field information. (Warning: this will usually double the output file size!)
@@ -589,7 +593,7 @@ The following benchmarks were conducted on a 2018 MBP with 7.5GB of evtx data.
| verbose-all-field-info | 16 minutes 50 seconds | 1.6 GB |
| verbose-details-and-all-field-info | 17 minutes 12 seconds | 2.1 GB |
-## Profile Field Aliases
+### Profile Field Aliases
| Alias name | Hayabusa output information|
| :--- | :--- |
@@ -686,16 +690,18 @@ The alerts will be outputted in color based on the alert `level`.
You can change the default colors in the config file at `./config/level_color.txt` in the format of `level,(RGB 6-digit ColorHex)`.
If you want to disable color output, you can use `--no-color` option.
-## Event Fequency Timeline
+## Results Summary
+
+### Event Fequency Timeline
If you add `-V` or `--visualize-timeline` option, the Event Frequency Timeline feature displays a sparkline frequency timeline of detected events.
Note: There needs to be more than 5 events. Also, the characters will not render correctly on the default Command Prompt or PowerShell Prompt, so please use a terminal like Windows Terminal, iTerm2, etc...
-## Dates with most total detections
+### Dates with most total detections
A summary of the dates with the most total detections categorized by level (`critical`, `high`, etc...).
-## Top 5 computers with most unique detections
+### Top 5 computers with most unique detections
The top 5 computers with the most unique detections categorized by level (`critical`, `high`, etc...).
From 9f7a8980d8a457d06e4715e940d27ec7dbd74278 Mon Sep 17 00:00:00 2001
From: Yamato Security <71482215+YamatoSecurity@users.noreply.github.com>
Date: Thu, 11 Aug 2022 13:05:34 +0900
Subject: [PATCH 11/12] update readme
---
README-Japanese.md | 4 +++-
README.md | 4 +++-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/README-Japanese.md b/README-Japanese.md
index c5b25a41..05b59baf 100644
--- a/README-Japanese.md
+++ b/README-Japanese.md
@@ -276,9 +276,11 @@ rustup target add x86_64-unknown-linux-musl
以下のようにコンパイルします:
```
-rustup run stable-x86_64-unknown-linux-musl cargo build --release
+cargo build --release --target=x86_64-unknown-linux-musl
```
+MUSLバイナリは`./target/x86_64-unknown-linux-musl/release/`ディレクトリ配下に作成されます。
+
## Linuxでのコンパイルの注意点
diff --git a/README.md b/README.md
index e3b65770..ca248736 100644
--- a/README.md
+++ b/README.md
@@ -271,9 +271,11 @@ rustup target add x86_64-unknown-linux-musl
Compile with:
```
-rustup run stable-x86_64-unknown-linux-musl cargo build --release
+cargo build --release --target=x86_64-unknown-linux-musl
```
+The MUSL binary will be created in the `./target/x86_64-unknown-linux-musl/release/` directory.
+
# Running Hayabusa
## Caution: Anti-Virus/EDR Warnings and Slow Runtimes
From bbe8bc9b69b5d5c13c062c61160a9eabcd604b9a Mon Sep 17 00:00:00 2001
From: Yamato Security <71482215+YamatoSecurity@users.noreply.github.com>
Date: Thu, 11 Aug 2022 13:24:24 +0900
Subject: [PATCH 12/12] update readme
---
README-Japanese.md | 1 +
README.md | 1 +
2 files changed, 2 insertions(+)
diff --git a/README-Japanese.md b/README-Japanese.md
index 05b59baf..aa0353bc 100644
--- a/README-Japanese.md
+++ b/README-Japanese.md
@@ -280,6 +280,7 @@ cargo build --release --target=x86_64-unknown-linux-musl
```
MUSLバイナリは`./target/x86_64-unknown-linux-musl/release/`ディレクトリ配下に作成されます。
+MUSLバイナリはGNUバイナリより約15%遅いです。
## Linuxでのコンパイルの注意点
diff --git a/README.md b/README.md
index ca248736..5a8db360 100644
--- a/README.md
+++ b/README.md
@@ -275,6 +275,7 @@ cargo build --release --target=x86_64-unknown-linux-musl
```
The MUSL binary will be created in the `./target/x86_64-unknown-linux-musl/release/` directory.
+MUSL binaries are are about 15% slower than the GNU binaries.
# Running Hayabusa