Iced
The attacker used a legitimate Windows binary to drop malicious code — living off the land. Then layered obfuscation on top to make it harder to detect. Goal: find the payload, strip the obfuscation, recover the flag.
Full Investigation
Finding the suspicious file
Browsed the disk image manually. One directory stood out immediately:
This path is not where user files belong. It gets abused by malware to stash scripts or downloaded content. Inside was a file that looked nothing like a normal system file.
Extracting readable content
Ran strings * on the directory to pull readable text from the binary. Out came a long, heavily obfuscated PowerShell command. Random-looking at first glance — but several patterns were immediately recognizable:
- String formatting with numbered placeholders (
-foperator) to reconstruct the command from fragments - Junk token
Cvxinserted everywhere to break pattern matching - Character encoding tricks using
[Char]casts - Indirect execution via
Invoke-Expression(IEX)
Removing the junk token
Near the end of the script was this:
So Cvx was being substituted with a single quote at runtime — it was pure noise added to frustrate static analysis. Strip it, and the real command structure becomes visible.
Evaluating the safe parts
Instead of running the whole thing (obviously bad), I only evaluated the string formatting and replacement sections in PowerShell. This revealed the real inner structure:
Classic. Base64-encoded payload, decoded at runtime and executed. The encoded string itself was split using + symbols to make it harder to copy-paste.
Extracting and cleaning the Base64
Joined the fragments, then applied one more replacement the script used:
That translates to: replace jYO with a double quote. After applying it, the final Base64 payload was clean:
Decoding — flag recovered
Decoded the Base64 string. Result: