Skip to content

Instantly share code, notes, and snippets.

@tathamoddie
Forked from jstangroome/gist:621345
Created October 11, 2010 22:35
Show Gist options
  • Save tathamoddie/621348 to your computer and use it in GitHub Desktop.
Save tathamoddie/621348 to your computer and use it in GitHub Desktop.
PowerShell script to test if ASP.NET padding security patch is applied
Set-StrictMode -Version Latest
[Reflection.Assembly]::Load('System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a') | Out-Null
$PatchedMethod = [System.Web.Configuration.MachineKeySection].GetMethods('NonPublic, Public, Static') |
Where-Object {
$LastParameter = $_.GetParameters() | Select-Object -Last 1
$_.Name -eq 'EncryptOrDecryptData' -and
$LastParameter -ne $null -and
$LastParameter.ParameterType -eq [bool] -and
$LastParameter.Name -eq 'signData'
}
if ($PatchedMethod) {
"POET patch is applied."
} else {
Write-Warning "POET patch is NOT applied."
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment