yara-rule-authoring
하는 일
이 스킬은 YARA-X 형식으로 악성코드 탐지 규칙을 작성하는 방법을 안내합니다. 악성코드 시그니처를 작성하거나 점검하는 보안 분석가와 위협 탐색가를 위한 스킬입니다.
사용하는 경우
- ✓특정 악성코드 계열을 찾는 새 YARA 규칙을 작성할 때.
- ✓기존 YARA 규칙이 정상 파일에도 걸려서 오탐을 줄이고 싶을 때.
- ✓오래된 YARA 규칙을 YARA-X로 옮기는 경우.
스킬 링크
https://github.com/trailofbits/skills/blob/main/plugins/yara-authoring/skills/yara-rule-authoring/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“이 악성코드 계열을 찾되 정상적인 Windows 파일에는 일치하지 않는 YARA-X 규칙을 작성해 주세요.”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
이름 짓기, 문자열 선택, 성능에 관한 선택을 안내합니다. 또한 규칙을 검사하고 배포 전에 확인하는 스크립트도 포함되어 있습니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.
YARA-X Rule Authoring
Write detection rules that catch malware without drowning in false positives.
Resolve the linter, atom analyzer,
and review helper from this installed SKILL.md's directory.
In commands below, replace each <resolved-...-path> with that script's absolute
path and keep the quotes. The rule file or directory is still relative to your
working directory unless you pass an absolute input path.
This skill targets YARA-X, the Rust-based successor to legacy YARA — 5-10x faster regex, better errors, built-in formatter, stricter validation, new modules (crx, dex), 99% rule compatibility. It powers VirusTotal's production systems. Install with brew install yara-x or cargo install yara-x; the CLI is yr. See Migrating from Legacy YARA for existing rules.
Core Principles
Strings must generate good atoms — YARA extracts 4-byte subsequences for fast matching. Strings with repeated bytes, common sequences, or under 4 bytes force slow bytecode verification on too many files.
Target specific families, not categories — "Detects ransomware" catches everything and nothing. "Detects LockBit 3.0 configuration extraction routine" catches what you want.
Test against goodware before deployment — A rule that fires on Windows system files is useless. Validate against VirusTotal's goodware corpus or your own clean file set.
Short-circuit with cheap checks first —
filesize(instant), then magic bytes (nearly instant), then strings (cheap), then modules (expensive).Metadata is documentation — Future you (and your team) need to know what this catches, why, and where the sample came from.
When to Use
- Writing new YARA-X rules for malware detection
- Reviewing existing rules for quality or performance issues
- Optimizing slow-running rulesets
- Converting IOCs or threat intel into detection signatures
- Debugging false positive issues
- Preparing rules for production deployment
- Migrating legacy YARA rules to YARA-X
- Analyzing Chrome extensions (crx module) or Android apps (dex module)
When NOT to Use
- Static analysis requiring disassembly → use Ghidra/IDA skills
- Dynamic malware analysis → use sandbox analysis skills
- Network-based detection → use Suricata/Snort skills
- Memory forensics with Volatility → use memory forensics skills
- Simple hash-based detection → just use hash lists
Platform Considerations
YARA works on any file type. Adapt patterns to your target:
| Platform | Magic Bytes | Bad Strings | Good Strings |
|---|---|---|---|
| Windows PE | uint16(0) == 0x5A4D |
API names, Windows paths | Mutex names, PDB paths |
| macOS Mach-O | uint32(0) == 0xFEEDFACE (32-bit), 0xFEEDFACF (64-bit), uint32be(0) == 0xCAFEBABE (universal) |
Common Obj-C methods | Keylogger strings, persistence paths |
| JavaScript/Node | (none needed) | require, fetch, axios |
Obfuscator signatures, eval+decode chains |
| npm/pip packages | (none needed) | postinstall, dependencies |
Suspicious package names, exfil URLs |
| Office docs | uint32(0) == 0x04034B50 |
VBA keywords | Macro auto-exec, encoded payloads |
| VS Code extensions | (none needed) | vscode.workspace |
Uncommon activationEvents, hidden file access |
| Chrome extensions | Use crx module |
Common Chrome APIs | Permission abuse, manifest anomalies |
| Android apps | Use dex module |
Standard DEX structure | Obfuscated classes, suspicious permissions |
uintNN()reads little-endian. Write the constant as the bytes reversed, or useuintNNbe()and write them in file order. A ZIP/OOXML file starts with bytes50 4B 03 04, so it isuint32(0) == 0x04034B50—uint32(0) == 0x504B0304compiles cleanly and never matches anything. The same trap catches Mach-O universal binaries: on disk they areCA FE BA BE, souint32(0) == 0xCAFEBABEis a dead branch; writeuint32be(0) == 0xCAFEBABEoruint32(0) == 0xBEBAFECA. Verify withyr scanagainst one known-good sample before trusting any magic-byte check.
macOS Malware Detection
No dedicated Mach-O module exists yet — use magic bytes plus string patterns. Good indicators:
- Keylogger artifacts:
CGEventTapCreate,kCGEventKeyDown - SSH tunnel strings:
ssh -D,tunnel,socks - Persistence paths:
~/Library/LaunchAgents, `/Library/Lau
자주 묻는 질문
문자열 선택이 왜 중요한가요?
짧거나 반복되는 문자열은 많은 파일을 검사할 때 속도를 떨어뜨립니다. 그래서 이 스킬은 더 구별되는 문자열을 고르도록 안내합니다.
사용하기 전에 규칙을 테스트해야 하나요?
네. 배포 전에 정상 소프트웨어를 대상으로 규칙을 테스트하라고 스킬에서 안내합니다.
YARA-X는 어떻게 설치하나요?
스킬에서는 Homebrew나 Cargo로 설치하는 방법을 언급합니다. 명령줄 도구의 이름은 yr입니다.
상세 정보
작성자의 원본 설명
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.
repo: trailofbits/skills
인기도
- GitHub 스타
- 8.0k
- 순위
- #12742
- 라이선스
- CC-BY-SA-4.0
- 업데이트
- 2026. 11. 2.
댓글
- …
이 저장소의 다른 스킬
audit-context-building
8.0k에이전트가 보안 검토 전에 낯선 코드베이스를 익히고, 각 함수가 가정하고 보장하며 의존하는 것을 정리하도록 돕습니다.
algorand-vulnerability-scanner
8.0k에이전트가 TEAL이나 PyTeal 기반 Algorand 스마트 계약에서 키 재설정 공격, 수수료 미검증 등 보안 문제 11가지를 찾도록 돕습니다.
audit-prep-assistant
8.0k에이전트가 외부 보안 검토를 위해 코드베이스를 준비하도록 돕습니다. 정적 분석, 테스트 커버리지, 죽은 코드 정리, 명확한 문서화를 포함합니다.
cairo-vulnerability-scanner
8.0k에이전트가 StarkNet Cairo 스마트 계약에서 오버플로, 위험한 계층 간 메시지, 서명 재사용 등 6가지 문제를 검사하도록 돕습니다.