Advent of Cyber 2025 - Day 13
🔍 Decoding McSkidy’s Message with YARA
Advent of Cyber 2025 – Day 13
Introduction
When McSkidy went missing, chaos spread across The Best Festival Company (TBFC). Yet even in her absence, she found a way to help the blue team. From an anonymous location, she sent a folder of seemingly innocent Easter images. Hidden within these images was a secret message — one that could only be uncovered using the right tool: YARA.
In this challenge, defenders were tasked with creating a YARA rule to:
-
Scan a directory of images
-
Detect hidden keywords
-
Extract encoded codewords
-
Decode McSkidy’s message
🎯 Learning Objectives
By completing this task, you will learn to:
-
Understand what YARA is and why it’s used
-
Recognize scenarios where defenders rely on YARA rules
-
Explore different types of YARA strings
-
Write effective YARA rules
-
Detect malicious indicators in real-world scenarios
What Is YARA?
YARA is a pattern-matching tool used by cybersecurity professionals to identify and classify malware. Unlike relying on filenames or file hashes, YARA scans files, memory, and directories for unique patterns or digital fingerprints left by attackers.
Think of YARA as a detective’s notebook for cyber defenders:
-
Instead of fingerprints, it looks for strings and byte patterns
-
Instead of suspects, it identifies malware families
-
Instead of guesses, it uses logical conditions
Within TBFC, YARA acts as a silent guardian, searching systems for threats that try to hide in plain sight.
Why YARA Matters
Attackers often disguise malware as images, documents, or harmless executables. YARA allows defenders to hunt threats based on behavior and patterns, not just known filenames.
Common Use Cases:
-
Post-incident analysis: searching for leftover traces
-
Threat hunting: scanning endpoints for malware families
-
Intelligence-driven scans: using community-shared rules
-
Memory analysis: detecting malicious code in running processes
Core Benefits of YARA:
-
Speed: scan thousands of files quickly
-
Flexibility: match text, hex, and regex patterns
-
Control: define what “malicious” means
-
Shareability: reuse rules across teams
-
Visibility: connect scattered clues into a full attack story
Anatomy of a YARA Rule
A typical YARA rule consists of three main parts:
-
Metadata – Provides context about the rule (author, description, date)
-
Strings – The indicators YARA searches for (text, hex, regex)
-
Condition – Defines when the rule triggers
Example Rule:
Understanding YARA Strings
-
Text strings: simple keyword matching (
nocasefor case-insensitive,asciiorwidefor encoding) -
Hexadecimal strings: detect raw byte patterns like executable headers (
{ 4D 5A }) -
Regular expressions: flexible patterns such as URLs or encoded commands (
/http:\/\/.*malhare.*/ nocase)
Conditions control the logic of the rule:
-
any of them→ match any string -
all of them→ match all strings -
Logical combinations → e.g.,
($s1 or $s2) and not $benign -
File properties → e.g.,
filesize < 700KB
Practical Scenario: Detecting IcedID
TBFC analysts identified a lightweight IcedID loader with a common MZ header.
YARA Rule Example:
Command Used:
Final Challenge: Decoding McSkidy’s Message
Directory to scan: /home/ubuntu/Downloads/easter
Detection criteria: strings starting with TBFC:
Regex pattern used:
Results:
-
Images containing TBFC strings: 5
-
Decoded message:
Conclusion
This challenge demonstrates that YARA is more than a malware detection tool — it is a forensic and investigative powerhouse. By combining pattern matching, logical conditions, and creativity, defenders can uncover hidden messages even when attackers disguise them inside ordinary files.
McSkidy left the clues. YARA revealed the truth.
Next stop: HopSec Island 🏝️



Comments
Post a Comment