SECURITY REVIEW / Trail of Bits
YARA rule authoring
Authors YARA-X rules that must be tested on the intended samples and on goodware, and forbids speculative nocase, wide, and unbounded regex.
“Guides authoring of high-quality YARA-X detection rules for malware identification. Use when writing, reviewing, or optimizing YARA rules. Covers naming conventions, string selection, performance optimization, migration from legacy YARA, and false positive reduction. Triggers on: YARA, YARA-X, malware detection, threat hunting, IOC, signature, crx module, dex module.”
01 / THE REASONING
Why this made the selection.
- Requires evidence for case or encoding variants before adding nocase or wide modifiers; measure their cost on the target corpus.
- Regex quantifiers must be bounded, and a regex without a 4-byte literal anchor is called a performance failure.
- The testing reference requires a positive match on the targets, zero matches on goodware, and an edge-case pass.
02 / THE REVIEW RECORD
What we actually inspected.
Source review has boundaries.
A clear record is more useful than a “safe” badge.
Material inspected
- plugins/yara-authoring/skills/yara-rule-authoring/SKILL.md
- LICENSE
- README.md
- plugins/yara-authoring/skills/yara-rule-authoring/references/testing.md
Our findings
- Modifier discipline forbids speculative nocase or wide, and regex guidance forbids an unbounded .* in favour of a bounded quantifier such as .{0,30}.
- The skill says not to write a rule against a packed layer, and to pivot to structure when three unique strings cannot be found.
- When NOT to Use excludes static disassembly, dynamic analysis, network signatures, memory forensics, and hash-only detection.
- references/testing.md says testing is non-negotiable and lists positive, negative goodware, and edge-case validation, with yr check as the syntax step.
- The definition explains little-endian uint reads and distinguishes cheap structural checks, string combinations and module parsing; it requires goodware testing before release.
Not established by this review
- The skill was not executed inside a host agent.
- yr was not run and no goodware corpus was scanned.
The review applies to the material and revision named here. A newer upstream release can change its behavior.
03 / PUT IT TO WORK
Add a skill to your workflow.
DOCUMENTED COMMAND
/plugin marketplace add trailofbits/skills Copying does not execute this command. It may retrieve a newer version than the reviewed source.
- Claude Code: add the marketplace with /plugin marketplace add trailofbits/skills, then install the yara-authoring plugin from /plugin menu.
- Codex: the README documents codex plugin marketplace add trailofbits/skills, then codex plugin add <plugin-name>@trailofbits.
- Install YARA-X (brew install yara-x or cargo install yara-x) and uv before using the bundled scripts.
- Name the false-positive risk before shipping a rule.
Before you start
- YARA-X, whose CLI is yr
- uv and Python 3.11 or later for the bundled scripts
- The detection target and a goodware corpus you are allowed to scan
04 / FOLLOW THE EVIDENCE
The source trail.
Our notes are separate from the original resource.
Check upstream before adopting a new version.
- Skill definition ↗Checked
https://github.com/trailofbits/skills/blob/82fe8226252622fa807643bdca1710901198553a/plugins/yara-authoring/skills/yara-rule-authoring/SKILL.md
Supports: Workflow and stated scope
- Repository licence ↗Checked
https://github.com/trailofbits/skills/blob/82fe8226252622fa807643bdca1710901198553a/LICENSE
Supports: Redistribution terms