Sysmon: from Word to PowerShell
On an accounting employee's workstation, EDR triggered an alert: after opening a Word document, the device connected to an external server. The analyst exported the Microsoft-Windows-Sysmon/Operational channel to sysmon.xml (root <Events>). The file contains Sysmon Event 1 (ProcessCreate), 3 (NetworkConnect), 11 (FileCreate), and 13 (RegistryEvent) events; processes are linked via ProcessGuid / ParentProcessGuid.
A lot happened on the workstation in one day: SCCM and inventory agents run benign scripts with powershell -EncodedCommand, and an internal phishing simulation was also conducted to train employees. Isolate the real attack: find the PowerShell process spawned from WINWORD.EXE that connected to a public (external) IP address.
Its -Enc argument contains a multi-layer loader: the next stage that PowerShell itself decodes and executes. Unwrap the layers sequentially with Python without executing them. The final script produces the value the attacker used as 'id' — that is the flag. Flag format: BAYROQ{...} (the last 16 characters are lowercase hexadecimal digits).