TMAegis
More rules for iis

TMA-IIS-4.7

Ensure Unlisted File Extensions are not allowed

MediumLevel 1Automatediis

Description

The FileExtensions Request Filter allows administrators to define specific extensions their web server(s) will allow and disallow. The property allowUnlisted will cover all other file extensions not explicitly allowed or denied. Often times, extensions such as .config, .bat, .exe, to name a few, should never be served. The AllowExtensions and DenyExtensions options are the UrlScan equivalents. requestFiltering fileExtensions allowUnlisted must be false at server level (then allow only required extensions). PowerShell 5.1 with the WebAdministration module; run elevated.

How it is checked

Audit method: Shell command

shell
Import-Module WebAdministration -ErrorAction Stop; $c = Get-WebConfiguration -Filter 'system.webServer/security/requestFiltering/fileExtensions' -PSPath 'MACHINE/WEBROOT/APPHOST'; if ($c.allowUnlisted -eq $false) { 'compliant' } else { 'noncompliant' }
Expected output
compliant

How it is fixed

Fix method: Guidance or infrastructure patch

Set-WebConfigurationProperty -PSPath 'MACHINE/WEBROOT/APPHOST' -Filter system.webServer/security/requestFiltering/fileExtensions -Name allowUnlisted -Value False (after adding <add fileExtension='.aspx' allowed='true'/> etc. for required types)

Properties

Operating systems
Any
Tags
iisrequest-filtering
Reference
CIS Microsoft IIS 10 Benchmark v1.2.1 - 4.7 Ensure Unlisted File Extensions are not allowed

Check this host

Run this on a machine you are allowed to audit. The scan is read-only.

shell
tmaegis scan --target iis