
Restore the integrity of the parent 'inetpub' folder following security implications highlighted by CVE-2025-21204.
This script restores the %SYSTEMDRIVE%\inetpub folder and its default security permissions, which are necessary as a mitigation for CVE-2025-21204 following the KB5055523 Windows update.
It's intended for users who may have deleted this folder before understanding its security purpose and wish to restore it without needing to enable/disable IIS features.
%SYSTEMDRIVE%\inetpub directory if it does not exist.inetpub folder itself.inetpub folder to NT AUTHORITY\SYSTEM.Choose one of the following methods. All require an elevated (Administrator) PowerShell window.
This command downloads and runs the script immediately. The script will pause for confirmation upon completion by default.
powershell -ExecutionPolicy Bypass -Command "irm 'https://raw.githubusercontent.com/mmotti/Reset-inetpub/refs/heads/main/Reset.ps1' | iex"
This command downloads and runs the script immediately, using the -NoWait switch to prevent the script from pausing upon completion.
powershell -ExecutionPolicy Bypass -Command "& ([ScriptBlock]::Create((irm 'https://raw.githubusercontent.com/mmotti/Reset-inetpub/refs/heads/main/Reset.ps1'))) -NoWait"
-NoWait: A switch parameter passed to the script to suppress the final "Press any key to continue..." prompt.$scriptPath = Join-Path $env:TEMP "Reset-inetpub.ps1"
Invoke-WebRequest -Uri 'https://raw.githubusercontent.com/mmotti/Reset-inetpub/refs/heads/main/Reset.ps1' -OutFile $scriptPath
# Open in Notepad
notepad $scriptPath
# Standard execution (will pause at the end)
powershell -ExecutionPolicy Bypass -File $scriptPath
# -- OR -- #
#Execution without the final pause
powershell -ExecutionPolicy Bypass -File $scriptPath -NoWait
Remove-Item -Path $scriptPath -Force
Please be aware of the following:
%SYSTEMDRIVE%\inetpub folder itself. Default inheritance settings are applied.inetpub directory exists and contains files or subfolders, the script will:
inetpub folder.NT AUTHORITY\SYSTEM) only to the inetpub folder itself, not recursively. This avoids potentially overriding custom permissions on existing sub-content.The script aims to apply the following permissions, captured from a clean inetpub directory created by the relevant Windows update.
icacls export: See acls.txt for the raw SDDL string used by the script.
icacls permission summary (example from C: drive):
C:\inetpub NT SERVICE\TrustedInstaller:(F)
NT SERVICE\TrustedInstaller:(OI)(CI)(IO)(F)
NT AUTHORITY\SYSTEM:(F)
NT AUTHORITY\SYSTEM:(OI)(CI)(IO)(F)
BUILTIN\Administrators:(F)
BUILTIN\Administrators:(OI)(CI)(IO)(F)
BUILTIN\Users:(RX)
BUILTIN\Users:(OI)(CI)(IO)(GR,GE)
CREATOR OWNER:(OI)(CI)(IO)(F)
(Note: The script dynamically determines the correct drive letter.)