EC2 Windows Server 2022 で脆弱な暗号化アルゴリズムを無効化してみた

EC2 Windows Server 2022 で脆弱な暗号化アルゴリズムを無効化してみた

2025.10.03

はじめに

テクニカルサポートの 片方 です。
EC2 上の Windows Server 環境において、グループポリシーやレジストリ設定を用いて脆弱な暗号化アルゴリズムを無効化する方法を検証しましたので紹介します。
本ブログでは、Windows Server 2022 Datacenter を利用して検証しました。
また、以下のドキュメントを参考にしています。

https://learn.microsoft.com/en-us/windows-server/identity/ad-cs/disable-weak-cryptographic-algorithms?tabs=certutil#policy-syntax

やってみた

以下に分類して無効化しています。

  • 証明書検証ポリシー(certutil -setreg chain ...)
  • SChannel プロトコル制御(TLS / SSL)
  • 暗号スイート(RC4・DES・3DES disable)

証明書検証ポリシー(certutil -setreg chain ...)

X.509 証明書の検証に使用する、たとえば MD5/ SHA1 をサードパーティ証明書から除外するケース。

			
			# MD5 をサードパーティ証明書で無効化(既定で無効だが念のため)
certutil -setreg chain\WeakMD5ThirdPartyFlags 0x80100000

# SHA1 をサードパーティ証明書でも無効化
certutil -setreg chain\WeakSha1ThirdPartyFlags 0x80100000

# RSA 最小鍵長を 2048bit に強制
certutil -setreg chain\WeakRSAThirdPartyMinBitLength 2048

# ログ出力ディレクトリを有効化(任意)
certutil -setreg chain\WeakSignatureLogDir C:\Log

net stop cryptsvc
net start cryptsvc

# 証明書チェーンポリシーの確認 
certutil -getreg chain

		

SChannel プロトコル制御(TLS / SSL)

レジストリ (SChannel) 側で、通信レベルの古いプロトコル(SSL 2.0 / 3.0、TLS 1.0 / 1.1)を無効化するケース。

			
			# SSL 2.0 無効化
reg add "HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 2.0\Server" /v Enabled /t REG_DWORD /d 0 /f
reg add "HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 2.0\Client" /v Enabled /t REG_DWORD /d 0 /f

# SSL 3.0 無効化
reg add "HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 3.0\Server" /v Enabled /t REG_DWORD /d 0 /f
reg add "HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 3.0\Client" /v Enabled /t REG_DWORD /d 0 /f

# TLS 1.0 無効化
reg add "HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.0\Server" /v Enabled /t REG_DWORD /d 0 /f
reg add "HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.0\Client" /v Enabled /t REG_DWORD /d 0 /f

# TLS 1.1 無効化
reg add "HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.1\Server" /v Enabled /t REG_DWORD /d 0 /f
reg add "HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.1\Client" /v Enabled /t REG_DWORD /d 0 /f

# 推奨:TLS 1.2/1.3 を有効化 (Server/Client)
reg add "HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Server" /v Enabled /t REG_DWORD /d 1 /f
reg add "HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client" /v Enabled /t REG_DWORD /d 1 /f
reg add "HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.3\Server" /v Enabled /t REG_DWORD /d 1 /f
reg add "HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.3\Client" /v Enabled /t REG_DWORD /d 1 

確認コマンド例
# TLS1.2 サーバー側設定の確認
reg query "HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Server"

# TLS1.3 クライアント側設定の確認
reg query "HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.3\Client"


		

暗号スイート(RC4・DES・3DES disable)

RC4・DES・3DES といった古い暗号スイートを無効化するには、レジストリで利用を許可する暗号スイートをホワイトリスト形式で管理する必要があります。(※グループポリシーからの設定も可能)
今回はこれらレガシー暗号を排除し、TLS 1.2 / TLS 1.3 の強力な暗号スイートのみを利用したケース。

			
			$strongSuites = @(
"TLS_AES_256_GCM_SHA384",
"TLS_AES_128_GCM_SHA256",
"TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384",
"TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256"
)

$keyPath = "HKLM:\SYSTEM\CurrentControlSet\Control\Cryptography\Configuration\Local\SSL\00010002"

# Functions 値を更新
New-ItemProperty -Path $keyPath -Name "Functions" -Value $strongSuites -PropertyType MultiString -Force

# 変更が正しく適用されたかは以下で確認
Get-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Cryptography\Configuration\Local\SSL\00010002" | Select-Object -ExpandProperty Functions

		

検証時の実行結果

			
			Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
Install the latest PowerShell for new features and improvements! https://aka.ms/PSWindows
PS C:\Windows\system32> Get-ComputerInfo | Select-Object WindowsProductName, WindowsVersion, OsHardwareAbstractionLayer

WindowsProductName             WindowsVersion OsHardwareAbstractionLayer
------------------             -------------- --------------------------
Windows Server 2022 Datacenter 2009           10.0.20348.2849

PS C:\Windows\system32> certutil -setreg chain\WeakMD5ThirdPartyFlags 0x80100000
HKEY_LOCAL_MACHINE\Software\Microsoft\Cryptography\OID\EncodingType 0\CertDllCreateCertificateChainEngine\Config\WeakMD5ThirdPartyFlags:

New Value:
  WeakMD5ThirdPartyFlags REG_DWORD = 80100000 (-2146435072)
    CERT_CHAIN_ENABLE_WEAK_SETTINGS_FLAG -- 80000000 (-2147483648)
    CERT_CHAIN_DISABLE_SERVER_AUTH_WEAK_FLAG -- 100000 (1048576)
CertUtil: -setreg command completed successfully.
The CertSvc service may need to be restarted for changes to take effect.
PS C:\Windows\system32>
PS C:\Windows\system32> certutil -setreg chain\WeakSha1ThirdPartyFlags 0x80100000
HKEY_LOCAL_MACHINE\Software\Microsoft\Cryptography\OID\EncodingType 0\CertDllCreateCertificateChainEngine\Config\WeakSha1ThirdPartyFlags:

New Value:
  WeakSha1ThirdPartyFlags REG_DWORD = 80100000 (-2146435072)
    CERT_CHAIN_ENABLE_WEAK_SETTINGS_FLAG -- 80000000 (-2147483648)
    CERT_CHAIN_DISABLE_SERVER_AUTH_WEAK_FLAG -- 100000 (1048576)
CertUtil: -setreg command completed successfully.
The CertSvc service may need to be restarted for changes to take effect.
PS C:\Windows\system32> certutil -setreg chain\WeakRSAThirdPartyMinBitLength 2048
HKEY_LOCAL_MACHINE\Software\Microsoft\Cryptography\OID\EncodingType 0\CertDllCreateCertificateChainEngine\Config\WeakRSAThirdPartyMinBitLength:

New Value:
  WeakRSAThirdPartyMinBitLength REG_DWORD = 800 (2048)
CertUtil: -setreg command completed successfully.
The CertSvc service may need to be restarted for changes to take effect.
PS C:\Windows\system32> certutil -setreg chain\WeakSignatureLogDir C:\Log
HKEY_LOCAL_MACHINE\Software\Microsoft\Cryptography\OID\EncodingType 0\CertDllCreateCertificateChainEngine\Config\WeakSignatureLogDir:

New Value:
  WeakSignatureLogDir REG_SZ = C:\Log
CertUtil: -setreg command completed successfully.
The CertSvc service may need to be restarted for changes to take effect.
PS C:\Windows\system32> net stop cryptsvc
The Cryptographic Services service is stopping..
The Cryptographic Services service was stopped successfully.

PS C:\Windows\system32> net start cryptsvc
The Cryptographic Services service is starting.
The Cryptographic Services service was started successfully.

PS C:\Windows\system32> certutil -getreg chain
HKEY_LOCAL_MACHINE\Software\Microsoft\Cryptography\OID\EncodingType 0\CertDllCreateCertificateChainEngine\Config:

Keys:
  Default

Values:
  WeakMD5ThirdPartyFlags   REG_DWORD = 80100000 (-2146435072)
    CERT_CHAIN_ENABLE_WEAK_SETTINGS_FLAG -- 80000000 (-2147483648)
    CERT_CHAIN_DISABLE_SERVER_AUTH_WEAK_FLAG -- 100000 (1048576)

  WeakSha1ThirdPartyFlags  REG_DWORD = 80100000 (-2146435072)
    CERT_CHAIN_ENABLE_WEAK_SETTINGS_FLAG -- 80000000 (-2147483648)
    CERT_CHAIN_DISABLE_SERVER_AUTH_WEAK_FLAG -- 100000 (1048576)

  WeakRSAThirdPartyMinBitLength REG_DWORD = 800 (2048)
  WeakSignatureLogDir      REG_SZ = C:\Log
CertUtil: -getreg command completed successfully.
PS C:\Windows\system32> # SSL 2.0 無効化
PS C:\Windows\system32> reg add "HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 2.0\Server" /v Enabled /t REG_DWORD /d 0 /f
The operation completed successfully.
PS C:\Windows\system32> reg add "HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 2.0\Client" /v Enabled /t REG_DWORD /d 0 /f
The operation completed successfully.
PS C:\Windows\system32>
PS C:\Windows\system32> # SSL 3.0 無効化
PS C:\Windows\system32> reg add "HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 3.0\Server" /v Enabled /t REG_DWORD /d 0 /f
The operation completed successfully.
PS C:\Windows\system32> reg add "HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 3.0\Client" /v Enabled /t REG_DWORD /d 0 /f
The operation completed successfully.
PS C:\Windows\system32>
PS C:\Windows\system32> # TLS 1.0 無効化
PS C:\Windows\system32> reg add "HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.0\Server" /v Enabled /t REG_DWORD /d 0 /f
The operation completed successfully.
PS C:\Windows\system32> reg add "HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.0\Client" /v Enabled /t REG_DWORD /d 0 /f
The operation completed successfully.
PS C:\Windows\system32>
PS C:\Windows\system32> # TLS 1.1 無効化
PS C:\Windows\system32> reg add "HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.1\Server" /v Enabled /t REG_DWORD /d 0 /f
The operation completed successfully.
PS C:\Windows\system32> reg add "HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.1\Client" /v Enabled /t REG_DWORD /d 0 /f
The operation completed successfully.
PS C:\Windows\system32>
PS C:\Windows\system32> # 推奨:TLS 1.2/1.3 を有効化 (Server/Client)
PS C:\Windows\system32> reg add "HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Server" /v Enabled /t REG_DWORD /d 1 /f
The operation completed successfully.
PS C:\Windows\system32> reg add "HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client" /v Enabled /t REG_DWORD /d 1 /f
The operation completed successfully.
PS C:\Windows\system32> reg add "HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.3\Server" /v Enabled /t REG_DWORD /d 1 /f
The operation completed successfully.
PS C:\Windows\system32> reg add "HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.3\Client" /v Enabled /t REG_DWORD /d 1
The operation completed successfully.
PS C:\Windows\system32> reg query "HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Server"

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Server
    Enabled    REG_DWORD    0x1

PS C:\Windows\system32>
PS C:\Windows\system32> reg query "HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.3\Client"

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.3\Client
    Enabled    REG_DWORD    0x1

PS C:\Windows\system32> $strongSuites = @(
>> "TLS_AES_256_GCM_SHA384",
>> "TLS_AES_128_GCM_SHA256",
>> "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384",
>> "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256"
>> )
PS C:\Windows\system32>
PS C:\Windows\system32> $keyPath = "HKLM:\SYSTEM\CurrentControlSet\Control\Cryptography\Configuration\Local\SSL\00010002"
PS C:\Windows\system32> New-ItemProperty -Path $keyPath -Name "Functions" -Value $strongSuites -PropertyType MultiString -Force

Functions    : {TLS_AES_256_GCM_SHA384, TLS_AES_128_GCM_SHA256, TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256}
PSPath       : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Cryptography\Configuration\Local\SSL\00010002
PSParentPath : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Cryptography\Configuration\Local\SSL
PSChildName  : 00010002
PSDrive      : HKLM
PSProvider   : Microsoft.PowerShell.Core\Registry

PS C:\Windows\system32> Get-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Cryptography\Configuration\Local\SSL\00010002" | Select-Object -ExpandProperty Functions
TLS_AES_256_GCM_SHA384
TLS_AES_128_GCM_SHA256
TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
PS C:\Windows\system32>

		

まとめ

今回紹介した設定を適用することで最新プロトコル/強力な暗号スイートを優先的に利用できますが、同時に一部の古いクライアントやアプリケーションとの互換性に影響する可能性があります。実運用ではテスト環境での検証を十分に行い、影響範囲を確認してから導入することをおすすめします。
本ブログが誰かの参考になれば幸いです。

参考資料

Windows および Windows Server での証明書検証における弱い暗号化アルゴリズムを無効にする | Microsoft Learn

アノテーション株式会社について

アノテーション株式会社は、クラスメソッド社のグループ企業として「オペレーション・エクセレンス」を担える企業を目指してチャレンジを続けています。「らしく働く、らしく生きる」のスローガンを掲げ、様々な背景をもつ多様なメンバーが自由度の高い働き方を通してお客様へサービスを提供し続けてきました。現在当社では一緒に会社を盛り上げていただけるメンバーを募集中です。少しでもご興味あれば、アノテーション株式会社WEBサイトをご覧ください。

この記事をシェアする

FacebookHatena blogX

関連記事

EC2 Windows Server 2022 で脆弱な暗号化アルゴリズムを無効化してみた | DevelopersIO