performing-malware-triage-with-yara
यह क्या करती है
यह टूल फ़ाइलों को पहचानने और वर्गीकृत करने में मदद करता है, जैसे कंप्यूटर वायरस (malware)। यह फ़ाइलों की तुलना rules के एक सेट से करता है, ताकि देखा जा सके कि वे ज्ञात खतरों से मेल खाती हैं या नहीं।
कब इस्तेमाल करें
- ✓जब आपके पास बहुत सारी संदिग्ध फ़ाइलें हों जिन्हें जल्दी जांचना हो।
- ✓किसी खास तरह के खतरे को पहचानने के लिए नए rules बनाते समय।
- ✓कंप्यूटरों या फ़ाइलों में ज्ञात खतरों को खोजने के लिए।
Skill का लिंक
https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/performing-malware-triage-with-yara/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“इन 100 फ़ाइलों को known ransomware rules से जांचो।”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
टूल YARA नाम के प्रोग्राम का इस्तेमाल करता है, जो फ़ाइलों के अंदर patterns (जैसे byte sequences या text) को पहले से तय rules से मिलाता है। अगर कोई फ़ाइल किसी rule से मेल खाती है, तो उसे ज्ञात खतरे के रूप में वर्गीकृत किया जाता है।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
Performing Malware Triage with YARA
When to Use
- Rapidly classifying a large batch of malware samples against known family signatures
- Writing detection rules for a newly analyzed malware family based on unique byte patterns
- Scanning file shares, endpoints, or memory dumps for indicators of a specific threat
- Building automated triage pipelines that classify samples before manual analysis
- Hunting for variants of a known threat across an enterprise using YARA scans
Do not use as the sole analysis method; YARA triage identifies known patterns but does not reveal new or unknown malware behaviors.
Prerequisites
- YARA 4.x installed (
apt install yaraorpip install yara-python) - YARA rule repositories (YARA-Rules, awesome-yara, Malpedia rules, Florian Roth's signature-base)
- Python 3.8+ with
yara-pythonfor scripted scanning - Sample collection organized in a directory structure for batch scanning
- Understanding of PE file format, hex patterns, and regular expressions for rule writing
Workflow
Step 1: Scan Samples with Existing Rule Sets
Apply community and commercial YARA rules to classify samples:
# Scan a single file
yara -s malware_rules.yar suspect.exe
# Scan a directory of samples
yara -r malware_rules.yar /path/to/samples/
# Scan with multiple rule files
yara -r rules/apt_rules.yar rules/ransomware_rules.yar rules/trojan_rules.yar suspect.exe
# Scan with timeout (prevent hanging on large files)
yara -t 30 malware_rules.yar suspect.exe
# Scan and show matching strings
yara -s -r malware_rules.yar suspect.exe
# Scan with compiled rules (faster for repeated scans)
yarac malware_rules.yar compiled_rules.yarc
yara compiled_rules.yarc suspect.exe
# Download community rule sets
git clone https://github.com/Yara-Rules/rules.git yara-community-rules
git clone https://github.com/Neo23x0/signature-base.git signature-base
# Scan with signature-base
yara -r signature-base/yara/*.yar suspect.exe
Step 2: Write Rules for Unique String Patterns
Create YARA rules based on strings extracted during malware analysis:
rule MalwareX_Strings {
meta:
description = "Detects MalwareX based on unique strings"
author = "analyst"
date = "2025-09-15"
reference = "Internal Analysis Report #1547"
hash = "e3b0c44298fc1c149afbf4c8996fb924"
tlp = "WHITE"
strings:
// C2 URL pattern
$url1 = "/gate.php?id=" ascii
$url2 = "/panel/connect.php" ascii
// Unique mutex name
$mutex = "Global\\CryptLocker_2025" ascii wide
// User-Agent string
$ua = "Mozilla/5.0 (compatible; MSIE 10.0)" ascii
// Registry persistence path
$reg = "Software\\Microsoft\\Windows\\CurrentVersion\\Run\\WindowsUpdate" ascii
// Campaign identifier
$campaign = "campaign_2025_q3" ascii
condition:
uint16(0) == 0x5A4D and // PE file (MZ header)
filesize < 500KB and // Size constraint
($url1 or $url2) and // At least one C2 URL
($mutex or $campaign) and // Campaign identifier
$ua // Specific User-Agent
}
Step 3: Write Rules for Byte Patterns
Create rules matching specific code sequences:
rule MalwareX_Decryptor {
meta:
description = "Detects MalwareX XOR decryption routine"
author = "analyst"
date = "2025-09-15"
strings:
// XOR decryption loop (x86 assembly)
// mov al, [esi+ecx]
// xor al, [edi+ecx]
// mov [esi+ecx], al
// inc ecx
// cmp ecx, edx
// jl loop
$xor_loop = { 8A 04 0E 32 04 0F 88 04 0E 41 3B CA 7C F3 }
// RC4 KSA initialization (256-byte loop)
$rc4_ksa = { 33 C0 88 04 ?8 40 3D 00 01 00 00 7? }
// Embedded RSA public key marker
$rsa_key = { 06 02 00 00 00 A4 00 00 52 53 41 31 } // PUBLICKEYBLOB
condition:
uint16(0) == 0x5A4D and
($xor_loop or $rc4_ksa) and
$rsa_key
}
Step 4: Write Rules with PE Module
Leverage YARA's PE module for structural detection:
import "pe"
import "hash"
import "math"
rule MalwareX_PE_Characteristics {
meta:
description = "Detects MalwareX by PE structure and imports"
author = "analyst"
condition:
pe.is_pe and
// Compiled within specific timeframe
…
अक्सर पूछे जाने वाले सवाल
'YARA rules' क्या होते हैं?
ये डिजिटल सिग्नेचर जैसे होते हैं जो खतरनाक फ़ाइलों की खासियतें बताते हैं, जैसे कुछ खास text strings, byte patterns या फ़ाइल की संरचना की जानकारी।
क्या यह टूल हर तरह का malware ढूंढ सकता है?
नहीं, यह आपके दिए गए rules के आधार पर ज्ञात खतरों को पहचानने में अच्छा है। यह अपने आप नए प्रकार के malware नहीं खोजता।
क्या इसे इस्तेमाल करने के लिए कोडिंग आनी चाहिए?
बुनियादी scanning के लिए नहीं। लेकिन अपने खुद के detection rules बनाने के लिए फ़ाइलों के काम करने के तरीके और थोड़ी programming logic की समझ ज़रूरी है।
जानकारी
लेखक का मूल विवरण
Performs rapid malware triage and classification using YARA rules that match file patterns, strings, byte sequences, and structural characteristics against known malware families and suspicious indicators, covering rule writing, scanning, and integration into analysis pipelines. Use when classifying a batch of malware samples against known family signatures, writing detection rules for a newly ana
लोकप्रियता
- GitHub स्टार
- 35k
- रैंकिंग में स्थान
- #8263
- लाइसेंस
- Apache-2.0
- अपडेट की गई
- 31/8/2026
कमेंट
- …
इस repository की और skills
abusing-dpapi-for-credential-access
35kआपके AI एजेंट को किसी खास काम के लिए तैयार instructions देता है, ताकि वह उसे बेहतर और तेज़ी से कर सके।
abusing-shadow-credentials-for-privesc
35kआपके AI एजेंट को साफ़ और अच्छी तरह से व्यवस्थित लिखना सिखाता है।
achieving-cmmc-level-2-compliance
35kयह आपके एजेंट को CMMC Level 2 compliance के लिए environment तैयार करने में मदद करता है। यह security requirements लागू करता है और ज़रूरी documentation संभालता है।
acquiring-disk-image-with-dd-and-dcfldd
35kआपके एजेंट को hard drives की exact copies बनाने में मदद करता है। जाँच के दौरान किसी भी जानकारी के खोने या बदलने से बचाने के लिए यह उपयोगी है।
मिलती-जुलती skills
gitcrawl
394kयह आपके एजेंट को GitHub issues और pull requests के सेव आर्काइव में खोजने, मिलते-जुलते मामलों को समूह में रखने और लाइव स्थिति जांचने देती है।
slacrawl
394kयह आपके एजेंट को स्थानीय Slack आर्काइव में संदेश खोजने और गिनने, उसकी ताज़गी जांचने और ज़रूरत पड़ने पर उसे ताज़ा करने देती है।
goplaces
394kयह आपके एजेंट को Google Places से जगहें खोजने, उनका विवरण और समीक्षाएं पाने, और जगह के नाम हल करने में मदद करती है, स्क्रिप्ट के लिए JSON आउटपुट के साथ।