Encoded PowerShell From an Office File: How to Read the Alert

Word opens a "vendor statement," then cmd, then a hidden, encoded PowerShell command that downloads a script. Here's how to read the chain, and the step that separates a good analyst from a great one.

When an Office app spawns encoded PowerShell, decode the command, check whether its download succeeded, and then hunt the whole fleet for the same parent-child chain. Legitimate Word documents almost never launch hidden, encoded PowerShell. And phishing campaigns rarely hit just one person.

The case: a macro-enabled "vendor statement"

From the free Cyber Blues Entry track. EDR flags this chain on a sales workstation:

  1. WINWORD.EXE opens "Q3_Vendor_Statement.docm"
  2. which starts cmd.exe
  3. which starts powershell.exe -nop -w hidden -enc …

The decoded command downloads and runs a script from an outside domain made to look like an invoicing service.

  • The document arrived by email from a sender spoofing a known vendor. The user clicked "Enable content."
  • The proxy allowed the download. The script was retrieved.
  • Whether anything ran or dropped afterward hasn't been traced yet.
  • The same email went to 9 other mailboxes in Sales and Accounts Payable this morning.
  • Nobody has searched other machines for the same chain yet.

Reading the command line

Each flag is a tell:

FlagMeaningWhy it matters
-nopNo profileSkips the user's settings, common in attack tooling
-w hiddenHidden windowThe user sees nothing
-encBase64-encoded commandHides what it does from a quick look

None is malicious alone. Together, launched by Word, they're a strong signal.

Step one: decode it

Don't escalate "encoded PowerShell" without saying what it does. Decoding turns a vague alert into a specific fact: it downloads and runs a script from this domain. That tells you what to look for next.

Step two: did it work?

A blocked download with nothing afterward is largely contained. An allowed download is active. Here the proxy let it through, so the host needs isolation and a look at what the script did, per your runbook.

Step three: the fleet

This is the step most junior answers miss. Ten people got the email. Fixing one laptop while nine others may have run the same macro is how one infection becomes ten. Search every endpoint for Word or Excel spawning PowerShell this morning, and check the email gateway for who opened the attachment.

Three traps

  • Not decoding the command. You can't scope what you haven't read.
  • Remediating one host. Phishing campaigns are rarely one-host events.
  • Assuming "blocked" everywhere. One block doesn't mean no other host succeeded.

What would a hiring manager ask?

  • "Walk me through this process tree."
  • "What do -nop, -w hidden and -enc tell you?"
  • "How do you find out what the encoded command does?"
  • "The download was allowed. What changes?"
  • "Who else might be affected, and how do you find them?"

Practice it free

This case is in the free Cyber Blues Entry courses, with coaching on your reasoning at every step.

Start the free Entry courses →

FAQ

Why do attackers use encoded PowerShell?

Base64 encoding hides the command from casual inspection and some simple detections, and avoids quoting problems in long commands.

Is Office spawning PowerShell always malicious?

Not always, since some admin macros do it, but it's rare in normal work. Hidden, encoded PowerShell launched from a document opened from email should be treated as malicious until proven otherwise.

How do you decode a PowerShell -enc command?

The value is Base64 of UTF-16LE text. Decode it in a sandbox or with your EDR's built-in decoder. Never run it to find out what it does.