ti-yara-hunting
できること
このスキルは、マルウェアのサンプルと分析メモを、ファイルに一致するYARAルールに変える方法を説明します。検知ルールを作るマルウェアアナリストやセキュリティチーム向けです。
使う場面
- ✓アナリストが、分析済みのマルウェアのサンプルからYARAルールを書くよう依頼するとき。
- ✓ルールを速く、かつ通常のファイルに一致しすぎないよう調整する必要があるとき。
- ✓承認されたルールで、大きなファイルのコレクションから亜種を探したいとき。
スキルのリンク
https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/analyst/ti-yara-hunting/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“このサンプルの文字列と振る舞いからYARAルールを書き、通常のファイルに一致しないかを確認してもらえますか。”
毎週5つの新しいスキル。1分で読めます。
仕組み
エージェントはサンプルから特徴的な文字列と構造を選び、ルールを書き、構文を確認します。クリーンなファイルの集合と悪意のあるファイルの集合でテストします。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
YARA Hunting
Write YARA rules from malware samples, behavioral observations, and threat intelligence reports. Deploy rules for retrohunting across VirusTotal (500M+ files) and ANY.RUN (2TB malware corpus) to discover campaign variants, earlier versions, and related infrastructure.
Quick Reference
# Install YARA
apt-get install -y yara || pip install yara-python
# Install YARA-X (Rust rewrite — faster, stricter)
cargo install yara-x
# Install yarGen for automated rule generation
git clone https://github.com/Neo23x0/yarGen.git /opt/yarGen
cd /opt/yarGen && pip install -r requirements.txt
python3 yarGen.py --update # Download goodware string DB (first run only)
# Scan a file with a rule
yara /workspace/rules/suspect.yar /workspace/samples/
# Compile rules for faster scanning
yarac /workspace/rules/*.yar /workspace/rules/compiled.yarc
yara /workspace/rules/compiled.yarc /workspace/samples/
# Validate rule syntax (YARA-X — stricter parser)
yr check /workspace/rules/suspect.yar
MITRE ATT&CK Mapping
| Technique | ID | Relevance |
|---|---|---|
| Obtain Capabilities: Exploits | T1588.005 | YARA identifies exploit tools/payloads in attacker arsenals |
| Develop Capabilities: Malware | T1587.001 | Rules detect custom malware based on unique strings/structures |
| Gather Victim Host Information: Software | T1592.002 | YARA scans reveal installed malware on victim hosts |
| Indicator Removal on Host | T1070 | Retrohunting finds samples attackers attempted to erase |
1. YARA Rule Syntax
Minimal Rule Structure
rule Malware_FamilyName_Variant {
meta:
author = "Decepticon TI"
date = "2025-01-01"
description = "Detects FamilyName variant based on unique strings"
hash = "e3b0c44298fc1c149afbf4c8996fb924..."
reference = "https://report-url"
tlp = "WHITE"
strings:
$s1 = "unique_string_from_sample" ascii wide
$s2 = { 4D 5A 90 00 03 00 00 00 } // MZ header + specific bytes
$s3 = /https?:\/\/[a-z0-9\-\.]+\/gate\.php/ nocase
condition:
uint16(0) == 0x5A4D and // PE file check
filesize < 5MB and
2 of ($s*)
}
String Types
strings:
// Text strings
$text1 = "CreateRemoteThread" // ASCII exact
$text2 = "CreateRemoteThread" ascii wide // Both encodings
$text3 = "http://c2.evil.com" nocase // Case insensitive
$text4 = "cmd /c" fullword // Word boundary match
// Hex strings (byte patterns)
$hex1 = { 48 8B 05 ?? ?? ?? ?? } // ?? = any byte (wildcard)
$hex2 = { 4D 5A [0-200] 50 45 00 00 } // Jump 0-200 bytes
$hex3 = { ( 74 | 75 ) 0? } // Alternation: je or jne
// Regex strings
$re1 = /https?:\/\/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}(:\d+)?\/[a-z]+\.php/
$re2 = /[A-Za-z0-9+\/]{50,}={0,2}/ // Base64 blob
// XOR-encoded strings (YARA 4.0+)
$xor1 = "This program cannot" xor // All single-byte XOR keys
$xor2 = "config_url" xor(0x01-0xFF) // Specific XOR range
// Base64-encoded strings (YARA 4.0+)
$b64 = "powershell" base64 base64wide
Condition Essentials
condition:
// File type guards (always lead with these)
uint16(0) == 0x5A4D // PE (MZ header)
uint32(0) == 0x464C457F // ELF
uint16(0) == 0x4B50 // ZIP/DOCX/XLSX (PK)
// String matching
all of them // Every string must match
any of them // At least one
2 of ($s*) // 2+ from $s group
3 of ($api*) and 1 of ($str*) // Mixed groups
#s1 > 5 // $s1 appears 5+ times
// Size + offset constraints
filesize < 1MB
$mz at 0 // $mz must be at offset 0
$s1 in (0..1024) // $s1 in first 1KB
// PE module (import pe)
pe.imports("kernel32.dll", "VirtualAlloc")
pe.number_of_sections > 6
// Math module (import math)
math.entropy(0, filesize) > 7.0 // High entropy (packed)
// Typical combined condition
uint16(0) == 0x5A4D and filesize < 2MB and
(2 of ($s*) or all of ($api*))
2. Writing Rules from Malware Samples
Step-by-Step: Sample to Rule
# Step 1: Extract strings from sample
strings -n 6 /workspace/samples/<SAMPLE> > /
よくある質問
YARAルールとは何ですか?
テキストの文字列やファイルの構造など、マルウェアの特徴を記述するパターンのファイルで、スキャナーが一致を見つけられるようにします。
なぜ通常のファイルでテストするのですか?
多くの通常のファイルに一致するルールは、ノイズを生み、アナリストの時間を浪費するとスキルは述べています。
どのツールに触れていますか?
YARA、YARA-X、ルールを作るyarGenのジェネレーターが挙げられています。
詳細
作者による元の説明
YARA rule writing from behavioral observations and TI report analysis — sample-to-rule conversion, condition optimization, performance tuning, and retrohunting on VirusTotal and ANY.RUN. Covers YARA/YARA-X syntax, yarGen automated generation, and production rule deployment.
人気
- GitHubのスター
- 6.5k
- ランキング
- #13978
- ライセンス
- 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、ファイアウォール、更新、バックアップなどのセキュリティリスクについて監査し、安全な修正案を提案するようエージェントを支援します。