TMAegis
More rules for iis

Microsoft IIS

TMA-IIS-3.5

Ensure ASP.NET stack tracing is not enabled

LowLevel 2Automatediis

Description

The trace element configures the ASP.NET code tracing service that controls how trace results are gathered, stored, and displayed. When tracing is enabled, each page request generates trace messages that can be appended to the page output or stored in an application trace log. ASP.NET trace must not be enabled in the root web.config or any site (page-level Trace="true" is not checked). PowerShell 5.1 with the WebAdministration module; run elevated.

How it is checked

Audit method: Shell command

shell
Import-Module WebAdministration -ErrorAction Stop; $paths = @('MACHINE/WEBROOT') + @(Get-Website | ForEach-Object { "IIS:\Sites\$($_.Name)" }); $bad = @($paths | Where-Object { $c = Get-WebConfiguration -Filter 'system.web/trace' -PSPath $_; $c.enabled -eq $true }); if ($bad.Count -eq 0) { 'compliant' } else { 'noncompliant' }
Expected output
compliant

How it is fixed

Fix method: Guidance or infrastructure patch

Set-WebConfigurationProperty -PSPath 'MACHINE/WEBROOT/APPHOST/<site>' -Filter system.web/trace -Name enabled -Value False

Properties

Operating systems
Any
Tags
iisinformation-disclosure
Reference
CIS Microsoft IIS 10 Benchmark v1.2.1 - 3.5 Ensure ASP.NET stack tracing is not enabled

Check this host

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

shell
tmaegis scan --target iis --level 2