-
Notifications
You must be signed in to change notification settings - Fork 0
/
EnableCertPaddingCheck-CVE-2013-3900.ps1
47 lines (42 loc) · 2.45 KB
/
EnableCertPaddingCheck-CVE-2013-3900.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#=============================================================================================================================
#
# Script Name: EnableCertPaddingCheck.ps1
# Description: CVE-2013-3900 mitigation
# https://msrc.microsoft.com/update-guide/vulnerability/CVE-2013-3900
# Author: Danny Chrismas - TheAutisticTechie
#
#=============================================================================================================================
$ErrorActionPreference = 'SilentlyContinue'
$regKey32 = test-path -path "hklm:\Software\Microsoft\Cryptography\Wintrust\Config\"
$regKey64 = test-path -path "hklm:\Software\Wow6432Node\Microsoft\Cryptography\Wintrust\Config\"
$regValue32 = (Get-ItemProperty -Path hklm:\Software\Microsoft\Cryptography\Wintrust\Config\).EnableCertPaddingCheck
$regValue64 = (Get-ItemProperty -Path hklm:\Software\Wow6432Node\Microsoft\Cryptography\Wintrust\Config\).EnableCertPaddingCheck
$ErrorActionPreference = 'stop'
try {
if((!$regKey32) -and (!$regValue32)) {
Write-Host "Creating 32-bit reg keys"
New-Item -Path Registry::HKEY_LOCAL_MACHINE\software\Microsoft\Cryptography\Wintrust\
New-Item -Path Registry::HKEY_LOCAL_MACHINE\software\Microsoft\Cryptography\Wintrust\Config\
New-ItemProperty -Path Registry::HKEY_LOCAL_MACHINE\software\Microsoft\Cryptography\Wintrust\Config\ -Name EnableCertPaddingCheck -Value 1
}
if((!$regKey64) -and (!$regValue64)) {
Write-Host "Creating 64-bit reg keys"
New-Item -Path Registry::HKEY_LOCAL_MACHINE\software\Wow6432Node\Microsoft\Cryptography\Wintrust\
New-Item -Path Registry::HKEY_LOCAL_MACHINE\software\Wow6432Node\Microsoft\Cryptography\Wintrust\Config\
New-ItemProperty -Path Registry::HKEY_LOCAL_MACHINE\software\Wow6432Node\Microsoft\Cryptography\Wintrust\Config\ -Name EnableCertPaddingCheck -Value 1
}
if($regValue32 -ne 1) {
Write-Host "Correcting 32-bit registry value to 1"
Set-ItemProperty -Path Registry::HKEY_LOCAL_MACHINE\software\Microsoft\Cryptography\Wintrust\Config\ -Name EnableCertPaddingCheck -Value 1
}
if($regValue64 -ne 1) {
Write-Host "Correcting 64-bit registry value to 1"
Set-ItemProperty -Path Registry::HKEY_LOCAL_MACHINE\software\Wow6432Node\Microsoft\Cryptography\Wintrust\Config\ -Name EnableCertPaddingCheck -Value 1
}
exit 0
}
catch {
$errMsg = $_.Exception.Message
Write-Error $errMsg
exit 1
}