yara-rule-authoring
Skill8 starsChanged 7 months agoMITView on GitHub
Guides authoring, review, optimization, and false-positive debugging of YARA-X detection rules for malware identification across PE, script, npm, Office, Chrome extensions (crx module), and Android DEX (dex module). Covers string and atom quality, condition short-circuiting, legacy YARA migration, yarGen/FLOSS workflows, goodware validation, and production deployment—not full malware reverse engineering, network IDS (Suricata/Snort), or memory forensics (Volatility). Use when the user asks to write YARA rule, YARA-X, yr check, yr scan, false positive YARA, yarGen, malware detection rule, crx module, dex module, optimize YARA performance, or migrate legacy YARA.
- Installs packages
5 other projects use a version of this.
Adopted by
Most recently taken up by
- davidanthonyn/claude-skillstheir own version, first seen Oct 20, 2026
- TaiMaBenJi/taima-skillstheir own version, first seen Oct 11, 2026
- romaintoso78/claude-skillstheir own version, first seen Jun 25, 2026
- rade-nugroho/Agentic-Enteprises-Skillword for word, first seen May 20, 2026
- TheWatcher01/skillstheir own version, first seen Apr 1, 2026
Other versions5 projects use a version of this.
Word for word · 1
- rade-nugroho/Agentic-Enteprises-Skill★ 9100% same
Edited · 0
None found.
Wrote their own version · 4
- romaintoso78/claude-skills★ 1same name
- TaiMaBenJi/taima-skills★ 1same name
- davidanthonyn/claude-skills★ 0same name
- TheWatcher01/skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository197 other files it gives its agents.
- ab-testing-engineerSkill
- actuarial-analystSkill
- actuarial-consultingSkill
- actuarySkill
- advanced-long-term-actuarial-mathematicsSkill
- advanced-persistent-threatSkill
- advanced-short-term-actuarial-mathematicsSkill
- agentic-ai-developerSkill
- ai-adversarial-robustness-engineerSkill
- ai-context-engineerSkill
- ai-engineerSkill
- ai-lead-opsSkill
- ai-memory-developerSkill
- ai-redteamSkill
- ai-researcherSkill
- ai-risk-governanceSkill
- ai-skill-managerSkill
- ai-token-improvement-plan-engineerSkill
- aml-cftSkill
- aml-complianceSkill
- analytics-data-engineering-manager-productSkill
- analytics-data-engineerSkill
- anti-false-positive-decision-makingSkill
- applied-ai-architect-commercial-enterpriseSkill
- appointed-chief-actuarySkill
- asset-liability-managementSkill
- associate-actuarySkill
- assumption-settingSkill
- auditorSkill
- bcm-disaster-recovery-specialistSkill
- bi-analystSkill
- build-validatorSkill
- business-analystSkill
- business-consultantSkill
- business-model-researcherSkill
- certified-information-systems-security-professionalSkill
- chief-information-security-officerSkill
- ci-cd-engineerSkill
- cicd-engineerSkill
- cisco-certified-network-professionalSkill
- classified-cyber-security-senior-managerSkill
- classified-software-devsecops-engineerSkill
- cloud-architectSkill
- cloud-compliance-specialistSkill
- cloud-economistSkill
- cloud-engineerSkill
- cloud-security-engineerSkill
- cloud-system-administratorSkill
- cluster-deployment-engineerSkill
- code-securitySkill
- commercial-counselSkill
- communication-leadSkill
- community-executive-escalations-program-managerSkill
- compliance-engineerSkill
- compliance-specialistSkill
- compute-accounting-managerSkill
- control-software-developerSkill
- corporate-counselSkill
- country-managerSkill
- cross-department-translationSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
6 rules. 0 are common, 5 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 4 edited versions we read keep these.
5
Distinctive
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 15
Write YARA-X rules that catch the intended family without drowning analysts in false positives.
- Distinctive: line 21
Write, review, or optimize YARA-X rules for malware, hacktools, webshells, or supply-chain artifacts
- Distinctive: line 75
Check packing: entropy > 7.0 or few strings → unpack or target packer/structure, not encrypted layer
- Distinctive: line 82
Run yarGen or FLOSS on unpacked samples
- Distinctive: line 84
Prefer gold tier: mutex names, PDB paths, stack strings.
- Very specific: line 163
Use yr dump -m pe for sections, imports, imphash, resources.
“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
YARA Rule Authoring
Write YARA-X rules that catch the intended family without drowning analysts in false positives.
Target runtime: YARA-X (Rust successor to legacy YARA). Install:
brew install yara-xorcargo install yara-x. Essential CLI:yr check,yr scan,yr fmt,yr dump.
When to Use
- Write, review, or optimize YARA-X rules for malware, hacktools, webshells, or supply-chain artifacts
- Convert IOCs or threat intel into maintainable signatures
- Debug false positives or tune
any of/all oflogic - Migrate legacy YARA rules to YARA-X stricter validation
- Author Chrome extension (
crx) or Android DEX (dex) module rules - Prepare rulesets for production, YARA-CI, or VirusTotal retrohunt
When NOT to Use
- Full malware reverse engineering, disassembly, or unpacker development →
reverse-engineer - Network intrusion detection (Suricata, Snort, Zeek) → network security / SOC tooling skills
- Memory forensics with Volatility or live RAM analysis →
digital-forensics-analyst - Hash-only blocklists with no pattern logic → use IOC lists or EDR hash feeds
- Enterprise security strategy, GRC, or audit evidence →
cybersecurity,compliance-engineer - Embedding YARA in CI/CD pipelines as the primary task →
devsecops - Adversarial LLM or application red team →
ai-redteam
Related skills
| Need | Skill |
| Security program, IR strategy, detection philosophy | cybersecurity |
| SIEM/EDR rules, logging, control implementation | information-security-engineer |
| Audit evidence, control mapping, CCM | compliance-engineer |
| Pipeline gates, artifact scanning, SBOM | devsecops |
| Binary RE, unpacking, patch diff | reverse-engineer |
| SOC alert triage and detection tuning (non-YARA) | defensive-security-analyst, soc-analyst |
| Proactive threat hunts and ATT&CK campaigns | threat-hunter |
| CTI briefs, IOC/TTP production | cti-analyst |
| Adversarial AI / prompt injection testing | ai-redteam |
| Disk imaging and forensic reports | digital-forensics-analyst |
Core principles
- Atoms matter — YARA extracts 4-byte subsequences for Aho-Corasick prefilter. Strings with repeated bytes, common sequences, or under 4 bytes force expensive bytecode verification on too many files.
- Family-specific, not category-generic — "Detects ransomware" matches everything and nothing. Target identifiable mutexes, PDB paths, C2 paths, or structural markers for one family or campaign.
- Goodware before production — Validate against ecosystem-appropriate clean corpus (VT goodware for PE; top npm packages for JS; marketplace extensions for CRX).
- Short-circuit cheap checks first —
filesize→ magic bytes → strings → modules. - Metadata is documentation — Name, description, author, reference, and date survive personnel changes.
Essential toolkit
| Tool | Purpose |
| yarGen | Candidate strings from samples (--excludegood); always yr check output |
| FLOSS | Obfuscated/stack strings when yarGen fails |
| yr | yr check, yr scan -s, yr fmt, yr dump -m pe|crx|dex |
| YARA-CI / VT retrohunt | Goodware corpus testing before deploy |
Core workflows
1. Scope samples and file type
- Collect 3+ variants when possible (single-sample rules are brittle)
- Check packing: entropy > 7.0 or few strings → unpack or target packer/structure, not encrypted layer
- Choose platform path: PE magic / JS / Office ZIP /
import "crx"/import "dex"
See references/yara_x_scope_and_tooling.md for install, CLI workflow, and migration.
2. Extract and filter strings
- Run yarGen or FLOSS on unpacked samples
- Reject ~80% of yarGen output: API names,
C:\Windows\, format strings,require/fetchalone - Prefer gold tier: mutex names, PDB paths, stack strings; silver: C2 paths, config markers
See references/string_selection_and_atoms.md for decision trees and modifiers.
3. Write rule with ordered conditions
rule MAL_Win_Example_Loader_Jan26
{
meta:
description = "Detects Example loader via unique mutex and config path"
author = "Team <team@example.com>"
reference = "https://example.com/analysis"
date = "2026-01-15"
strings:
$mutex = "Global\\ExampleMutex" ascii wide
$cfg = "/api/beacon/check" ascii
condition:
filesize < 10MB and
uint16(0) == 0x5A4D and
all of ($mutex, $cfg)
}Condition order: filesize → magic bytes → string matches → module calls (pe, crx, dex).
See references/conditions_and_performance.md for atom theory, regex bounds, and loops.
4. Validate and test
yr check rule.yar && yr fmt -w rule.yar
yr scan -s rule.yar malware_samples/ # must match all targets
yr scan -c rule.yar goodware_corpus/ # must be zeroFP flow: yr scan -s on false positive → identify matching string → tighten, exclude vendor, or pivot to structure.
See references/testing_goodware_and_fp_debugging.md for corpus selection and investigation.
5. Platform modules (when applicable)
- Chrome extensions:
import "crx"— permissions,permhash()(v1.11.0+). Alwayscrx.is_crxfirst. - Android:
import "dex"—dex.contains_class(),contains_method(),contains_string(). API differs from legacy YARA dex module.
See references/platform_modules_pe_crx_dex.md.
6. Deploy
- Naming:
{CATEGORY}_{PLATFORM}_{FAMILY}_{VARIANT}_{DATE}(e.g.MAL_Win_Emotet_Loader_Jan26) - Peer review + quality checklist
- Monitor production FPs; version rules in Git with full metadata
See references/style_metadata_and_deployment.md.
Decision trees (quick reference)
Is this string good enough?
< 4 bytes? → reject
Repeated bytes (0000, 9090)? → reject
API name or common path? → reject
Unique to family? → use
Common across malware? → combine with family-specific markerany of vs all of
- Individually unique strings →
any of ($a*) - Common strings that are suspicious only together →
all of ($a*) - Mixed confidence →
all of ($core_*) and any of ($variant_*)
Production lesson: any of ($network_*) with fetch, axios, http matches most web apps — require credential path and exfil destination and network call.
When strings fail → pivot
Use yr dump -m pe for sections, imports, imphash, resources; math.entropy() on sections; packer signatures. If nothing unique remains, YARA alone may not be the right control.
Legacy YARA migration
yr check --relaxed-re-syntax rules/ # diagnostic only
yr check rules/ # fix until cleanCommon fixes: escape \{ in regex; base64 strings need 3+ chars; @a[-1] → @a[#a - 1]; remove duplicate modifiers.
Rationalizations to reject
| Thought | Reality |
| "yarGen gave me these strings" | yarGen suggests; you validate each string |
| "It works on 10 samples" | Test goodware corpus before deploy |
| "I'll tighten after FPs" | FPs burn trust — write tight rules upfront |
| "This API name is malicious" | Legitimate software uses the same APIs |
| "any of them is fine" | Common strings + any = FP flood |
Quality checklist
- Name follows
{CATEGORY}_{PLATFORM}_{FAMILY}_{VARIANT}_{DATE} - Description starts with "Detects" and states distinguishing feature
- Required meta: author, reference, date
- Strings ≥4 bytes with good atoms; no unbounded regex (
.*) - Condition:
filesizeand magic bytes before modules - Matches all target samples; zero goodware matches
yr checkandyr fmt --checkpass- Peer review completed
When to load references
| Topic | Reference |
| YARA-X install, CLI, migration, toolkit | references/yara_x_scope_and_tooling.md |
| String quality, types, modifiers | references/string_selection_and_atoms.md |
| Atoms, condition order, regex, loops | references/conditions_and_performance.md |
| PE, macOS, JS, crx, dex patterns | references/platform_modules_pe_crx_dex.md |
| Goodware testing, FP debugging | references/testing_goodware_and_fp_debugging.md |
| Naming, metadata, deployment | references/style_metadata_and_deployment.md |
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

