reverser-yara-hunting
What it does
It explains how to write YARA rules that describe malware patterns and how to avoid false alarms. It is for malware analysts and threat hunters.
When to use it
- βWhen a threat hunter wants a rule that finds a specific malware family in a set of files.
- βWhen an analyst needs to reduce false alarms in an existing YARA rule.
- βWhen a team wants to search public malware sample collections for a pattern.
Skill link
https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/reverser/yara-hunting/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agentβs skills folder.
Example of what to ask your AI
βWrite a YARA rule that finds files from this malware family using its unique strings.β
5 new skills a week. 1 minute to read.
How it works
The skill guides the AI to write rules with metadata, specific text or byte patterns and conditions such as file size and signing status, then test them against common mistakes.
Technical content (original SKILL.md)
Original text by the author, straight from 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 |
FAQ
What is YARA?
YARA is a pattern-matching language used to describe and detect malware files.
How does it avoid false alarms?
It advises using specific strings and testing rules before relying on them.
Where are samples searched?
It mentions public malware sample services such as VirusTotal and MalwareBazaar.
Details
Original description by the author
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).
Popularity
- GitHub stars
- 6.5k
- Ranking position
- #14180
- License
- Apache-2.0
- Updated
- 11/1/2026
Comments
- β¦
More skills from this repository
detector-overview
6.5kHelps your agent read code that a scanner flagged and decide which flagged spots are real security bugs and which are false alarms.
exploiter-overview
6.5kHelps your agent join several confirmed security weaknesses into one test chain and check how far that chain could reach.
llm-redteam-overview
6.5kHelps your agent find the right AI red-team guide for a test, covering 15 tactic groups from prompt injection to model abuse.
aatmf-t01-prompt-injection
6.5kExplains prompt injection, where hidden instructions try to override an AI system, so security testers can check for it.
Similar skills
reverse-engineer-anything
422kHelps your agent look inside shipped apps and packages to explain features, compare versions, or guide a rebuild, using the REA tool.
1password
394kHelps your agent set up the 1Password CLI, sign in, and read or inject secrets without printing their values into chat.
healthcheck
394kHelps your agent audit the computer or server that runs OpenClaw for security risks, such as SSH, firewall, updates, and backups, then suggest safe fixes.