
Fnord は難読化されたコードのパターン抽出ツールです
Fnord には2つの主要機能があります:
Fnord は、最小長 -m X(デフォルト: 4)から最大長 -x X(デフォルト: 40)までの可変サイズのスライディングウィンドウでファイルを処理し、すべてのシーケンスを抽出します。各長さについて、Fnord は最も頻繁に出現するシーケンス -t X(デフォルト: 3)をテーブルで表示します。
テーブルの各行には以下が含まれます:
Fnord は実験的な YARA ルールも生成します。YARA ルール作成中に、シーケンスの長さと出現回数(長さ × 出現回数)に基づいてスコアを計算します。次に、各シーケンスから非文字をすべて除去し、キーワードのリスト(大文字小文字を区別しない)と比較して、他のシーケンスよりも興味深いシーケンスを検出します。各文字列をルールに書き込む前に、Fnord はレーベンシュタイン距離を計算し、すでにルールに統合されたシーケンスと類似しすぎるシーケンスをスキップします。
[実験的] Fnord は数日前に作成され、少数のサンプルでテストしました。今後数週間でデフォルトを調整し、さらにキーワード、フィルター、スコアリングオプションを追加する予定です。
サンプル内で難読化されたコードを見つけた場合は、16進エディタを使用して難読化部分を抽出し、新しいファイルに保存してください。その新しいファイルを分析に使用します。
フラグ -s、-k, -r、--yara-strings、-m、-e` を試してみてください。
弱い YARA ルールを生成するサンプルがあれば送ってください。改善の余地があります。
____ __
/ __/__ ___ _______/ /
/ _// _ \/ _ \/ __/ _ /
/_/ /_//_/\___/_/ \_,_/ Pattern Extractor for Obfuscated Code
v0.7, Florian Roth
usage: fnord.py [-h] [-f file] [-m min] [-x max] [-t top] [-n min-occ]
[-e min-entropy] [--strings] [--include-padding] [--debug]
[--noyara] [-s similarity] [-k keywords-multiplier]
[-r structure-multiplier] [-c count-limiter] [--yara-exact]
[--yara-strings max] [--show-score] [--show-count]
[--author author]
Fnord - Pattern Extractor for Obfuscated Code
optional arguments:
-h, --help show this help message and exit
-f file File to process
-m min Minimum sequence length
-x max Maximum sequence length
-t top Number of items in the Top x list
-n min-occ Minimum number of occurrences to show
-e min-entropy Minimum entropy
--strings Show strings only
--include-padding Include 0x00 and 0x20 in the extracted strings
--debug Debug output
YARA Rule Creation:
--noyara Do not generate an experimental YARA rule
-s similarity Allowed similarity (use values between 0.1=low and
10=high, default=1.5)
-k keywords-multiplier
Keywords multiplier (multiplies score of sequences if
keyword is found) (best use values between 1 and 5,
default=2.0)
-r structure-multiplier
Structure multiplier (multiplies score of sequences if
it is identified as code structure and not payload)
(best use values between 1 and 5, default=2.0)
-c count-limiter Count limiter (limts the impact of the count by
capping it at a certain amount) (best use values
between 5 and 100, default=20)
--yara-exact Add magic header and magic footer limitations to the
rule
--yara-strings max Maximum sequence length
--show-score Show score in comments of YARA rules
--show-count Show count in sample in comments of YARA rules
--author author YARA rule author
git clone https://github.com/Neo23x0/Fnord.git して cd Fnordpip3 install -r ./requirements.txtpython3 ./fnord.py --helppython3 fnord.py -f ./test/wraeop.sct --yara-strings 10
python3 fnord.py -f ./test/vbs.txt --show-score --show-count -t 1 -x 20
python3 fnord.py -f ./test/inv-obf.txt --show-score --show-count -t 1 --yara-strings 4 --yara-exact



フォルダ ./test には悪意のあるスクリプトが含まれており、ローカルのアンチウイルススキャナーで検出される可能性があります。実行しない限り、システムに害はありません。
yarGen はホワイトリスト方式を使用して、YARA ルール作成に最適な文字列をフィルタリングします。yarGen は、いくつかの正規表現を適用して、YARA ルール作成前に文字列のスコアを調整します。しかし、そのアプローチは、統計に基づいてバイトシーケンスのスコアを計算する Fnord の方法とは大きく異なります。
yarGen は非難読化コードに最適ですが、Fnord は難読化コード専用であり、yarGen よりもはるかに優れた結果を生成するはずです。
アップデートは Twitter でフォローしてください @cyb3rops