Microsoft IIS Service Account Password Dump via AppCmd
An attacker with IIS web server access via a web shell can extract service account passwords by requesting full configuration output or targeting credential-related fields using the AppCmd tool.
The Microsoft Internet Information Services (IIS) command-line tool, AppCmd, is used to manage IIS configurations. An attacker who gains access to an IIS web server, often through a web shell, can leverage AppCmd to dump sensitive configuration data, including application pool credentials. This involves requesting full configuration output or targeting specific credential-related fields, potentially exposing service account passwords in clear text. This activity is typically post-compromise and indicates an attempt to escalate privileges or move laterally within the network. The risk lies in the exposure of credentials that can be reused to access other systems or data.
Attack Chain
- An attacker gains initial access to the IIS web server, commonly through exploiting a vulnerability or uploading a web shell (e.g., ASPX or PHP).
- The attacker uses the web shell to execute commands on the server.
- The attacker uses
appcmd.exeto list the IIS configuration. - The
appcmd.execommand includes arguments to display specific configuration sections related to credentials, such as application pool identities, process model settings, or connection strings. Examples of command line arguments used are/text:*password*,/text:*processModel*,/text:*userName*,/config, or*connectionstring*. appcmd.exeoutputs the requested configuration data to the console, which includes sensitive information like usernames and passwords in plaintext.- The attacker captures the output containing the credentials.
- The attacker uses the acquired credentials to move laterally to other systems on the network or access sensitive data.
Impact
Successful exploitation can lead to the exposure of sensitive credentials, enabling attackers to perform lateral movement, privilege escalation, and data exfiltration. The number of potential victims is dependent on the scope of the attacker’s access and the configuration of the IIS server. Sectors commonly targeted include organizations that rely heavily on web applications and services, such as e-commerce, finance, and healthcare. If successful, the attacker can gain complete control over critical systems and data.
Recommendation
- Enable Sysmon process creation logging to capture
appcmd.exeexecution with command-line arguments. - Deploy the Sigma rule
Detect IIS AppCmd Credential Dumpingto your SIEM and tune for your environment. - Monitor IIS and web server activity for signs of exploitation, such as requests to newly created ASPX or PHP files, requests containing command-execution parameters, or uploads to writable web paths.
- Implement privileged access management (PAM) solutions to restrict the usage of service accounts.
Detection coverage 2
Detect IIS AppCmd Credential Dumping
mediumDetects the execution of `appcmd.exe` with arguments indicative of credential dumping from IIS configuration files.
Detect IIS AppCmd Credential Dumping - Original Filename
mediumDetects the execution of renamed `appcmd.exe` with arguments indicative of credential dumping from IIS configuration files by matching on the original filename.
Detection queries are kept inside the platform. Get full rules →