reverser-yara-hunting
できること
このスキルは、マルウェアのパターンを記述するYARAルールの書き方と、誤検知を避ける方法を説明します。マルウェア分析者と脅威ハンター向けです。
使う場面
- ✓脅威ハンターが、一連のファイルの中から特定のマルウェアのファミリーを見つけるルールを必要とするとき。
- ✓分析者が、既存のYARAルールの誤検知を減らす必要があるとき。
- ✓チームが、公開されたマルウェアのサンプルの集まりから、あるパターンを検索したいとき。
スキルのリンク
https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/reverser/yara-hunting/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“このマルウェアのファミリーに固有の文字列を使い、そのファイルを見つけるYARAルールを書いてください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
このスキルはAIに、メタデータ、特定の文字列やバイトのパターン、ファイルサイズや署名の状態などの条件を含むルールを書き、一般的な誤りに対してテストするよう指示します。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
YARA Rule Authoring + Hunting
Anatomy of a good rule
import "pe"
import "hash"
rule MalFamily_DropperVariant_Q4_2024 {
meta:
author = "you"
date = "2024-11-20"
description = "MalFamily dropper, observed Q4 2024 campaign"
hash = "deadbeefdeadbeefdeadbeefdeadbeef"
tlp = "amber"
confidence = "high"
false_positives = "low (test against AV vendor samples)"
mitre = "T1055"
strings:
$magic = { 4D 5A 90 00 03 } // MZ + DOS header
$config_marker = { 7A 89 ?? ?? 4F 8C } // 6-byte signature, 2 wildcards
$string1 = "loader_stage_2" wide
$string2 = "cmd.exe /c " ascii
$api1 = "VirtualAllocEx"
$api2 = "WriteProcessMemory"
$api3 = "CreateRemoteThread"
// Avoid generic strings — they cause FPs.
condition:
uint16(0) == 0x5A4D and // PE header
filesize < 5MB and // bounded — avoids huge-file scans
$config_marker and // unique marker
2 of ($api1, $api2, $api3) and // at least 2 of the 3 process-inject APIs
any of ($string*) and
pe.imports("ws2_32.dll", "WSAStartup") and // network capability
not pe.is_signed // unsigned
}
The condition tools you need
// Filesize / offset reads (no module)
filesize > 100KB and filesize < 5MB
uint32(0x3c) > 0 and uint32(uint32(0x3c)) == 0x4550 // valid PE
// "for" loops over offsets / sections
for any i in (0..pe.number_of_sections - 1):
(pe.sections[i].name == ".text" and pe.sections[i].entropy > 7.0)
// "of"
1 of them // any one string
all of ($a*) // all $a*-prefix strings
3 of ($s1, $s2, $s3, $s4, $s5) // at least 3 of 5
// Hash module
hash.sha256(0, filesize) == "..." // exact-match rule
hash.imphash() == "..." // PE import hash (fragile but high-signal)
High-leverage patterns
Family-stable byte patterns
Look for unique byte sequences that survive obfuscation:
- Crypto constants (SHA-256 IVs, AES sbox, RC4 init pattern)
- Hard-coded SID strings
- C2 packet headers (magic bytes, fixed offsets)
- Reflective loader entry stub bytes (Donut, Cobalt Strike's PE loader)
Capability rules
Don't fingerprint a sample — fingerprint a TECHNIQUE:
rule Suspicious_ProcessInjection {
meta: description = "VirtualAlloc + WriteProcessMemory + CreateRemoteThread = injection"
condition:
pe.imports("kernel32.dll", "VirtualAllocEx") and
pe.imports("kernel32.dll", "WriteProcessMemory") and
pe.imports("kernel32.dll", "CreateRemoteThread")
}
This catches every injector regardless of family. False-positive: legitimate tools (Procmon, IDA, debuggers). Reduce via additional conditions (unsigned, in temp dir, etc.).
Anti-analysis fingerprinting
rule AntiVm_VMware_Strings {
strings:
$s1 = "VMware" ascii nocase
$s2 = "VBoxService" ascii nocase
$s3 = "qemu" ascii nocase
$s4 = { 56 4D 58 68 } // "VMXh" — VMware backdoor port magic
condition: 2 of them
}
Hunting at scale
VirusTotal Retrohunt (paid)
// Upload rule to VT — runs against the past 90 days of submissions
// Outputs new hashes matching the signature
MalwareBazaar (free)
# yarafs.io / abuse.ch — runs YARA against MB corpus
curl https://mb-api.abuse.ch/api/v1/ -X POST -d 'query=get_yara&yara_rule=YourRule'
Local corpus scan
# Recursive scan
yara -r rules/ /samples/
# JSON output for downstream processing
yara -r rules/ /samples/ -m -p 4 # -m: metadata, -p: parallel threads
# Fast pre-filter with capa first
capa /samples/sample.exe # extracts capabilities; rule-driven, JSON-output
Common pitfalls
| Pitfall | Fix |
|---|---|
| Too-short strings (4 bytes) → false positives | Use 8+ byte strings; require multiple matches |
Regex /pattern/ with [, ?, * → slow |
Prefer literal strings; if regex needed, anchor with ^/\b |
| No filesize bound → scans 5GB files | Always include filesize < N |
Multiple wildcards in one hex ?? → exponential matcher cost |
Limit to 2-3 wildcards per byte string |
condition: any of them with one common string → constant FPs |
Use 2 of them minimum |
| Rule name with version | Use a separate meta.version so |
よくある質問
YARAとは何ですか?
マルウェアのファイルを記述し、検出するために使われるパターンマッチングの言語です。
誤検知をどのように避けますか?
特定性の高い文字列を使い、ルールに頼る前にテストすることを勧めています。
サンプルはどこで検索しますか?
VirusTotalやMalwareBazaarなどの、公開されたマルウェアのサンプルサービスに触れています。
詳細
作者による元の説明
YARA rule authoring + hunting — `condition:` syntax, hex patterns with wildcards, `for`/`any of them`, PE module, ELF module, hash module, math module. Build per-family signatures, hunt at scale via VT/MalwareBazaar/Hybrid Analysis. Avoid common pitfalls (collisions, slow rules, regex traps).
人気
- GitHubのスター
- 6.5k
- ランキング
- #14180
- ライセンス
- Apache-2.0
- 更新日
- 2026/11/1
コメント
- …
このリポジトリの他のスキル
detector-overview
6.5kエージェントが、スキャナーが指摘したコードを読み、本物のセキュリティバグと誤検知を見分けられるよう支援します。
exploiter-overview
6.5kエージェントが、確認済みの複数のセキュリティ上の弱点を一つのテストの連鎖にまとめ、その影響がどこまで及ぶかを確認できるよう支援します。
llm-redteam-overview
6.5kエージェントが、プロンプトインジェクションからモデルの悪用まで、15の戦術グループの中から適切なAIレッドチーム用ガイドを見つけられるよう支援します。
aatmf-t01-prompt-injection
6.5kプロンプトインジェクションを説明します。隠された指示でAIシステムを乗っ取ろうとする手口を、セキュリティテスターが確認できるようにします。
似ているスキル
reverse-engineer-anything
422kREAツールを使って、出荷済みのアプリやパッケージの中身を調べ、機能の説明、版の比較、再構築の手順をエージェントが支援します。
1password
394k1Password CLIをセットアップし、サインインして、秘密情報の値を会話に表示せずに読み取ったり注入したりするようエージェントを支援します。
healthcheck
394kOpenClawを動かすコンピューターやサーバーを、SSH、ファイアウォール、更新、バックアップなどのセキュリティリスクについて監査し、安全な修正案を提案するようエージェントを支援します。