From 6414af3609a451f64d111244db95566dec064bcb Mon Sep 17 00:00:00 2001 From: Yamato Security <71482215+YamatoSecurity@users.noreply.github.com> Date: Fri, 20 May 2022 15:05:34 +0900 Subject: [PATCH] readme update (#529) --- README-Japanese.md | 93 ++++++------ README.md | 93 ++++++------ .../ElasticStackImport-Japanese.md | 132 ++++++++++++++++++ src/detections/configs.rs | 2 +- 4 files changed, 234 insertions(+), 86 deletions(-) create mode 100644 doc/ElasticStackImport/ElasticStackImport-Japanese.md diff --git a/README-Japanese.md b/README-Japanese.md index a8b463ac..2beaf2b9 100644 --- a/README-Japanese.md +++ b/README-Japanese.md @@ -21,7 +21,7 @@ # Hayabusa について -Hayabusaは、日本の[Yamato Security](https://yamatosecurity.connpass.com/)グループによって作られた**Windowsイベントログのファストフォレンジックタイムライン生成**および**スレットハンティングツール**です。 Hayabusaは日本語で[「ハヤブサ」](https://en.wikipedia.org/wiki/Peregrine_falcon)を意味し、ハヤブサが世界で最も速く、狩猟(hunting)に優れ、とても訓練しやすい動物であることから選ばれました。[Rust](https://www.rust-lang.org/) で開発され、マルチスレッドに対応し、可能な限り高速に動作するよう配慮されています。[Sigma](https://github.com/SigmaHQ/Sigma)ルールをHayabusaルール形式に変換する[ツール](https://github.com/Yamato-Security/hayabusa-rules/tree/main/tools/sigmac)も提供しています。Hayabusaの検知ルールもSigmaと同様にYML形式であり、カスタマイズ性や拡張性に優れます。稼働中のシステムで実行してライブ調査することも、複数のシステムからログを収集してオフライン調査することも可能です。(※現時点では、リアルタイムアラートや定期的なスキャンには対応していません。) 出力は一つのCSVタイムラインにまとめられ、Excel、[Timeline Explorer](https://ericzimmerman.github.io/#!index.md)、[Elastic Stack](doc/ElasticStackImport/ElasticStackImport-English.md)等で簡単に分析できるようになります。 +Hayabusaは、日本の[Yamato Security](https://yamatosecurity.connpass.com/)グループによって作られた**Windowsイベントログのファストフォレンジックタイムライン生成**および**スレットハンティングツール**です。 Hayabusaは日本語で[「ハヤブサ」](https://en.wikipedia.org/wiki/Peregrine_falcon)を意味し、ハヤブサが世界で最も速く、狩猟(hunting)に優れ、とても訓練しやすい動物であることから選ばれました。[Rust](https://www.rust-lang.org/) で開発され、マルチスレッドに対応し、可能な限り高速に動作するよう配慮されています。[Sigma](https://github.com/SigmaHQ/Sigma)ルールをHayabusaルール形式に変換する[ツール](https://github.com/Yamato-Security/hayabusa-rules/tree/main/tools/sigmac)も提供しています。Hayabusaの検知ルールもSigmaと同様にYML形式であり、カスタマイズ性や拡張性に優れます。稼働中のシステムで実行してライブ調査することも、複数のシステムからログを収集してオフライン調査することも可能です。(※現時点では、リアルタイムアラートや定期的なスキャンには対応していません。) 出力は一つのCSVタイムラインにまとめられ、Excel、[Timeline Explorer](https://ericzimmerman.github.io/#!index.md)、[Elastic Stack](doc/ElasticStackImport/ElasticStackImport-Japanese.md)等で簡単に分析できるようになります。 ## 目次 @@ -37,16 +37,17 @@ Hayabusaは、日本の[Yamato Security](https://yamatosecurity.connpass.com/) - [Excelでの解析:](#excelでの解析) - [Timeline Explorerでの解析:](#timeline-explorerでの解析) - [Criticalアラートのフィルタリングとコンピュータごとのグルーピング:](#criticalアラートのフィルタリングとコンピュータごとのグルーピング) - - [Elastic Stackダッシュボード](#elastic-stackダッシュボード) + - [Elastic Stackダッシュボードでの解析:](#elastic-stackダッシュボードでの解析) - [タイムラインのサンプル結果](#タイムラインのサンプル結果) - [特徴&機能](#特徴機能) - [予定されている機能](#予定されている機能) - [ダウンロード](#ダウンロード) +- [Gitクローン](#gitクローン) - [ソースコードからのコンパイル(任意)](#ソースコードからのコンパイル任意) + - [アドバンス: Rustパッケージの更新](#アドバンス-rustパッケージの更新) - [32ビットWindowsバイナリのクロスコンパイル](#32ビットwindowsバイナリのクロスコンパイル) - [macOSでのコンパイルの注意点](#macosでのコンパイルの注意点) - [Linuxでのコンパイルの注意点](#linuxでのコンパイルの注意点) - - [アドバンス: Rustパッケージの更新](#アドバンス-rustパッケージの更新) - [Hayabusaの実行](#hayabusaの実行) - [注意: アンチウィルス/EDRの誤検知](#注意-アンチウィルスedrの誤検知) - [Windows](#windows) @@ -68,7 +69,7 @@ Hayabusaは、日本の[Yamato Security](https://yamatosecurity.connpass.com/) - [検知ルールのチューニング](#検知ルールのチューニング) - [検知レベルのlevelチューニング](#検知レベルのlevelチューニング) - [イベントIDフィルタリング](#イベントidフィルタリング) -- [その他のWindowsイベントログ解析ツールおよび関連プロジェクト](#その他のwindowsイベントログ解析ツールおよび関連プロジェクト) +- [その他のWindowsイベントログ解析ツールおよび関連リソース](#その他のwindowsイベントログ解析ツールおよび関連リソース) - [Windowsイベントログ設定のススメ](#windowsイベントログ設定のススメ) - [Sysmon関係のプロジェクト](#sysmon関係のプロジェクト) - [コミュニティによるドキュメンテーション](#コミュニティによるドキュメンテーション) @@ -119,7 +120,7 @@ Windowsのイベントログは、 ## Criticalアラートのフィルタリングとコンピュータごとのグルーピング: ![Timeline ExplorerでCriticalアラートのフィルタリングとコンピュータグルーピング](screenshots/TimelineExplorer-CriticalAlerts-ComputerGrouping.png) -## Elastic Stackダッシュボード +## Elastic Stackダッシュボードでの解析: ![Elastic Stack Dashboard 1](doc/ElasticStackImport/17-HayabusaDashboard-1.png) @@ -131,7 +132,7 @@ CSVのタイムライン結果のサンプルは[こちら](https://github.com/Y CSVのタイムラインをExcelやTimeline Explorerで分析する方法は[こちら](doc/CSV-AnalysisWithExcelAndTimelineExplorer-Japanese.pdf)で紹介しています。 -CSVのタイムラインをElastic Stackにインポートする方法は[こちら](doc/ElasticStackImport/ElasticStackImport-English.md)で紹介しています。(現在、英語のみ) +CSVのタイムラインをElastic Stackにインポートする方法は[こちら](doc/ElasticStackImport/ElasticStackImport-Japanese.md)で紹介しています。 # 特徴&機能 @@ -157,20 +158,24 @@ CSVのタイムラインをElastic Stackにインポートする方法は[こち # ダウンロード -Hayabusaの[Releases](https://github.com/Yamato-Security/hayabusa/releases)からコンパイルされたバイナリが含まれている最新版をダウンロードできます。 +[Releases](https://github.com/Yamato-Security/hayabusa/releases)ページからHayabusaの安定したバージョンでコンパイルされたバイナリが含まれている最新版もしくはソースコードをダウンロードできます。 -または、以下の`git clone`コマンドでレポジトリをダウンロードし、ソースコードからコンパイルして使用することも可能です: +# Gitクローン + +以下の`git clone`コマンドでレポジトリをダウンロードし、ソースコードからコンパイルして使用することも可能です: ```bash git clone https://github.com/Yamato-Security/hayabusa.git --recursive ``` -注意: `--recursive`をつけ忘れた場合、サブモジュールとして管理されている`rules`フォルダ内のファイルはダウンロードされません。 +**注意:** mainブランチは開発中のバージョンです。まだ正式にリリースされていない新機能が使えるかもしれないが、バグがある可能性もあるので、テスト版だと思って下さい。 + +※ `--recursive`をつけ忘れた場合、サブモジュールとして管理されている`rules`フォルダ内のファイルはダウンロードされません。 `git pull --recurse-submodules`コマンド、もしくは以下のコマンドで`rules`フォルダを同期し、Hayabusaの最新のルールを更新することができます: ```bash -hayabusa.exe -u +hayabusa-1.2.2-win-x64.exe -u ``` アップデートが失敗した場合は、`rules`フォルダの名前を変更してから、もう一回アップデートしてみて下さい。 @@ -196,6 +201,16 @@ rustup update stable コンパイルされたバイナリは`target/release`フォルダ配下で作成されます。 +## アドバンス: Rustパッケージの更新 + +コンパイル前に最新のRust crateにアップデートすることで、最新のライブラリを利用することができます: + +```bash +cargo update +``` + +※ アップデート後、何か不具合がありましたらお知らせください。 + ## 32ビットWindowsバイナリのクロスコンパイル 以下のコマンドで64ビットのWindows端末で32ビットのバイナリをクロスコンパイルできます: @@ -231,16 +246,6 @@ Fedora系のディストロ: sudo yum install openssl-devel ``` -## アドバンス: Rustパッケージの更新 - -コンパイル前に最新のRust crateにアップデートすることで、最新のライブラリを利用することができます: - -```bash -cargo update -``` - -※ アップデート後、何か不具合がありましたらお知らせください。 - # Hayabusaの実行 ## 注意: アンチウィルス/EDRの誤検知 @@ -252,20 +257,20 @@ Hayabusaを実行する際にアンチウィルスやEDRにブロックされる ## Windows コマンドプロンプトやWindows Terminalから32ビットもしくは64ビットのWindowsバイナリをHayabusaのルートディレクトリから実行します。 -例: `hayabusa-1.2.0-windows-x64.exe` +例: `hayabusa-1.2.2-windows-x64.exe` ## Linux まず、バイナリに実行権限を与える必要があります。 ```bash -chmod +x ./hayabusa-1.2.0-linux-x64 +chmod +x ./hayabusa-1.2.2-linux-x64-gnu ``` 次に、Hayabusaのルートディレクトリから実行します: ```bash -./hayabusa-1.2.0-linux-x64 +./hayabusa-1.2.2-linux-x64-gnu ``` ## macOS @@ -273,13 +278,13 @@ chmod +x ./hayabusa-1.2.0-linux-x64 まず、ターミナルやiTerm2からバイナリに実行権限を与える必要があります。 ```bash -chmod +x ./hayabusa-1.2.0-mac-intel +chmod +x ./hayabusa-1.2.2-mac-intel ``` 次に、Hayabusaのルートディレクトリから実行してみてください: ```bash -./hayabusa-1.2.0-mac-intel +./hayabusa-1.2.2-mac-intel ``` macOSの最新版では、以下のセキュリティ警告が出る可能性があります: @@ -293,7 +298,7 @@ macOSの環境設定から「セキュリティとプライバシー」を開き その後、ターミナルからもう一回実行してみてください: ```bash -./hayabusa-1.2.0-mac-intel +./hayabusa-1.2.2-mac-intel ``` 以下の警告が出るので、「開く」をクリックしてください。 @@ -328,7 +333,7 @@ USAGE: --no-color 'カラー出力を無効にする。' -t --thread-number=[NUMBER] 'スレッド数。(デフォルト: パフォーマンスに最適な数値)' -s --statistics 'イベント ID の統計情報を表示する。' - -L --logon-summary 'ユーザのログオン情報の要約を出力' + -L --logon-summary '成功と失敗したログオン情報の要約を出力' -q --quiet 'Quietモード。起動バナーを表示しない。' -Q --quiet-errors 'Quiet errorsモード。エラーログを保存しない。' --level-tuning 'ルールlevelのチューニング [default: ./rules/config/level_tuning.txt]' @@ -341,79 +346,79 @@ USAGE: * 1つのWindowsイベントログファイルに対してHayabusaを実行します: ```bash -hayabusa.exe -f eventlog.evtx +hayabusa-1.2.2-win-x64.exe -f eventlog.evtx ``` * 複数のWindowsイベントログファイルのあるsample-evtxディレクトリに対して、Hayabusaを実行します: ```bash -hayabusa.exe -d .\hayabusa-sample-evtx +hayabusa-1.2.2-win-x64.exe -d .\hayabusa-sample-evtx ``` * 全てのフィールド情報も含めて1つのCSVファイルにエクスポートして、Excel、Timeline Explorer、Elastic Stack等でさらに分析することができます: ```bash -hayabusa.exe -d .\hayabusa-sample-evtx -o results.csv -F +hayabusa-1.2.2-win-x64.exe -d .\hayabusa-sample-evtx -o results.csv -F ``` * Hayabusaルールのみを実行します(デフォルトでは `-r .\rules` にあるすべてのルールが利用されます): ```bash -hayabusa.exe -d .\hayabusa-sample-evtx -r .\rules\hayabusa -o results.csv +hayabusa-1.2.2-win-x64.exe -d .\hayabusa-sample-evtx -r .\rules\hayabusa -o results.csv ``` * Windowsでデフォルトで有効になっているログに対してのみ、Hayabusaルールを実行します: ```bash -hayabusa.exe -d .\hayabusa-sample-evtx -r .\rules\hayabusa\default -o results.csv +hayabusa-1.2.2-win-x64.exe -d .\hayabusa-sample-evtx -r .\rules\hayabusa\default -o results.csv ``` * Sysmonログに対してのみHayabusaルールを実行します: ```bash -hayabusa.exe -d .\hayabusa-sample-evtx -r .\rules\hayabusa\sysmon -o results.csv +hayabusa-1.2.2-win-x64.exe -d .\hayabusa-sample-evtx -r .\rules\hayabusa\sysmon -o results.csv ``` * Sigmaルールのみを実行します: ```bash -hayabusa.exe -d .\hayabusa-sample-evtx -r .\rules\sigma -o results.csv +hayabusa-1.2.2-win-x64.exe -d .\hayabusa-sample-evtx -r .\rules\sigma -o results.csv ``` * 廃棄(deprecated)されたルール(`status`が`deprecated`になっているルール)とノイジールール(`.\rules\config\noisy_rules.txt`にルールIDが書かれているルール)を有効にします: ```bash -hayabusa.exe -d .\hayabusa-sample-evtx --enable-deprecated-rules --enable-noisy-rules -o results.csv +hayabusa-1.2.2-win-x64.exe -d .\hayabusa-sample-evtx --enable-deprecated-rules --enable-noisy-rules -o results.csv ``` * ログオン情報を分析するルールのみを実行し、UTCタイムゾーンで出力します: ```bash -hayabusa.exe -d .\hayabusa-sample-evtx -r .\rules\hayabusa\default\events\Security\Logons -U -o results.csv +hayabusa-1.2.2-win-x64.exe -d .\hayabusa-sample-evtx -r .\rules\hayabusa\default\events\Security\Logons -U -o results.csv ``` * 起動中のWindows端末上で実行し(Administrator権限が必要)、アラート(悪意のある可能性のある動作)のみを検知します: ```bash -hayabusa.exe -l -m low +hayabusa-1.2.2-win-x64.exe -l -m low ``` * criticalレベルのアラートからピボットキーワードの一覧を作成します(結果は結果毎に`keywords-Ip Address.txt`や`keyworss-Users.txt`等に出力されます): ```bash -hayabusa.exe -l -m critical -p -o keywords +hayabusa-1.2.2-win-x64.exe -l -m critical -p -o keywords ``` * イベントIDの統計情報を取得します: ```bash -hayabusa.exe -f Security.evtx -s +hayabusa-1.2.2-win-x64.exe -f Security.evtx -s ``` * 詳細なメッセージを出力します(処理に時間がかかるファイル、パースエラー等を特定するのに便利): ```bash -hayabusa.exe -d .\hayabusa-sample-evtx -v +hayabusa-1.2.2-win-x64.exe -d .\hayabusa-sample-evtx -v ``` * Verbose出力の例: @@ -607,7 +612,7 @@ Hayabusaルールは、Windowsのイベントログ解析専用に設計され ## 検知レベルのlevelチューニング Hayabusaルール、Sigmaルールはそれぞれの作者が検知した際のリスクレベルを決めています。 -ユーザが独自のリスクレベルに設定するには`./rules/config/level_tuning.txt`に変換情報を書き、`hayabusa.exe --level-tuning`を実行することでルールファイルが書き換えられます。 +ユーザが独自のリスクレベルに設定するには`./rules/config/level_tuning.txt`に変換情報を書き、`hayabusa-1.2.2-win-x64.exe --level-tuning`を実行することでルールファイルが書き換えられます。 ルールファイルが直接書き換えられることに注意して使用してください。 `./rules/config/level_tuning.txt`の例: @@ -627,7 +632,7 @@ id,new_level 最高のパフォーマンスを得たい場合はこのリストを使用してください。ただし、検出漏れの可能性が若干あることにご注意ください。 -# その他のWindowsイベントログ解析ツールおよび関連プロジェクト +# その他のWindowsイベントログ解析ツールおよび関連リソース 「すべてを統治する1つのツール」というものはなく、それぞれにメリットがあるため、これらの他の優れたツールやプロジェクトをチェックして、どれが気に入ったかを確認することをお勧めします。 @@ -637,12 +642,14 @@ id,new_level * [DeepBlueCLI](https://github.com/sans-blue-team/DeepBlueCLI) - [Eric Conrad](https://twitter.com/eric_conrad) によってPowershellで開発された攻撃検知ツール。 * [Epagneul](https://github.com/jurelou/epagneul) - Windowsイベントログの可視化ツール。 * [EventList](https://github.com/miriamxyra/EventList/) - [Miriam Wiesner](https://github.com/miriamxyra)によるセキュリティベースラインの有効なイベントIDをMITRE ATT&CKにマッピングするPowerShellツール。 +* [MITRE ATT&CKとWindowイベントログIDのマッピング](https://www.socinvestigation.com/mapping-mitre-attck-with-window-event-log-ids/) - 作者:[Michel de CREVOISIER](https://twitter.com/mdecrevoisier) * [EvtxECmd](https://github.com/EricZimmerman/evtx) - [Eric Zimmerman](https://twitter.com/ericrzimmerman)によるEvtxパーサー。 * [EVTXtract](https://github.com/williballenthin/EVTXtract) - 未使用領域やメモリダンプからEVTXファイルを復元するツール。 * [EvtxToElk](https://www.dragos.com/blog/industry-news/evtxtoelk-a-python-module-to-load-windows-event-logs-into-elasticsearch/) - Elastic StackにEvtxデータを送信するPythonツール。 * [EVTX ATTACK Samples](https://github.com/sbousseaden/EVTX-ATTACK-SAMPLES) - [SBousseaden](https://twitter.com/SBousseaden) によるEVTX攻撃サンプルイベントログファイル。 -* [EVTX-to-MITRE-Attack](https://github.com/mdecrevoisier/EVTX-to-MITRE-Attack) - ATT&CKにマッピングされたEVTX攻撃サンプルログのもう一つの素晴らしいレポジトリ。 +* [EVTX-to-MITRE-Attack](https://github.com/mdecrevoisier/EVTX-to-MITRE-Attack) - [Michel de CREVOISIER](https://twitter.com/mdecrevoisier)によるATT&CKにマッピングされたEVTX攻撃サンプルログのレポジトリ。 * [EVTX parser](https://github.com/omerbenamram/evtx) - [@OBenamram](https://twitter.com/obenamram) によって書かれた、私たちが使用したRustライブラリ。 +* [Grafiki](https://github.com/lucky-luk3/Grafiki) - SysmonとPowerShellログの可視化ツール。 * [LogonTracer](https://github.com/JPCERTCC/LogonTracer) - [JPCERTCC](https://twitter.com/jpcert) による、横方向の動きを検知するためにログオンを視覚化するグラフィカルなインターフェース。 * [RustyBlue](https://github.com/Yamato-Security/RustyBlue) - 大和セキュリティによるDeepBlueCLIのRust版。 * [Sigma](https://github.com/SigmaHQ/Sigma) - コミュニティベースの汎用SIEMルール。 diff --git a/README.md b/README.md index 2a655244..feb2c476 100644 --- a/README.md +++ b/README.md @@ -36,16 +36,17 @@ Hayabusa is a **Windows event log fast forensics timeline generator** and **thre - [Analysis in Excel](#analysis-in-excel) - [Analysis in Timeline Explorer](#analysis-in-timeline-explorer) - [Critical Alert Filtering and Computer Grouping in Timeline Explorer](#critical-alert-filtering-and-computer-grouping-in-timeline-explorer) - - [Elastic Stack Dashboard](#elastic-stack-dashboard) + - [Analysis with the Elastic Stack Dashboard](#analysis-with-the-elastic-stack-dashboard) - [Analyzing Sample Timeline Results](#analyzing-sample-timeline-results) - [Features](#features) - [Planned Features](#planned-features) - [Downloads](#downloads) +- [Git cloning](#git-cloning) - [Compiling From Source (Optional)](#compiling-from-source-optional) + - [Advanced: Updating Rust Packages](#advanced-updating-rust-packages) - [Cross-compiling 32-bit Windows Binaries](#cross-compiling-32-bit-windows-binaries) - [macOS Compiling Notes](#macos-compiling-notes) - [Linux Compiling Notes](#linux-compiling-notes) - - [Advanced: Updating Rust Packages](#advanced-updating-rust-packages) - [Running Hayabusa](#running-hayabusa) - [Caution: Anti-Virus/EDR Warnings](#caution-anti-virusedr-warnings) - [Windows](#windows) @@ -67,7 +68,7 @@ Hayabusa is a **Windows event log fast forensics timeline generator** and **thre - [Detection Rule Tuning](#detection-rule-tuning) - [Detection Level Tuning](#detection-level-tuning) - [Event ID Filtering](#event-id-filtering) -- [Other Windows Event Log Analyzers and Related Projects](#other-windows-event-log-analyzers-and-related-projects) +- [Other Windows Event Log Analyzers and Related Resources](#other-windows-event-log-analyzers-and-related-resources) - [Windows Logging Recommendations](#windows-logging-recommendations) - [Sysmon Related Projects](#sysmon-related-projects) - [Community Documentation](#community-documentation) @@ -116,7 +117,7 @@ Hayabusa is not intended to be a replacement for tools like [Evtx Explorer](http ![Critical alert filtering and computer grouping in Timeline Explorer](screenshots/TimelineExplorer-CriticalAlerts-ComputerGrouping.png) -## Elastic Stack Dashboard +## Analysis with the Elastic Stack Dashboard ![Elastic Stack Dashboard 1](doc/ElasticStackImport/17-HayabusaDashboard-1.png) @@ -145,7 +146,7 @@ You can learn how to import CSV files into Elastic Stack [here](doc/ElasticStack * Rule level tuning. * Create a list of unique pivot keywords to quickly identify abnormal users, hostnames, processes, etc... as well as correlate events. * Output all fields for more thorough investigations. -* Successful and failed user logon summary. +* Successful and failed logon summary. # Planned Features @@ -154,9 +155,13 @@ You can learn how to import CSV files into Elastic Stack [here](doc/ElasticStack # Downloads -You can download the latest stable version of hayabusa with compiled binaries from the [Releases](https://github.com/Yamato-Security/hayabusa/releases) page. +Please download the latest stable version of hayabusa with compiled binaries or the source code from the [Releases](https://github.com/Yamato-Security/hayabusa/releases) page. -You can also `git clone` the repository with the following command and compile binary from source code: +# Git cloning + +You can `git clone` the repository with the following command and compile binary from source code: + +** Warning:** The main branch of the repository is for development purposes so you may be able to access new features not yet officially released, however, there may be bugs so consider it unstable. ```bash git clone https://github.com/Yamato-Security/hayabusa.git --recursive @@ -167,7 +172,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.exe -u +hayabusa-1.2.2-win-x64.exe -u ``` If the update fails, you may need to rename the `rules` folder and try again. @@ -186,6 +191,8 @@ cargo clean cargo build --release ``` +You can download the latest unstable version from the main branch or the latest stable version from the [Releases](https://github.com/Yamato-Security/hayabusa/releases) page. + Be sure to periodically update Rust with: ```bash @@ -194,6 +201,16 @@ rustup update stable The compiled binary will be outputted in the `target/release` folder. +## Advanced: Updating Rust Packages + +You can update to the latest Rust crates before compiling: + +```bash +cargo update +``` + +Please let us know if anything breaks after you update. + ## Cross-compiling 32-bit Windows Binaries You can create 32-bit binaries on 64-bit Windows systems with the following: @@ -225,16 +242,6 @@ Fedora-based distros: sudo yum install openssl-devel ``` -## Advanced: Updating Rust Packages - -You can update to the latest Rust crates before compiling: - -```bash -cargo update -``` - -Please let us know if anything breaks after you update. - # Running Hayabusa ## Caution: Anti-Virus/EDR Warnings @@ -244,20 +251,20 @@ You may receive warning from anti-virus or EDR when trying to run hayabusa. Thes ## Windows In Command Prompt or Windows Terminal, just run the 32-bit or 64-bit Windows binary from the hayabusa root directory. -Example: `hayabusa-1.2.0-windows-x64.exe` +Example: `hayabusa-1.2.2-windows-x64.exe` ## Linux You first need to make the binary executable. ```bash -chmod +x ./hayabusa-1.2.0-linux-x64 +chmod +x ./hayabusa-1.2.2-linux-x64-gnu ``` Then run it from the Hayabusa root directory: ```bash -./hayabusa-1.2.0-linux-x64 +./hayabusa-1.2.2-linux-x64-gnu ``` ## macOS @@ -265,13 +272,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.2.0-mac-intel +chmod +x ./hayabusa-1.2.2-mac-intel ``` Then, try to run it from the Hayabusa root directory: ```bash -./hayabusa-1.2.0-mac-intel +./hayabusa-1.2.2-mac-intel ``` On the latest version of macOS, you may receive the following security error when you try to run it: @@ -285,7 +292,7 @@ Click "Cancel" and then from System Preferences, open "Security & Privacy" and f After that, try to run it again. ```bash -./hayabusa-1.2.0-mac-intel +./hayabusa-1.2.2-mac-intel ``` The following warning will pop up, so please click "Open". @@ -320,7 +327,7 @@ USAGE: --no-color 'Disable color output' -t --thread-number=[NUMBER] 'Thread number. (Default: Optimal number for performance.)' -s --statistics 'Prints statistics of event IDs.' - -L --logon-summary 'User logon and failed logon summary' + -L --logon-summary 'Successful and failed logons summary.' -q --quiet 'Quiet mode. Do not display the launch banner.' -Q --quiet-errors 'Quiet errors mode. Do not save error logs.' --level-tuning 'Adjust rule level. [default: ./rules/config/level_tuning.txt]' @@ -333,79 +340,79 @@ USAGE: * Run hayabusa against one Windows event log file: ```bash -hayabusa.exe -f eventlog.evtx +hayabusa-1.2.2-win-x64.exe -f eventlog.evtx ``` * Run hayabusa against the sample-evtx directory with multiple Windows event log files: ```bash -hayabusa.exe -d .\hayabusa-sample-evtx +hayabusa-1.2.2-win-x64.exe -d .\hayabusa-sample-evtx ``` * Export to a single CSV file for further analysis with excel, timeline explorer, elastic stack, etc... and include all field information: ```bash -hayabusa.exe -d .\hayabusa-sample-evtx -o results.csv -F +hayabusa-1.2.2-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.exe -d .\hayabusa-sample-evtx -r .\rules\hayabusa -o results.csv +hayabusa-1.2.2-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.exe -d .\hayabusa-sample-evtx -r .\rules\hayabusa\default -o results.csv +hayabusa-1.2.2-win-x64.exe -d .\hayabusa-sample-evtx -r .\rules\hayabusa\default -o results.csv ``` * Only run hayabusa rules for sysmon logs: ```bash -hayabusa.exe -d .\hayabusa-sample-evtx -r .\rules\hayabusa\sysmon -o results.csv +hayabusa-1.2.2-win-x64.exe -d .\hayabusa-sample-evtx -r .\rules\hayabusa\sysmon -o results.csv ``` * Only run sigma rules: ```bash -hayabusa.exe -d .\hayabusa-sample-evtx -r .\rules\sigma -o results.csv +hayabusa-1.2.2-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.exe -d .\hayabusa-sample-evtx --enable-noisy-rules --enable-deprecated-rules -o results.csv +hayabusa-1.2.2-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.exe -d .\hayabusa-sample-evtx -r .\rules\hayabusa\default\events\Security\Logons -U -o results.csv +hayabusa-1.2.2-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.exe -l -m low +hayabusa-1.2.2-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.exe -l -m critical -p -o keywords +hayabusa-1.2.2-win-x64.exe -l -m critical -p -o keywords ``` * Print Event ID statistics: ```bash -hayabusa.exe -f Security.evtx -s +hayabusa-1.2.2-win-x64.exe -f Security.evtx -s ``` * Print verbose information (useful for determining which files take long to process, parsing errors, etc...): ```bash -hayabusa.exe -d .\hayabusa-sample-evtx -v +hayabusa-1.2.2-win-x64.exe -d .\hayabusa-sample-evtx -v ``` * Verbose output example: @@ -447,7 +454,7 @@ The format is `KeywordName.FieldName`. For example, when creating the list of `U ## Logon Summary Generator -You can use the `-L` or `--logon-summary` option to output logon information summary(logon username, logon success and logon failed count). +You can use the `-L` or `--logon-summary` option to output logon information summary (logon usernames and successful and failed logon count). You can display the logon information for one evtx file with `-f` or multiple evtx files with the `-d` option. # Testing Hayabusa on Sample Evtx Files @@ -599,7 +606,7 @@ You can also add a rule ID to `rules/config/noisy_rules.txt` in order to ignore 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.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.2.2-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: @@ -620,7 +627,7 @@ We have provided a sample ID filter list at [`config/target_eventids_sample.txt` Please use this list if you want the best performance but be aware that there is a slight possibility for missing events (false negatives). -# Other Windows Event Log Analyzers and Related Projects +# Other Windows Event Log Analyzers and Related Resources There is no "one tool to rule them all" and we have found that each has its own merits so we recommend checking out these other great tools and projects and seeing which ones you like. @@ -630,12 +637,14 @@ There is no "one tool to rule them all" and we have found that each has its own * [DeepBlueCLI](https://github.com/sans-blue-team/DeepBlueCLI) - Attack detection tool written in Powershell by [Eric Conrad](https://twitter.com/eric_conrad). * [Epagneul](https://github.com/jurelou/epagneul) - Graph visualization for Windows event logs. * [EventList](https://github.com/miriamxyra/EventList/) - Map security baseline event IDs to MITRE ATT&CK by [Miriam Wiesner](https://github.com/miriamxyra). +* [Mapping MITRE ATT&CK with Window Event Log IDs](https://www.socinvestigation.com/mapping-mitre-attck-with-window-event-log-ids/) - by [Michel de CREVOISIER](https://twitter.com/mdecrevoisier) * [EvtxECmd](https://github.com/EricZimmerman/evtx) - Evtx parser by [Eric Zimmerman](https://twitter.com/ericrzimmerman). * [EVTXtract](https://github.com/williballenthin/EVTXtract) - Recover EVTX log files from unallocated space and memory images. * [EvtxToElk](https://www.dragos.com/blog/industry-news/evtxtoelk-a-python-module-to-load-windows-event-logs-into-elasticsearch/) - Python tool to send Evtx data to Elastic Stack. * [EVTX ATTACK Samples](https://github.com/sbousseaden/EVTX-ATTACK-SAMPLES) - EVTX attack sample event log files by [SBousseaden](https://twitter.com/SBousseaden). -* [EVTX-to-MITRE-Attack](https://github.com/mdecrevoisier/EVTX-to-MITRE-Attack) - Another great repository of EVTX attack sample logs mapped to ATT&CK. +* [EVTX-to-MITRE-Attack](https://github.com/mdecrevoisier/EVTX-to-MITRE-Attack) - EVTX attack sample event log files mapped to ATT&CK by [Michel de CREVOISIER](https://twitter.com/mdecrevoisier) * [EVTX parser](https://github.com/omerbenamram/evtx) - the Rust library we used written by [@OBenamram](https://twitter.com/obenamram). +* [Grafiki](https://github.com/lucky-luk3/Grafiki) - Sysmon and PowerShell log visualizer. * [LogonTracer](https://github.com/JPCERTCC/LogonTracer) - A graphical interface to visualize logons to detect lateral movement by [JPCERTCC](https://twitter.com/jpcert_en). * [RustyBlue](https://github.com/Yamato-Security/RustyBlue) - Rust port of DeepBlueCLI by Yamato Security. * [Sigma](https://github.com/SigmaHQ/sigma) - Community based generic SIEM rules. diff --git a/doc/ElasticStackImport/ElasticStackImport-Japanese.md b/doc/ElasticStackImport/ElasticStackImport-Japanese.md new file mode 100644 index 00000000..64380fd5 --- /dev/null +++ b/doc/ElasticStackImport/ElasticStackImport-Japanese.md @@ -0,0 +1,132 @@ +# Elastic Stackへの結果インポート + +## Elastic Stackディストリビューションの開始 + +Hayabusaの結果はElasic Stackへ簡単にインポートすることができます。DFIR調査に特化した無料のElasitc Stack Linuxディストリビューションである[SOF-ELK](https://github.com/philhagen/sof-elk/blob/main/VM_README.md)の仕様をおすすめします。 + +まず SOF-ELKのVMWareイメージを[http://for572.com/sof-elk-vm](http://for572.com/sof-elk-vm)からダウンロードし解凍します。 +ユーザ名とパスワードのデフォルトは以下のとおりです。 + +* Username: `elk_user` +* Password: `forensics` + +VMを起動したら、以下のスクリーンのようなものが表示されます。 + +![SOF-ELK Bootup](01-SOF-ELK-Bootup.png) + +表示されたURLをウェブブラウザに入力してKibanaを開きます。例: http://172.16.62.130:5601/ + +>> Note: Kibanaの読み込みには時間を要します + +以下のウェブページが表示されます。 + +![SOF-ELK Kibana](02-Kibana.png) + +## CSV結果のインポート + +一番上の左隅のサイドバーアイコンをクリックし、`Integrations`を開いてください。 + +![Integrations](03-Integrations.png) + +サーチバーに`csv`を入力して`Upload a file`をクリックしてください。 + +![CSV Upload](04-IntegrationsImportCSV.png) + +CSVファイルをアップロードした後、`Override settings`をクリックして正しいタイムスタンプのフォーマットを指定します。 + +![Override Settings](05-OverrideSettings.png) + +以下の通り、変更したら`Apply`をクリックします。 + +1. `Timestamp format` を `custom`に変更する。 +2. フォーマットを`yyyy-MM-dd HH:mm:ss.SSS XXX`に指定する。 +3. `Time field` を `Timestamp`に変更する。 + +![Override Settings Config](06-OverrideSettingsConfig.png) + +左隅の`Import`をクリックします。 + +![CSV Import](07-CSV-Import.png) + +`Import`を押す前に、`Advanced` をクリックして以下の設定を投入してください。 + +1. `Index name` を `evtxlogs-hayabusa`にします。 +2. `Index settings`に、`, "number_of_replicas": 0` を追加してインデックスのヘルスステータスが黄色にならないようにします。 +3. `Mappings`の下にある`RuleTitle`の type を`text` から `keyword` に、`EventID` の type を `long` から `keyword` に変更します。 +4. `Ingest pipeline`の下にある `remove`セクションの下に`, "field": "Timestamp"`を追加します。タイムスタンプは`@timestamp`として表示されるため重複するフィールドは不要になります。インポートのエラーを回避するために以下の記載を削除します。 + ``` + { + "convert": { + "field": "EventID", + "type": "long", + "ignore_missing": true + } + }, + ``` + +設定は以下の図のようになります。 + +![Import Data Settings](08-ImportDataSettings.png) + +インポート後、以下のようなImport completeの画面表示が得られます。 + +![Import Finish](09-ImportFinish.png) + +`View index in Discover` をクリックして結果を閲覧することができます。 + + +## 解析結果 + +デフォルトのDiscoverの表示は以下のようになります。 + +![Discover View](10-Discover.png) + +画面上部のヒストグラムを見ることでいつイベントが発生したか、イベントの頻度の概要を見ることができます。 + +画面左のサイドバーでフィールドにカーソルを合わせてプラスマークをクリックするとこで列に表示するフィールドを追加することができます。 + +![Adding Columns](12-AddingColumns.png) + +最初は以下のカラムを追加することをおすすめします。 + +![Recommended Columns](13-RecommendedColumns.png) + +Discoveryビューでは以下のように見えます。 + +![Discover With Columns](14-DicoverWithColumns.png) + +KQLによるフィルタで、以下の例の通り、イベントやアラートを検索することができます。 + * `Level: "critical"`: criticalのアラートのみを表示する。 + * `Level: "critical" or Level: "high"`: high と critical のアラートを表示する。 + * `NOT Level:info`: informationalのイベントを表示しない。 + * `*LatMov*`: 感染の横展開に関連するアラートとイベントを表示する。 + * `"Password Spray"`: "Password Spray"のような特定の攻撃のみを表示する。 + * `"LID: 0x8724ead"`: ログオンIDが0x8724eadとなっている関連したイベントを全て表示する。 + +## Hayabusaダッシュボード + +シンプルなHayabusaダッシュボードを設定するためのJSONを提供します。[ここ](HayabusaDashboard.ndjson)をクリックすると設定のためのJSONファイルがダウンロードできます。 + +ダッシュボードのインポートのためには、左のサイドバーを開き、`Management`の下にある`Stack Management`をクリックします。 + +![Stack Management](15-HayabusaDashboard-StackManagement.png) + +`Saved Objects`を押した後に, 右上隅にある`Import`をクリックして、ダウンロードしたHayabusaダッシュボードJSONファイルをインポートします。 + +![Import Dashboard](16-HayabusaDashboard-Import.png) + +以下のダッシュボードを利用することができます。 + +![Hayabusa Dashboard-1](17-HayabusaDashboard-1.png) + +![Hayabussa Dashboard-2](18-HayabusaDashboard-2.png) + +## 今後の展望 + +SOF-ELK用のHayabusa logstashパーサーとダッシュボードを作成予定です。この機能でHayabusaのCSVの結果ファイルをディレクトリにコピーするだけでログの取り込みができるようになる予定です。 + +## 謝辞 + +このドキュメントの多くは、@kzzzzo2さんの[こちら](https://qiita.com/kzzzzo2/items/ead8ccc77b7609143749)のブログ記事から引用しました。 + +@kzzzzo2 さん、ありがとうございます! \ No newline at end of file diff --git a/src/detections/configs.rs b/src/detections/configs.rs index 34b07397..e208024a 100644 --- a/src/detections/configs.rs +++ b/src/detections/configs.rs @@ -90,7 +90,7 @@ fn build_app<'a>() -> ArgMatches<'a> { --no-color 'Disable color output' -t --thread-number=[NUMBER] 'Thread number. (Default: Optimal number for performance.)' -s --statistics 'Prints statistics of event IDs.' - -L --logon-summary 'User logon and failed logon summary' + -L --logon-summary 'Successful and failed logons summary.' -q --quiet 'Quiet mode. Do not display the launch banner.' -Q --quiet-errors 'Quiet errors mode. Do not save error logs.' -p --pivot-keywords-list 'Create a list of pivot keywords.'