Join our Newsletter — 33% off our NHI Course
Home› Guides› IIS Hardening Guide: Application Pools, Machine Keys, TLS,…
Guide Endpoint Security

IIS Hardening Guide: Application Pools, Machine Keys, TLS, Request Filtering and Logging

PDF for newsletter subscribers · free to read online

← All guides
By NHI Mgmt Group, edited by Lalit Choda Updated 8 November 2026 13 min read
On this page

Internet Information Services (IIS) is the web tier behind Exchange, SharePoint, Outlook on the web, ADFS proxies and thousands of line-of-business applications, and it is where attackers plant web shells and malicious modules that survive patching. An IIS server's risk is set by a handful of decisions: which identity each application pool runs as, how machine keys and other secrets are generated and stored, which authentication methods are enabled, which modules and handlers are loaded, how TLS is configured in Schannel, and whether the W3C logs record enough to investigate. This guide covers each of those for IIS 10 on Windows Server, with the configuration elements and values to set, how to roll them out without breaking applications, and what to monitor. It is for Windows server engineers, web platform owners and detection engineers, and it complements the Web Shell Response Playbook, which covers what to do after compromise.

This is an independent guide from NHI Mgmt Group, based on Microsoft's public documentation as of November 2026. It is not sponsored or reviewed by Microsoft. Product features change, so confirm settings against Microsoft's current documentation.

Key takeaways

  • One application, one pool, one identity. Run each application in its own pool as ApplicationPoolIdentity (IIS AppPool\<pool>), never LocalSystem, and grant file rights to that virtual account only.
  • Machine keys are credentials. A known ASP.NET validationKey and decryptionKey lets an attacker forge ViewState and run code; generate unique keys per application or farm, never copy them from samples, and rotate them after any compromise.
  • Modules are the persistence layer. Malicious native and managed IIS modules (ATT&CK T1505.004 IIS Components) load into every request; inventory modules and handlers and alert on changes to applicationHost.config and web.config.
  • Request filtering is a cheap first filter. Deny unlisted verbs and extensions where the application allows, keep allowDoubleEscaping="false", hide sensitive segments and review 404.x substatus codes in the logs.
  • Log for investigation, not just traffic. W3C logs at %SystemDrive%\inetpub\logs\LogFiles are in UTC; add Host, SiteName, BytesSent, BytesRecv and a client IP header behind proxies, and forward them before an intruder deletes them.

How identity and access work in IIS

IIS has two identity layers: the identity the worker process (w3wp.exe) runs as, and the identity of the user making the request. Both need hardening.

Worker process identities

IdentityWhat it isNetwork identityUse
ApplicationPoolIdentityVirtual account IIS AppPool\<pool> created by WAS; the default since IIS 7.5; not visible in user managementThe computer account (DOMAIN\server$)Default for every pool
NetworkServiceBuilt-in low-privilege account shared by many servicesComputer accountAvoid: services running under the same identity can tamper with each other
LocalSystemFull control of the serverComputer accountNever for a web application; code execution in the app becomes SYSTEM
Domain or managed service accountA specific account, ideally a group managed service account (gMSA)That accountWhen the application must reach SQL Server or shares under its own identity. See the Group Managed Service Accounts (gMSA) Guide
  • Grant rights to the pool identity: for example ICACLS <path> /grant "IIS AppPool\<pool>:(RX)"; give write only to upload or cache folders, and never write to folders that hold executable content. Microsoft's sample grants full control; least privilege needs read and execute only.
  • Network access: pool identities reach the network as the computer account, so a database ACL for server$ is shared by every pool on the server. Use a dedicated gMSA where pools must be separated on the back end.
  • Old guidance: scripts and vendor install guides that still grant rights to NetworkService need translating to IIS AppPool\<name>.

Request authentication

  • Anonymous: enabled by default and uses IUSR; set userName="" to run anonymous requests as the pool identity, so file rights are granted to one identity per application. Disable anonymous wherever Windows or Basic authentication is used.
  • Windows authentication: prefer Kerberos (Negotiate) and enable Extended Protection for Authentication: tokenChecking="Require" where all clients support it, Allow during transition. Extended Protection binds authentication to the TLS channel (channel binding token) or to SPNs, which defeats credential relay (T1557.001). Do not set AllowDotlessSpn, which Microsoft describes as insecure. See the NTLM Relay Guide.
  • Basic authentication: only over TLS, and only where a modern alternative is not possible; it sends reusable passwords on every request.
  • Modern sign-in: for new applications, put authentication in the application with OpenID Connect rather than IIS Windows authentication on the internet edge. See the ASP.NET Core Security Guide.

Admin roles and privileged access

  • Server administrators: anyone in local Administrators can edit %windir%\System32\inetsrv\config\applicationHost.config, install modules and read decrypted secrets. Keep the group small and use tiered admin accounts. See the Windows Server Hardening Guide.
  • Delegated site administration: IIS Manager feature delegation lets non-administrators change settings in web.config. Lock sections that matter for security (authentication, request filtering, handlers, modules) at the server level so applications cannot override them.
  • Remote management: the Web Management Service (WMSvc) and Web Deploy give remote control of sites; if used, restrict to the admin network, require TLS with a trusted certificate and use dedicated deployment accounts. Disable them where deployment happens through a pipeline that uses another channel.
  • Content deployment: deployment accounts that can write to site folders can plant a web shell (T1505.003). Separate deployment from runtime identities and make site folders read-only to the pool.

Integrations, API tokens and service accounts

Secret on an IIS serverWhere it isRiskControl
ASP.NET machine keys<machineKey> in web.config or machine.config, or auto-generatedForged ViewState and remote code executionUnique generated keys per app or farm; never sample keys; rotate after compromise and restart IIS
Custom pool and anonymous account passwordsapplicationHost.config, encrypted ([enc:AesProvider:...]) when set through IIS Manager or AppCmdDecryptable by local administratorsPrefer ApplicationPoolIdentity or gMSA, which have no stored password
Connection strings and API keysweb.config, appsettings.jsonRead by any web shell running as the poolEncrypt configuration sections or, better, fetch from a secrets manager with the pool's managed identity. See the Secrets Management Guide
TLS private keysWindows certificate storeServer impersonation if exportedNon-exportable keys, automated renewal, monitoring of expiry. See the ACME and Automated Certificate Management Guide
Web Deploy and pipeline credentialsCI/CD variables, publish profilesCode push to productionShort-lived or scoped credentials, dedicated accounts

Microsoft reported in February 2025 that it found more than 3,000 ASP.NET machine keys published online, and that a publicly disclosed key can be used to forge ViewState. Generate unique keys, keep them out of code and samples, and after any suspected compromise patch, rotate the machine keys and restart IIS, because patching alone leaves keys that were read still valid.

Logging and detection

SourceWhat it showsSetting
W3C access logsEvery request: client IP, method, URI stem and query, status and substatus, time takenlogFormat="W3C", default directory %SystemDrive%\inetpub\logs\LogFiles, timestamps in UTC; add Host, SiteName, BytesSent, BytesRecv and Cookie only if policy allows
Custom fieldsOriginal client IP behind load balancers<customFields> (IIS 8.5 and later) with a request header source for X-Forwarded-For
ETW loggingReal-time events for a collectorlogTargetW3C="File,ETW" (IIS 8.5 and later)
Request filtering substatusBlocked probing: 404.5 sequence, 404.6 verb, 404.7 extension, 404.8 hidden segment, 404.11 double escaped, 404.14 URL too long, 404.15 query too longLogged automatically with HttpSubStatus
Process telemetry (EDR or Sysmon)w3wp.exe spawning cmd.exe, powershell.exe, net.exe; appcmd.exe add module or gacutil.exe /I launched from w3wp.exeHighest-value alert on any IIS server
File integrityNew .aspx, .ashx, .asmx, DLLs in bin or the GAC; changes to web.config and applicationHost.configFIM on site roots, inetsrv\config and the GAC
  • Module inventory: Microsoft recommends regularly inspecting installed modules with appcmd.exe or gacutil.exe, scanning application bin folders and the GAC, and reviewing web.config and ApplicationHost.config for suspicious additions such as a handler mapped to image files. A scheduled appcmd list modules diffed against a baseline is a simple control.
  • Log retention: the default rollover is daily; forward logs off the server so an intruder cannot delete them (ATT&CK v20 T1070 Indicator Removal). See the Web Server Access Log Detection Guide.
  • Configuration change log: enable the IIS configuration operational event log to record configuration changes, and forward it with the Windows logs. See the Windows Event Log Guide.

Hardening baseline

The CIS Microsoft IIS 10 Benchmark (version 1.2.1 at the time of writing) is the usual external baseline; apply it to IIS alongside the Windows Server benchmark or Microsoft security baseline for the operating system. See the CIS Benchmarks Guide.

Request filtering values

SettingDefaultHardened guidance
requestLimits maxAllowedContentLength30000000 bytesLower to the largest legitimate upload per application
requestLimits maxUrl4096Lower if the application uses short URLs
requestLimits maxQueryString2048Lower if the application allows
allowDoubleEscapingfalseKeep false
allowHighBitCharacterstrueSet false if the application has no non-ASCII URLs
verbs allowUnlistedtrueSet false and allow only GET, POST, HEAD (plus what APIs need); deny TRACE
fileExtensions allowUnlistedtrueSet false on static and simple sites and allow known extensions
removeServerHeaderfalseSet true (IIS 10.0 and later)
denyUrlSequencesEmptyAdd .. and other traversal sequences the application never uses

Rollout

  1. Inventory: list sites, bindings, pools and identities, enabled authentication per site, installed modules and handlers, and secrets in configuration. Back up applicationHost.config (IIS also keeps history in inetpub\history) so every change can be rolled back.
  2. Minimise the install: remove IIS role services that are not used (WebDAV, CGI, ASP, directory browsing, FTP, management service), and remove default sites and sample content.
  3. Isolate pools: one pool per application with ApplicationPoolIdentity, userName="" for anonymous access, and read and execute NTFS rights only.
  4. Fix machine keys: generate unique keys for each application or farm, remove any copied from documentation or forums, and store farm keys protected.
  5. TLS in Schannel: disable TLS 1.0 and 1.1 server-side under HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.0\Server (Enabled=0) and the same for TLS 1.1, and set cipher suite order through Group Policy, MDM or PowerShell rather than direct registry edits, as Microsoft advises. Test clients first: disabling a version can break peers. Add HSTS on HTTPS sites. See the TLS Server Configuration Baseline Guide.
  6. Request filtering: apply the table above in audit-like fashion: change one site, watch 404.x substatus counts for a week, then promote. Roll back by restoring the previous configuration from history.
  7. Authentication: disable unused methods, enable Extended Protection (Allow, then Require), and lock security sections against delegation.
  8. Logging and monitoring: set the log fields, forward logs and process telemetry, and baseline the module list.

Common misconfigurations

  • All applications in one pool or under LocalSystem: one vulnerable application exposes every site and the server itself.
  • Machine keys copied from the internet: keys pasted from samples or code repositories are known to attackers; Microsoft's 3,000-key finding shows how common this is.
  • Patching without rotating secrets: after an IIS-hosted product is exploited, machine keys, connection strings and pool credentials read by the attacker stay valid until rotated.
  • Writable site folders: the pool identity or a broad group can write to the web root, so any file-upload or deserialisation bug becomes a web shell.
  • No module baseline: malicious modules registered in applicationHost.config are visible in IIS Manager, yet go unnoticed because nobody compares the list with a known-good state.
  • Logs without client IPs behind a proxy: every request appears to come from the load balancer, which makes investigation and blocking impossible.

Decision guidance and framework mapping

  • Internet-facing vs internal: internet-facing IIS should sit behind a reverse proxy or WAF, have anonymous or application-level authentication only, and have the strictest request filtering; internal intranet servers can use Windows authentication with Extended Protection.
  • Product-hosting servers (Exchange, SharePoint): follow the product's own guidance first, because aggressive request filtering or module removal can break the product. See the Microsoft Exchange Server Security Guide and the SharePoint Server Security Guide.
  • Small vs large estates: small teams should start with pool isolation, machine keys, TLS and log forwarding; large estates should manage IIS configuration as code (DSC or similar), with drift detection against the CIS profile.
ControlNIST SP 800-53 Rev. 5NIST CSF 2.0CIS Controls v8.1ATT&CK v20
Pool isolation and identitiesAC-6, AC-2PR.AA-055, 6T1190 impact reduction
Machine keys and configuration secretsIA-5, SC-12PR.AA-013T1552.001
Extended Protection, KerberosIA-2, SC-23PR.AA-016T1557.001
Request filtering, minimal role servicesCM-7, SC-7PR.PS-014, 16T1190
Module and file integritySI-7, CM-3DE.CM-092, 4T1505.003, T1505.004
TLS configurationSC-8, SC-13PR.DS-023T1557
W3C logs and process telemetryAU-2, AU-12, SI-4PR.PS-04, DE.CM-098T1505.003

Metrics: pools running as LocalSystem or NetworkService (target zero); applications sharing a pool; servers with TLS 1.0 or 1.1 enabled server-side (target zero); machine keys shared across unrelated applications or matching known public keys (target zero); modules not in the approved baseline (target zero, each investigated); and percentage of IIS servers whose W3C logs and process telemetry reach the SIEM.

Practitioner checklist

  • Give every application its own pool running as ApplicationPoolIdentity or a gMSA; remove LocalSystem and NetworkService pools.
  • Set anonymous authentication to the pool identity, grant read and execute only, and restrict write to specific folders.
  • Generate unique machine keys per application or farm and rotate them after any compromise of an IIS-hosted product.
  • Move connection strings and API keys out of plain configuration into encrypted sections or a secrets manager.
  • Enable Extended Protection for Windows authentication and disable Basic authentication on the internet edge.
  • Remove unused role services and default content; apply request filtering limits per application.
  • Disable TLS 1.0 and 1.1 in Schannel, set cipher order by Group Policy and enable HSTS.
  • Baseline installed modules and handlers and alert on changes to applicationHost.config, web.config, bin and the GAC.
  • Log W3C fields including client IP behind proxies, forward logs and alert on w3wp.exe spawning shells.

Standards and references

Related NHI Mgmt Group resources: Web Shell Response Playbook · Windows Server Hardening Guide · .NET Security Guide · Group Managed Service Accounts (gMSA) Guide · Web Server Access Log Detection Guide

PDF for subscribers

Take this guide with you

Every section, table and checklist in one PDF, with links to the sources and related guides. Subscribe to our weekly NHI & AI Identity Journal and we’ll email you a download link.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

NHIMG Editorial Note
Researched and written by the NHI Mgmt Group editorial team using AI tools, under the editorial direction of Lalit Choda. Facts are drawn from the sources listed on this page and checked by our automated quality process. Last updated 8 November 2026. Spotted an error? Use our contact page.
NHI Mgmt Group, the independent authority on Non-Human Identity, IAM and Agentic AI security. nhimg.org

PDF Downloads for Newsletter Subscribers

Get the guide

Enter your details and we’ll email you a download link.

The full guide is free to read online. The PDF is a thank you for subscribing.

Fill in all fields marked * and tick the PDF box to continue.