Last active
September 8, 2026 09:12
-
-
Save mickert/cb2276ed620d5c1b95b4e0b95a9bace5 to your computer and use it in GitHub Desktop.
CVE-2026-62815 QUIC Mitigation Script - (c) 2026 Michel Sijmons - https://mickert.dev - License: Apache 2.0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # CVE-2026-62815 QUIC Mitigation Script | |
| # | |
| # Blocks UDP 443 inbound | |
| # Blocks QUIC UDP 443 oubound for svchost.exe and WinHttpAutoProxySvc | |
| # Disables http3 in IIS. | |
| # Sets environment vars to disable quick in .Net applications. | |
| # | |
| # Licensed under Apache License 2.0 | |
| # Copyright (c) 2026 Michel Sijmons | |
| # Canonical URL: https://gists.mickert.dev/cb2276ed620d5c1b95b4e0b95a9bace5 | |
| # | |
| # ===================================================================== | |
| # DISCLAIMER & LICENSE | |
| # ===================================================================== | |
| # Licensed under the Apache License, Version 2.0 (the "License"); | |
| # you may not use this file except in compliance with the License. | |
| # You may obtain a copy of the License at: | |
| # | |
| # http://www.apache.org/licenses/LICENSE-2.0 | |
| # | |
| # Unless required by applicable law or agreed to in writing, software | |
| # distributed under the License is distributed on an "AS IS" BASIS, | |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| # See the License for the specific language governing permissions and | |
| # limitations under the License. | |
| # | |
| # DISCLAIMER: | |
| # This script is provided "as-is" without any warranties or guarantees. | |
| # Use at your own risk. The author assumes no liability for any damages, | |
| # data loss, misconfiguration, or operational impact resulting from the | |
| # use of this script. Always test in a controlled environment before | |
| # deploying to production. | |
| # ===================================================================== | |
| # COPYRIGHT | |
| # ===================================================================== | |
| # Copyright (c) 2026 Michel Sijmons | |
| # All rights reserved. | |
| Write-Host "*** CVE-2026-62815 QUIC Mitigation Script *** " -ForegroundColor Cyan | |
| Write-Host "* Blocks UDP 443 inbound " -ForegroundColor Cyan | |
| Write-Host "* Blocks QUIC UDP 443 oubound for svchost.exe and WinHttpAutoProxySvc " -ForegroundColor Cyan | |
| Write-Host "* Disables http3 in IIS. " -ForegroundColor Cyan | |
| Write-Host "* Sets environment vars to disable quick in .Net applications. " -ForegroundColor Cyan | |
| Write-Host "* (C) 2026 - Michel Sijmons, https://mickert.dev " -ForegroundColor Cyan | |
| Write-Host "* Licensed under Apache License 2.0 " -ForegroundColor Cyan | |
| Write-Host "* Download https://gists.mickert.dev/cb2276ed620d5c1b95b4e0b95a9bace5 " -ForegroundColor Cyan | |
| # ============================================================ | |
| # 1. System-wide environment variables | |
| # ============================================================ | |
| Write-Host "`n[1] Setting system-wide QUIC disable variables..." -ForegroundColor Yellow | |
| $vars = @{ | |
| "DOTNET_SYSTEM_NET_QUIC_ENABLE" = "0" # Not sure about this one, is not in documentation | |
| "DOTNET_SYSTEM_NET_HTTP_SOCKETSHTTPHANDLER_HTTP3SUPPORT" = "0" # This is in documentation: https://learn.microsoft.com/en-us/dotnet/core/runtime-config/networking | |
| } | |
| foreach ($kvp in $vars.GetEnumerator()) { | |
| $name = $kvp.Key | |
| $value = $kvp.Value | |
| $existing = Get-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" ` | |
| -Name $name -ErrorAction SilentlyContinue | |
| if ($existing) { | |
| Write-Host "Variable $name already exists (value: $($existing.$name))" -ForegroundColor DarkYellow | |
| } else { | |
| Write-Host "Creating variable $name = $value" -ForegroundColor Green | |
| setx "$name" "$value" /M | Out-Null | |
| } | |
| } | |
| # ============================================================ | |
| # 2. OS-level HTTP/3 / QUIC disable (registry + IIS config) | |
| # ============================================================ | |
| Write-Host "`n[2] Disabling HTTP/3 / QUIC at OS and IIS level..." -ForegroundColor Yellow | |
| # 2.1 EnableHttp3 registry key | |
| $httpParamsKey = "HKLM:\SYSTEM\CurrentControlSet\Services\HTTP\Parameters" | |
| if (-not (Test-Path $httpParamsKey)) { | |
| New-Item -Path $httpParamsKey -Force | Out-Null | |
| } | |
| $enableHttp3 = Get-ItemProperty -Path $httpParamsKey -Name "EnableHttp3" -ErrorAction SilentlyContinue | |
| if ($enableHttp3) { | |
| if ($enableHttp3.EnableHttp3 -ne 0) { | |
| Write-Host "Setting EnableHttp3=0 (was $($enableHttp3.EnableHttp3))" -ForegroundColor Green | |
| Set-ItemProperty -Path $httpParamsKey -Name "EnableHttp3" -Value 0 | |
| } else { | |
| Write-Host "EnableHttp3 already set to 0" -ForegroundColor DarkYellow | |
| } | |
| } else { | |
| Write-Host "Creating EnableHttp3=0" -ForegroundColor Green | |
| New-ItemProperty -Path $httpParamsKey -Name "EnableHttp3" -PropertyType DWord -Value 0 | Out-Null | |
| } | |
| # 2.2 IIS allowHttp3 (if present) | |
| try { | |
| $httpProtocolSection = Get-WebConfiguration -pspath 'MACHINE/WEBROOT/APPHOST' -filter "system.webServer/httpProtocol" -ErrorAction Stop | |
| $currentAllowHttp3 = $httpProtocolSection.allowHttp3 | |
| if ($null -ne $currentAllowHttp3) { | |
| if ($currentAllowHttp3 -ne $false) { | |
| Write-Host "Setting IIS allowHttp3=False (was $currentAllowHttp3)" -ForegroundColor Green | |
| Set-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST' ` | |
| -filter "system.webServer/httpProtocol" ` | |
| -name "allowHttp3" ` | |
| -value "False" | |
| } else { | |
| Write-Host "IIS allowHttp3 already False" -ForegroundColor DarkYellow | |
| } | |
| } else { | |
| Write-Host "IIS allowHttp3 property not present (nothing to change)" -ForegroundColor DarkYellow | |
| } | |
| } | |
| catch { | |
| Write-Host "IIS httpProtocol section not found or WebAdministration not available; skipping allowHttp3." -ForegroundColor DarkYellow | |
| } | |
| # ============================================================ | |
| # 3. Firewall rules (idempotent, block + QUIC Traffic-In disable) | |
| # ============================================================ | |
| Write-Host "`n[3] Ensuring QUIC block firewall rules exist..." -ForegroundColor Yellow | |
| function EnsureRule { | |
| param( | |
| [string]$Name, | |
| [scriptblock]$CreateBlock | |
| ) | |
| if (-not (Get-NetFirewallRule -Name $Name -ErrorAction SilentlyContinue)) { | |
| Write-Host "Creating rule: $Name" -ForegroundColor Green | |
| & $CreateBlock | |
| } else { | |
| Write-Host "Rule already exists: $Name" -ForegroundColor DarkYellow | |
| } | |
| } | |
| # 3.1 Block UDP 443 (QUIC) Inbound, *** THIS MAY BREAK SOME FUNCTIONALTY *** | |
| EnsureRule -Name "Block UDP 443 (QUIC) - CVE-2026-62815" -CreateBlock { | |
| New-NetFirewallRule ` | |
| -Name "Block UDP 443 (QUIC) - CVE-2026-62815" ` | |
| -DisplayName "Block UDP 443 (QUIC) - CVE-2026-62815" ` | |
| -Protocol UDP ` | |
| -LocalPort 443 ` | |
| -Direction Inbound ` | |
| -Action Block ` | |
| -Profile Any ` | |
| -Enabled True | Out-Null | |
| } | |
| # 3.2 Disable predefined inbound QUIC rule if active | |
| $quicInRule = Get-NetFirewallRule -DisplayName "World Wide Web Services (QUIC Traffic-In)" -ErrorAction SilentlyContinue | |
| if ($quicInRule) { | |
| if ($quicInRule.Enabled -eq "True") { | |
| Write-Host "Disabling firewall rule 'World Wide Web Services (QUIC Traffic-In)'" -ForegroundColor Green | |
| Disable-NetFirewallRule -DisplayName "World Wide Web Services (QUIC Traffic-In)" | Out-Null | |
| } else { | |
| Write-Host "Firewall rule 'World Wide Web Services (QUIC Traffic-In)' already disabled" -ForegroundColor DarkYellow | |
| } | |
| } else { | |
| Write-Host "Firewall rule 'World Wide Web Services (QUIC Traffic-In)' not found; nothing to disable." -ForegroundColor DarkYellow | |
| } | |
| # 3.3 Block QUIC for svchost.exe (Windows QUIC stack) | |
| EnsureRule -Name "Block QUIC (UDP 443) - CVE-2026-62815 - Windows QUIC stack - svchost.exe" -CreateBlock { | |
| New-NetFirewallRule ` | |
| -Name "Block QUIC (UDP 443) - CVE-2026-62815 - Windows QUIC stack - svchost.exe" ` | |
| -DisplayName "Block QUIC (UDP 443) - CVE-2026-62815 - Windows QUIC stack - svchost.exe" ` | |
| -Program "%SystemRoot%\System32\svchost.exe" ` | |
| -Protocol UDP ` | |
| -RemotePort 443 ` | |
| -Direction Outbound ` | |
| -Action Block ` | |
| -Profile Any ` | |
| -Enabled True | Out-Null | |
| } | |
| # 3.4 Block QUIC for WinHttpAutoProxySvc service (extra safety) | |
| EnsureRule -Name "Block QUIC (UDP 443) - CVE-2026-62815 - Windows QUIC stack - WinHttpAutoProxySvc service" -CreateBlock { | |
| New-NetFirewallRule ` | |
| -Name "Block QUIC (UDP 443) - CVE-2026-62815 - Windows QUIC stack - WinHttpAutoProxySvc service" ` | |
| -DisplayName "Block QUIC (UDP 443) - CVE-2026-62815 - Windows QUIC stack - WinHttpAutoProxySvc service" ` | |
| -Service "WinHttpAutoProxySvc" ` | |
| -Protocol UDP ` | |
| -RemotePort 443 ` | |
| -Direction Outbound ` | |
| -Action Block ` | |
| -Profile Any ` | |
| -Enabled True | Out-Null | |
| } | |
| Write-Host "`n" | |
| Write-Host "*** Mitigation Complete, but restart of the machine is preferred to let .Net and IIS configuration take effect." -ForegroundColor Cyan |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment