swanctl: How to enable strong key exchange in Windows

By default, Windows 7 and Windows 11 offer only the weak modp1024 Diffie-Hellman key exchange group, which has been deprecated since 2015 according to Special Publication NIST 800-57, Part 3, Revision 1:

ike = 3des-aes128-aes192-aes256-sha1-sha256-sha384-modp1024

Windows 11 also offers the AES-GCM authenticated encryption algorithm (AEAD), but unfortunately again with the vulnerable modp1024 Diffie-Hellman group.

ike = aes128gcm16-aes256gcm16-sha1-sha256-sha384-modp1024

So if you don't want some major intelligence agency listening in on your conversations, we strongly recommend enabling the modp2048 Diffie-Hellman group by adding the NegotiateDH2048_AES256 DWORD to the Windows registry with regedit:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Rasman\Parameters\NegotiateDH2048_AES256

The value can be 0, 1 or 2. The table below explains what each value means.

Value Description
0 Disable AES-256-CBC and MODP-2048. This is the default.
1 Enable AES-256-CBC and MODP-2048
2 Enforce the use of AES-256-CBC and MODP-2048.

With the value set to 2, Windows 11 offers

ike = aes256-sha1-sha256-sha384-modp2048

Unfortunately, the proposed ESP transforms still include weak encryption algorithms, DES among them and even plain NULL, while data integrity is limited to SHA1

esp = aes256-aes128-3des-des-null-sha1

The Set-VpnConnectionIPsecConfiguration PowerShell cmdlet lets you use even more algorithms, such as AES-GCM and the ECP Diffie-Hellman groups (at least on Windows 10). The VPN connection itself can be added through the GUI or with the Add-VpnConnection cmdlet.

Only registered users can leave a comment.

Sign in or register to leave a comment.