Neo23x0 / Raccine

A Simple Ransomware Vaccine
The Unlicense
942 stars 123 forks source link

Patch PowerShell downgrade attacks (bypassing the newer security features) #33

Closed Omodaka9375 closed 3 years ago

Omodaka9375 commented 3 years ago

When forcing PowerShell to run using its PowerShell 2.0 engine (read: downgrade), none of the advanced security features (such as transcription) are available, since the older .NET Framework v2.0 is loaded.

All machines running Windows 7 and above will have at least PowerShell 2.0.

How to check if the old engine is enabled:

Get-WindowsOptionalFeature -Online | Where-Object {$_.FeatureName -match "PowerShellv2"}

Output: Capture

Up until now, these were the only ways of disabling PowerShell V2 engine:

- Remove the PowerShell 2.0 Engine from the OS (including image) completely or
- Apply application blacklisting (using AppLocker) to deny access to PowerShell 2.0 Engine specific .NET assemblies.

To remove the PowerShell 2.0 Engine from the OS (including image) we could use:

Disable-WindowsOptionalFeature –Online -FeatureName MicrosoftWindowsPowerShellV2Root,MicrosoftWindowsPowerShellV2 –Remove

Or even better Raccine way: patch -version, /version argument

Downgrade attempt example:

powershell.exe -Version 2.0 -Command {<scriptblock>} -ExecutionPolicy <ExecutionPolicy>