Advent of Cyber 2025 Day 18
๐งฉ Day 18 – Obfuscation & Deobfuscation Explained (TryHackMe)
Introduction
Since the wormhole appeared in WareVille, systems have been misbehaving, dashboards spiked, and SOC alerts continuously fired. Amid this chaos, McSkidy spotted a suspicious email claiming to be from northpole-hr.
The problem? There is no HR department at the North Pole — TBFC’s HR operates from the South Pole.
A small PowerShell script was attached to the email. The script contained random-looking, unreadable characters — a classic case of obfuscation.
This challenge explores what obfuscation is, why attackers use it, and how to safely reverse it using tools like CyberChef.
๐ฏ Learning Objectives
By completing this task, you will learn:
-
What obfuscation is and why attackers use it
-
The difference between encoding, encryption, and obfuscation
-
Common obfuscation techniques
-
How to safely recover plaintext using CyberChef
-
Real-world PowerShell malware analysis
๐ What Is Obfuscation?
Obfuscation is the process of making code or data difficult to read or analyze without changing its functionality.
Why Attackers Use It
-
Evade detection by security tools
-
Delay incident response
-
Hide malicious intent
Simple Example – ROT Cipher
If a security tool blocks the word carrot, attackers might use ROT1:
Becomes →
ROT1 shifts each letter by one. ROT13 is another common variant, shifting letters by 13 positions.
๐ Real-World Obfuscation Techniques
Modern malware uses more advanced methods:
XOR Obfuscation
-
Converts each character into bytes
-
Combines bytes with a key using XOR logic
-
Produces unreadable symbols
-
Difficult to reverse manually
CyberChef is particularly useful for safely reversing these transformations.
๐งช Obfuscating Text Using XOR in CyberChef
Steps:
-
Open CyberChef
-
Paste
carrot supremacyinto the Input box -
Search for XOR under Operations
-
Drag XOR into the Recipe area
-
Set Key = a and choose HEX
-
Click BAKE!
Output:
๐ Detecting Obfuscation Patterns
| Technique | How It Appears |
|---|---|
| ROT1 | Letters “shifted” by one; spaces unchanged |
| ROT13 | Common words replaced (the → gur, and → naq) |
| Base64 | Long alphanumeric strings, often ending with = |
| XOR | Random symbols, same length as original |
Once identified, apply the reverse operation in CyberChef.
๐ช When You Don’t Know the Technique
Use CyberChef’s Magic operation:
-
Automatically tries common decoders
-
Displays multiple readable outputs
-
Intensive Mode improves accuracy
Magic may not solve everything but gives strong hints.
๐งฑ Layered Obfuscation
Attackers often stack techniques. Example:
-
Gzip compression
-
XOR with a key
-
Base64 encoding
Reversal:
-
Decode from Base64
-
XOR with key
-
Gunzip
CyberChef allows chaining multiple operations easily.
๐ฃ Hands-On: Analyzing SantaStealer.ps1
McSkidy extracted a suspicious PowerShell script and analyzed it in a safe VM:
Steps:
-
Open the script in Visual Studio or a text editor
-
Follow inline comments
-
Save and run the script in PowerShell
๐ Flags Captured
-
C2 URL Deobfuscation
-
API Key Obfuscation
Successfully understanding these techniques confirmed proper use of obfuscation and deobfuscation.
✅ Final Thoughts
This room demonstrates:
-
How attackers hide malicious code
-
Why obfuscation is not encryption
-
How defenders safely analyze malware
-
The power of CyberChef in SOC investigations
For deeper learning, TryHackMe’s Obfuscation Principles room is highly recommended.



Comments
Post a Comment