Indicatori di compromissione e regole YARA
Trasformate i risultati dell’analisi del malware in rilevamenti riutilizzabili: estraete gli indicatori di compromissione e scrivete regole YARA per identificare campioni correlati.
Indicatori di compromissione e regole YARA è una lezione Reverse Engineering & Binary Analysis Basics gratuita su CoddyKit. Questa è la lezione 4 di 4. Puoi leggere la lezione completa qui gratuitamente — poi esercitati direttamente nel browser con un editor di codice integrato e un tutor IA disponibile 24/7. Fa parte del percorso di apprendimento Reverse Engineering & Binary Analysis Basics, e i tuoi progressi si sincronizzano tra il web e l'app CoddyKit. Il corso Reverse Engineering & Binary Analysis Basics include 4 lezioni in totale.
Parti di questa lezione non sono ancora state tradotte e vengono mostrate in inglese.
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.exeFuzzy 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 themrequires every string2 of ($a, $b, $c)needs at least two- Add
filesizeor 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.txtQuick 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
Domande Frequenti
La lezione «Indicatori di compromissione e regole YARA» è gratuita?
Sì — il testo completo di «Indicatori di compromissione e regole YARA» è gratuito qui sul web. Per esercitarvi in modo interattivo (un editor di codice integrato e un tutor IA 24/7) e sbloccare il resto del corso Reverse Engineering & Binary Analysis Basics, passa a CoddyKit PRO. Il corso Reverse Engineering & Binary Analysis Basics include 4 lezioni in totale.
Cosa imparerò in «Indicatori di compromissione e regole YARA»?
Trasformate i risultati dell’analisi del malware in rilevamenti riutilizzabili: estraete gli indicatori di compromissione e scrivete regole YARA per identificare campioni correlati. Eserciti Reverse Engineering & Binary Analysis Basics con codice pratico che esegui direttamente nel browser, e un tutor IA 24/7 risponde alle tue domande mentre lavori sulla lezione.
Ho bisogno di esperienza per iniziare Reverse Engineering & Binary Analysis Basics?
Non è richiesta alcuna esperienza precedente. Reverse Engineering & Binary Analysis Basics su CoddyKit è strutturato per principianti e studenti avanzati, quindi puoi iniziare da qui o dall'inizio e procedere al tuo ritmo. Questa è la lezione 4 di 4.
Quanto tempo richiede la lezione «Indicatori di compromissione e regole YARA»?
La maggior parte delle lezioni CoddyKit richiede circa 5–10 minuti. Ogni lezione è breve e interattiva, quindi fai progressi costanti e riprendi esattamente da dove hai lasciato su web e app.
Posso scrivere ed eseguire codice in questa lezione Reverse Engineering & Binary Analysis Basics?
Sì. Ogni lezione Reverse Engineering & Binary Analysis Basics include un editor di codice integrato, quindi scrivi ed esegui codice reale direttamente nel tuo browser e ricevi feedback istantaneo dall'IA — nessuna configurazione locale necessaria.
Tutte le lezioni di questo corso
- Tipi di malware e relativo comportamento
- Analisi comportamentale di base
- Introduzione all'unpacking dei malware
- Indicatori di compromissione e regole YARA