Windows PowerShell XML Document Load Used for Execution

Flags PowerShell script blocks that use XML document loading combined with expression/command execution keywords.

FreeReviewedSigma · Medium · v2
Product
windows
Category
ps_script
Author
frack113 (SigmaHQ), DRL 1.1
Published
2022-01-19
Updated
2026-07-31
title: Windows PowerShell XML Document Load Used for Execution
id: f4ff29b8-78de-45af-ad76-e17590be984a
status: test
description: This rule flags PowerShell script block content that creates a System.Xml.XmlDocument and calls .Load, indicating XML parsing/loading from within PowerShell. It also looks for common PowerShell execution patterns such as IEX (Invoke-Expression), Invoke-Command, or ICM (-), which can be used to run attacker-controlled content. The detection relies on ScriptBlockText telemetry from PowerShell script block logging to match the relevant command and method strings.
references:
  - https://github.com/redcanaryco/atomic-red-team/blob/f339e7da7d05f6057fdfcdd3742bfcf365fee2a9/atomics/T1059.001/T1059.001.md#atomic-test-8---powershell-xml-requests
  - https://github.com/SigmaHQ/sigma/blob/master/rules/windows/powershell/powershell_script/posh_ps_xml_iex.yml
author: frack113, Huntrule Team
date: 2022-01-19
modified: 2023-01-19
tags:
  - attack.execution
  - attack.t1059.001
logsource:
  product: windows
  category: ps_script
  definition: "Requirements: Script Block Logging must be enabled"
detection:
  selection_xml:
    ScriptBlockText|contains|all:
      - New-Object
      - System.Xml.XmlDocument
      - .Load
  selection_exec:
    ScriptBlockText|contains:
      - "IEX "
      - "Invoke-Expression "
      - "Invoke-Command "
      - ICM -
  condition: all of selection_*
falsepositives:
  - Legitimate administrative script
level: medium
license: DRL-1.1
related:
  - id: 6c6c6282-7671-4fe9-a0ce-a2dcebdc342b
    type: derived