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
validationKeyanddecryptionKeylets 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.configandweb.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\LogFilesare 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
| Identity | What it is | Network identity | Use |
|---|---|---|---|
| ApplicationPoolIdentity | Virtual account IIS AppPool\<pool> created by WAS; the default since IIS 7.5; not visible in user management | The computer account (DOMAIN\server$) | Default for every pool |
| NetworkService | Built-in low-privilege account shared by many services | Computer account | Avoid: services running under the same identity can tamper with each other |
| LocalSystem | Full control of the server | Computer account | Never for a web application; code execution in the app becomes SYSTEM |
| Domain or managed service account | A specific account, ideally a group managed service account (gMSA) | That account | When 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; setuserName=""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,Allowduring transition. Extended Protection binds authentication to the TLS channel (channel binding token) or to SPNs, which defeats credential relay (T1557.001). Do not setAllowDotlessSpn, 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 server | Where it is | Risk | Control |
|---|---|---|---|
| ASP.NET machine keys | <machineKey> in web.config or machine.config, or auto-generated | Forged ViewState and remote code execution | Unique generated keys per app or farm; never sample keys; rotate after compromise and restart IIS |
| Custom pool and anonymous account passwords | applicationHost.config, encrypted ([enc:AesProvider:...]) when set through IIS Manager or AppCmd | Decryptable by local administrators | Prefer ApplicationPoolIdentity or gMSA, which have no stored password |
| Connection strings and API keys | web.config, appsettings.json | Read by any web shell running as the pool | Encrypt configuration sections or, better, fetch from a secrets manager with the pool's managed identity. See the Secrets Management Guide |
| TLS private keys | Windows certificate store | Server impersonation if exported | Non-exportable keys, automated renewal, monitoring of expiry. See the ACME and Automated Certificate Management Guide |
| Web Deploy and pipeline credentials | CI/CD variables, publish profiles | Code push to production | Short-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
| Source | What it shows | Setting |
|---|---|---|
| W3C access logs | Every request: client IP, method, URI stem and query, status and substatus, time taken | logFormat="W3C", default directory %SystemDrive%\inetpub\logs\LogFiles, timestamps in UTC; add Host, SiteName, BytesSent, BytesRecv and Cookie only if policy allows |
| Custom fields | Original client IP behind load balancers | <customFields> (IIS 8.5 and later) with a request header source for X-Forwarded-For |
| ETW logging | Real-time events for a collector | logTargetW3C="File,ETW" (IIS 8.5 and later) |
| Request filtering substatus | Blocked 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 long | Logged 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.exe | Highest-value alert on any IIS server |
| File integrity | New .aspx, .ashx, .asmx, DLLs in bin or the GAC; changes to web.config and applicationHost.config | FIM on site roots, inetsrv\config and the GAC |
- Module inventory: Microsoft recommends regularly inspecting installed modules with
appcmd.exeorgacutil.exe, scanning applicationbinfolders and the GAC, and reviewingweb.configandApplicationHost.configfor suspicious additions such as a handler mapped to image files. A scheduledappcmd list modulesdiffed 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
| Setting | Default | Hardened guidance |
|---|---|---|
requestLimits maxAllowedContentLength | 30000000 bytes | Lower to the largest legitimate upload per application |
requestLimits maxUrl | 4096 | Lower if the application uses short URLs |
requestLimits maxQueryString | 2048 | Lower if the application allows |
allowDoubleEscaping | false | Keep false |
allowHighBitCharacters | true | Set false if the application has no non-ASCII URLs |
verbs allowUnlisted | true | Set false and allow only GET, POST, HEAD (plus what APIs need); deny TRACE |
fileExtensions allowUnlisted | true | Set false on static and simple sites and allow known extensions |
removeServerHeader | false | Set true (IIS 10.0 and later) |
denyUrlSequences | Empty | Add .. and other traversal sequences the application never uses |
Rollout
- 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 ininetpub\history) so every change can be rolled back. - 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.
- Isolate pools: one pool per application with ApplicationPoolIdentity,
userName=""for anonymous access, and read and execute NTFS rights only. - Fix machine keys: generate unique keys for each application or farm, remove any copied from documentation or forums, and store farm keys protected.
- 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. - 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.
- Authentication: disable unused methods, enable Extended Protection (
Allow, thenRequire), and lock security sections against delegation. - 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.configare 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.
| Control | NIST SP 800-53 Rev. 5 | NIST CSF 2.0 | CIS Controls v8.1 | ATT&CK v20 |
|---|---|---|---|---|
| Pool isolation and identities | AC-6, AC-2 | PR.AA-05 | 5, 6 | T1190 impact reduction |
| Machine keys and configuration secrets | IA-5, SC-12 | PR.AA-01 | 3 | T1552.001 |
| Extended Protection, Kerberos | IA-2, SC-23 | PR.AA-01 | 6 | T1557.001 |
| Request filtering, minimal role services | CM-7, SC-7 | PR.PS-01 | 4, 16 | T1190 |
| Module and file integrity | SI-7, CM-3 | DE.CM-09 | 2, 4 | T1505.003, T1505.004 |
| TLS configuration | SC-8, SC-13 | PR.DS-02 | 3 | T1557 |
| W3C logs and process telemetry | AU-2, AU-12, SI-4 | PR.PS-04, DE.CM-09 | 8 | T1505.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,binand the GAC. - Log W3C fields including client IP behind proxies, forward logs and alert on
w3wp.exespawning shells.
Standards and references
- Microsoft Learn: Application Pool Identities
- Microsoft Learn: Request Filtering
- Microsoft Learn: Default Log File Settings
- Microsoft Learn: Extended Protection for Windows Authentication
- Microsoft Learn: TLS registry settings
- Microsoft Security: Malicious IIS extensions quietly open persistent backdoors into servers
- CIS: Microsoft IIS Benchmarks
- MITRE ATT&CK: IIS Components
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