malware-yara · git:20261117.0ed1f2a · 2026-11-17 · sha256 8ec88a763a1c884f

malware-yara git:20261117.0ed1f2aA

Immutable. This exact content never changes and is served at /api/v1/blob/8ec88a763a1c884f.

No tool to install first
claude plugin marketplace add https://markdownregistry.com/mp/a/art_rspzhc2h5adbtumu/8ec88a763a1c884fc3613005334a8100659d058d6e7ec40136731ce70bf08b7e.json

Then /plugin install malware-yara@markdownregistry-rspzhc2h5adbtumu in Claude Code. It installs this exact version, the one graded A here, pinned to the commit it was graded at, and leaves it there.

---
name: malware-yara
description: Guides writing and running YARA rules to detect a malware family or hunt for related samples across a set — building a rule from a sample, tuning for hit quality, and scaling with yara. Use when the user asks to write, tune or test a YARA rule, detect a malware family, or scan files for related samples.
license: Apache-2.0
metadata:
  verified: "2026-10-20"
---

# YARA hunting

Turn what you learned from one sample into detection for the whole family.
Stage rules and targets under `/work`; scan with `yara`.

**Engine note:** since **YARA-X** 1.0 (2025), classic YARA 4.x is in maintenance
mode (bug-fixes only) and YARA-X is the reference implementation VirusTotal runs at
scale. The rules below are standard YARA syntax and run on either, but YARA-X is
stricter — it rejects some sloppy patterns 4.x tolerated (unescaped `{` or invalid
escapes in regexes, `base64` strings under 3 chars, duplicate rule modifiers) — and
it adds a few things 4.x lacks (`.len()`, hex/octal jump bounds), so passing one
engine doesn't guarantee the other. Classic `yara` is 4.x; if you
author for YARA-X, check with `yr check` and keep
strings/conditions tight.

## Write a rule from a sample

- Pull candidate signatures from `rabin2 -z` strings: distinctive strings
  (C2 templates, mutex names, PDB paths, unique error messages) and stable byte
  sequences (decryption stubs, config markers).
- Prefer **few strong, specific** strings over many weak ones. A good rule
  matches the family, not the packer or the compiler boilerplate.

```
rule FamilyName {
  meta:
    author = "marq"
    ref = "sha256 of the pivot sample"
  strings:
    $a = "unique-c2-template-%s.php" ascii
    $b = { 8B 45 ?? 33 C9 8A 4C 05 ?? }   // decrypt stub, wildcards for variety
  condition:
    uint16(0) == 0x5A4D and 2 of them
}
```

## Tune for hit quality

- Anchor on `uint16(0) == 0x5A4D` (PE) / `0x457f` (ELF) to cut false positives.
- Wildcard volatile bytes (`??`) so minor variants still match.
- Test against both the sample (must hit) and known-good files (must not) —
  scan `/usr/bin` with `yara` to sanity-check for false positives.

## Run & scale

- `yara` with `-r` to recurse a directory of samples; `-s` to print the
  matching strings (proof). Cluster the hits — a rule that catches N unrelated
  samples is too broad.
- Good rules are an IOC of the most durable kind (TTP/tooling on the pyramid of
  pain). Record the rule itself in the finding evidence, and feed family names
  back into `ORKL` (`load_skill ioc-pivoting`) for existing reporting.