The blog of dlaa.me
Archive: October, 2014
  • Not another POODLE pun [Batch script to disable SSL 3.0 on Windows servers - including virtual machines and Azure cloud services]
    Wednesday, October 29th 2014

    Much has been penned (and punned) recently about POODLE, the "Padding Oracle On Downgraded Legacy Encryption" security vulnerability. If you're not familiar with it, the Wikipedia entry for POODLE is a good start and Troy Hunt's POODLE treatise provides more detail.

    Assuming you've made the decision to disable SSL 3.0 to mitigate POODLE attacks, this Azure Blog post includes a two-part batch/PowerShell script to do that. Based on the information in KB245030, that script can be run on a bare OS, a VM, or as part of an Azure cloud service.

    It's a fine script as scripts go [ :) ], but maybe you're not a PowerShell fanatic or maybe you'd prefer a single file and/or less code to audit. If so, I present the following batch-only script for your consideration:

    @echo off
    setlocal
    set REBOOT=N
    set LOG=%~d0\DisableSslv3.log
    set SSLKEY=HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 3.0
    
    call :MAIN >> %LOG% 2>&1
    
    goto :EOF
    
    
    :MAIN
    
    REM Show current SSL 3.0 configuration
    reg.exe query "%SSLKEY%" /s
    
    REM Check current SSL 3.0 configuration
    for /f "tokens=3" %%v in ('reg.exe query "%SSLKEY%\Server" /v Enabled') do (
        if NOT "0x0"=="%%v" set REBOOT=Y
    )
    if ERRORLEVEL 1 set REBOOT=Y
    for /f "tokens=3" %%v in ('reg.exe query "%SSLKEY%\Client" /v DisabledByDefault') do (
        if NOT "0x1"=="%%v" set REBOOT=Y
    )
    if ERRORLEVEL 1 set REBOOT=Y
    
    REM Update and reboot if necessary
    if "%REBOOT%"=="Y" (
        echo Update needed to disable SSL 3.0.
        reg.exe add "%SSLKEY%\Server" /v Enabled /t REG_DWORD /d 0 /f
        reg.exe add "%SSLKEY%\Client" /v DisabledByDefault /t REG_DWORD /d 1 /f
        echo Rebooting to apply changes...
        shutdown.exe /r /c "Rebooting to disable SSL 3.0" /f /d p:2:4
    ) else (
        echo SSL 3.0 already disabled.
    )
    
    goto :EOF
    

    Notes:

    • This is a riff on the aforementioned script, meant to serve as a jumping-off point and alternate approach.
    • Like the original script, this one is idempotent and can be safely run multiple times (for example, every startup) on a bare OS, VM, or cloud service. The log file is additive, so you can see if it ever made changes.
    • Security Advisory 3009008 only mentions disabling SSL 3.0 for server scenarios; this script also disables it for client scenarios to protect outgoing connections to machines that have not been secured.
    • I work almost exclusively with recent OS releases on Azure; SSL 2.0 is already disabled there, so this script leaves those settings alone. André Klingsheim's post on hardening Windows Server provides more context.
    • An immediate reboot is performed whenever changes are made - consider commenting that line out during testing. :)
    • While reviewing this post, I found a discussion of related techniques on Server Fault which may also be of interest.

    Whatever you do to address the POODLE vulnerability, be sure to check your work, perhaps with one of the following oft-recommended resources:

    Tags: Technical Web