Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Evtx files with different extension #586

Closed
jurelou opened this issue Jun 10, 2022 · 5 comments · Fixed by #594
Closed

Evtx files with different extension #586

jurelou opened this issue Jun 10, 2022 · 5 comments · Fixed by #594
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@jurelou
Copy link

jurelou commented Jun 10, 2022

I can see that hayabusa only supports files with evtx extension.

Would it be possible to add a command line argument to check for a different file extension ?

thanks !

@jurelou jurelou added the bug Something isn't working label Jun 10, 2022
@YamatoSecurity
Copy link
Collaborator

We only support evtx event log files. What would the use case be?
That is, why would a windows event log have a different file extension?

@YamatoSecurity YamatoSecurity added enhancement New feature or request and removed bug Something isn't working labels Jun 12, 2022
@jurelou
Copy link
Author

jurelou commented Jun 15, 2022

I mean, valid windows event logs (evtx file format) but with a different file extension.

Some collection tools store event logs with a different file extension (eg: https:/DFIR-ORC/dfir-orc).
With this specific tool, event logs are stored with .evtx_data extension

Maybe you could make this configurable via an optional command line argument with defaults to .evtx:

@YamatoSecurity
Copy link
Collaborator

I see. Thank you for letting us know. I didn't know different tools save evtx files with different file extensions. We will see if we can automatically check if it is a valid evtx file regardless of file extension or worst case scenario, just add an option as you said to allow for different file extensions.

@hitenkoku 世の中のイベントファイルの収集ツールが.evtx_data等の違うファイル拡張子で保存することがあるみたいなので、それに対応したいのですが、お願いできますか?できれば、fileコマンドのように拡張子関係なく、ファイルが正当なevtx形式かどうか自動的にチェックした方が良さそうですが、evtxライブラリの機能などでそういったチェックは可能ですか?
難しいのであれば、ここで提案されているように--file-extension evtx_dataのオプションで.evtx以外のファイルを解析できるようにしたいです。

@hitenkoku
Copy link
Collaborator

hitenkoku commented Jun 19, 2022

@YamatoSecurity evtxライブラリの読み込み時にエラーがあった場合読み込みをスキップするようにしてますが、あまり、すべてのファイルに対して行うという形にするとパフォーマンス面で影響が出てしまう可能性もあります。

一応現状では、以下のようにEvtxParser側の方でパースが失敗したら読み込みをスキップするようにしています(evtxファイル自体が不正もしくは壊れていた場合の時を想定)

hayabusa/src/main.rs

Lines 635 to 651 in 11fe0c0

fn evtx_to_jsons(&self, evtx_filepath: PathBuf) -> Option<EvtxParser<File>> {
match EvtxParser::from_path(evtx_filepath) {
Ok(evtx_parser) => {
// parserのデフォルト設定を変更
let mut parse_config = ParserSettings::default();
parse_config = parse_config.separate_json_attributes(true); // XMLのattributeをJSONに変換する時のルールを設定
parse_config = parse_config.num_threads(0); // 設定しないと遅かったので、設定しておく。
let evtx_parser = evtx_parser.with_configuration(parse_config);
Option::Some(evtx_parser)
}
Err(e) => {
eprintln!("{}", e);
Option::None
}
}
}

この場合、evtxライブラリは必ず変換をしようとしてその結果失敗という形になるので、ファイル数が多くなると拡張子での制限はつけておきたいところです。一度ファイル制限を外してみたバージョンを作成するのでパフォーマンスへの影響がないかどうか確認していただけますでしょうか

@hitenkoku hitenkoku linked a pull request Jun 19, 2022 that will close this issue
@hitenkoku hitenkoku removed a link to a pull request Jun 20, 2022
@hitenkoku hitenkoku self-assigned this Jun 20, 2022
@hitenkoku hitenkoku added this to the v1.4 milestone Jun 20, 2022
@hitenkoku
Copy link
Collaborator

@YamatoSecurity 承りました。--file-extensionの方法で対応しようと思います。以下2つに付いて仕様を決めたいのですがどうでしょうか。

  • --file-extension evtx_data -> 調査対象にするのは evtx_dataとevtxにするか、evtx_dataのみにするか。個人的にはevtxはデフォルトで入れておいたほうがいいかなと思っていました。
  • --file-extensionにで複数拡張子をサポートするか? -> --file-extension evtx_data hogehoge と指定するとevtx_dataとhogehogeを対象とするようにしたほうがよいでしょうか。

hitenkoku added a commit that referenced this issue Jun 20, 2022
hitenkoku added a commit that referenced this issue Jun 20, 2022
hitenkoku added a commit that referenced this issue Jun 20, 2022
hitenkoku added a commit that referenced this issue Jun 20, 2022
hitenkoku added a commit that referenced this issue Jun 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
3 participants