
Script PowerShell per rimediare a CVE-2013-3900 abilitando il controllo del padding dei certificati tramite hardening del registro su sistemi Windows.
# Script di remediation per CVE-2013-3900
# Definisce i percorsi del Registro per le configurazioni a 32 bit e a 64 bit
$regPaths = @(
"HKLM:\Software\Microsoft\Cryptography\Wintrust\Config",
"HKLM:\Software\Wow6432Node\Microsoft\Cryptography\Wintrust\Config"
)
# Funzione che aggiunge o aggiorna la chiave del Registro
function Set-EnableCertPaddingCheck {
param (
[string]$path
)
if (!(Test-Path $path)) {
New-Item -Path $path -Force | Out-Null
}
Set-ItemProperty -Path $path -Name "EnableCertPaddingCheck" -Value 1 -Type DWord
}
# Applica la correzione a entrambi i percorsi del Registro
foreach ($path in $regPaths) {
Set-EnableCertPaddingCheck -path $path
}
# Conferma delle modifiche
Write-Host "Registry keys updated successfully!" -ForegroundColor Green
# Verifica delle modifiche
foreach ($path in $regPaths) {
$value = Get-ItemProperty -Path $path | Select-Object -ExpandProperty EnableCertPaddingCheck -ErrorAction SilentlyContinue
if ($value -eq 1) {
Write-Host "Verification successful for $path: EnableCertPaddingCheck = 1" -ForegroundColor Green
} else {
Write-Host "Verification failed for $path!" -ForegroundColor Red
}
}
# Riavvia il sistema per applicare le modifiche
Write-Host "Restarting system in 10 seconds to apply changes..." -ForegroundColor Yellow
Start-Sleep -Seconds 10
Restart-Computer -Force