0Pricing
Reverse Engineering & Binary Analysis Basics · Lesson

Indicators of Compromise & YARA Rules

Turn malware analysis findings into reusable detection: extract indicators of compromise and write YARA rules to identify related samples.

Indicators of Compromise & YARA Rules is a free Reverse Engineering & Binary Analysis Basics lesson on CoddyKit — lesson 4 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Reverse Engineering & Binary Analysis Basics learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

From Analysis to Detection

You can classify malware types, perform basic behavioral analysis, and unpack samples. The payoff is detection: converting what you learned into signals that catch the same threat elsewhere.

What Is an IOC?

An Indicator of Compromise (IOC) is an observable artifact that suggests an intrusion.

  • File hashes (MD5, SHA-256)
  • Domains and IP addresses
  • Registry keys, mutexes, file paths

Hashes: Precise but Brittle

A SHA-256 hash uniquely fingerprints one file. But changing a single byte changes the hash, so attackers evade hash-only detection easily.

That is why we need more resilient indicators.

sha256sum sample.exe
# 9f86d0818...  sample.exe

Fuzzy and Behavioral IOCs

More robust indicators survive minor changes:

  • A unique mutex name the malware creates
  • A hardcoded user-agent string
  • A characteristic command-and-control URL pattern

These catch whole families, not just one sample.

Introducing YARA

YARA is a pattern-matching tool that describes malware via rules. Each rule has metadata, strings, and a condition.

YARA scans files or memory and reports matches, making your findings reusable.

Anatomy of a YARA Rule

A rule has three sections: meta for documentation, strings for patterns, and condition for the matching logic.

rule Example_Trojan {
  meta:
    author = 'analyst'
    desc = 'Detects sample family X'
  strings:
    $a = 'evil-c2.example.com'
    $b = { 6A 40 68 00 30 00 00 }
  condition:
    $a or $b
}

Text vs Hex Strings

YARA matches both text strings (with modifiers like nocase, wide) and hex byte sequences.

Hex patterns with wildcards (??) catch code that varies slightly.

strings:
  $ua = 'Mozilla/4.0 (compatible; Evil)' wide nocase
  $stub = { E8 ?? ?? ?? ?? 83 C4 04 }

Writing Good Conditions

Conditions combine strings with logic and counts.

  • all of them requires every string
  • 2 of ($a, $b, $c) needs at least two
  • Add filesize or PE checks to reduce false positives
condition:
  uint16(0) == 0x5A4D and 2 of ($s*)

Avoiding False Positives

A rule that matches common library strings will fire on innocent files. Choose strings that are unique to the malware, and test against a clean goodware set.

Tight conditions keep analysts trusting your rules.

Sharing Detection

IOCs and YARA rules are shareable threat intelligence. Distribute them via formats like STIX or simple rule files so other defenders benefit.

This is how one analysis protects an entire community.

yara -r my_rules.yar /samples/

Hunting with Rules

Beyond scanning one file, you can sweep a whole estate. Recursively scan endpoints or even live memory to find every machine matching the family.

This turns a single analysis into proactive threat hunting.

yara -r -p 8 trojan.yar /mnt/hosts/ > hits.txt

Quick Check

Why is a SHA-256 hash a brittle indicator of compromise on its own?

Recap

You now operationalize malware analysis:

  • Extract IOCs: hashes, domains, mutexes, behaviors
  • Prefer resilient indicators over brittle hashes
  • Write YARA rules with meta, strings, and tight conditions
  • Test against goodware and share as threat intel

Frequently asked questions

Is the “Indicators of Compromise & YARA Rules” lesson free?

Yes — the full text of “Indicators of Compromise & YARA Rules” is free to read here on the web, and the Reverse Engineering & Binary Analysis Basics course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Reverse Engineering & Binary Analysis Basics course, upgrade to CoddyKit PRO.

What will I learn in “Indicators of Compromise & YARA Rules”?

Turn malware analysis findings into reusable detection: extract indicators of compromise and write YARA rules to identify related samples. You practise Reverse Engineering & Binary Analysis Basics with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Reverse Engineering & Binary Analysis Basics?

No prior experience is required. Reverse Engineering & Binary Analysis Basics on CoddyKit is structured for beginners through advanced learners; this is — lesson 4 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Indicators of Compromise & YARA Rules” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Reverse Engineering & Binary Analysis Basics lesson?

Yes. Every Reverse Engineering & Binary Analysis Basics lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. Types of Malware and Their Behavior
  2. Basic Behavioral Analysis
  3. Introduction to Malware Unpacking
  4. Indicators of Compromise & YARA Rules
← Back to Reverse Engineering & Binary Analysis Basics