Skip to content
WETNav

Defense evasionMedium

PowerShell downgrade

Also known as PowerShell version 2 downgrade, Engine downgrade

Forcing PowerShell 2.0, which has no script block logging, to evade modern logging. Windows PowerShell 400 records EngineVersion 2.0.

Signals in the logs

  1. 01Windows PowerShell400Engine state changed to Available (engine start)Any host

    A PowerShell engine started on the 2.0 engine.

    EngineVersion
    2.0 (shown in the event detail)
    HostApplication
    command line of the host, often powershell.exe -version 2
  2. 02Security4688A new process has been createdAny host

    powershell.exe launched with an explicit version 2 argument.

    NewProcessName
    C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
    CommandLine
    powershell.exe -version 2 / -v 2

What happens

PowerShell 5.x records the de-obfuscated code it runs through script block logging (4104) and module logging (4103). Those features do not exist in the PowerShell 2.0 engine, so an operator who can start PowerShell with -Version 2 drops back to an engine that leaves almost no trace of what it executed. The downgrade works only if the 2.0 engine is actually present, which requires the Windows PowerShell 2.0 optional feature and a compatible .NET runtime. The tell is that every PowerShell host logs the engine it loaded: the classic Windows PowerShell log writes event 400 at engine start, and its detail carries EngineVersion. A 400 with EngineVersion 2.0 on a modern system is the signature of a downgrade, since nothing legitimate on current Windows should be loading that engine.

Logging you need

  • The classic Windows PowerShell log is enabled by default and records event 400 for every engine start, so the EngineVersion is captured without extra policy.
  • Script block logging (4104) will be absent for the downgraded session; its absence combined with a v2 engine is the point.
  • Catching the launch argument needs Security 4688 with command-line auditing, or Sysmon 1.

Hunt queries

Starting points. Tune thresholds and exclusions to your environment before alerting on them.

Get-WinEvent -FilterHashtable @{LogName='Windows PowerShell'; Id=400} |
  Where-Object { $_.Message -match 'EngineVersion=2\.' }

Benign look-alikes

  • Legacy line-of-business applications that genuinely require the PowerShell 2.0 engine.
  • Old administrative scripts pinned to -Version 2 for compatibility.
  • Software installers that shell out to a specific engine version.

Notes

  • Removing the Windows PowerShell 2.0 optional feature closes the downgrade entirely and is the strongest control.
  • If the 2.0 engine is not installed, the -version 2 launch fails, so a cluster of failed PowerShell starts can also indicate attempts.

References