Try it using Invoke-Atomic

IIS Components

Description from ATT&CK

Adversaries may install malicious components that run on Internet Information Services (IIS) web servers to establish persistence. IIS provides several mechanisms to extend the functionality of the web servers. For example, Internet Server Application Programming Interface (ISAPI) extensions and filters can be installed to examine and/or modify incoming and outgoing IIS web requests. Extensions and filters are deployed as DLL files that export three functions: Get{Extension/Filter}Version, Http{Extension/Filter}Proc, and (optionally) Terminate{Extension/Filter}. IIS modules may also be installed to extend IIS web servers.(Citation: Microsoft ISAPI Extension Overview 2017)(Citation: Microsoft ISAPI Filter Overview 2017)(Citation: IIS Backdoor 2011)(Citation: Trustwave IIS Module 2013)

Adversaries may install malicious ISAPI extensions and filters to observe and/or modify traffic, execute commands on compromised machines, or proxy command and control traffic. ISAPI extensions and filters may have access to all IIS web requests and responses. For example, an adversary may abuse these mechanisms to modify HTTP responses in order to distribute malicious commands/content to previously comprised hosts.(Citation: Microsoft ISAPI Filter Overview 2017)(Citation: Microsoft ISAPI Extension Overview 2017)(Citation: Microsoft ISAPI Extension All Incoming 2017)(Citation: Dell TG-3390)(Citation: Trustwave IIS Module 2013)(Citation: MMPC ISAPI Filter 2012)

Adversaries may also install malicious IIS modules to observe and/or modify traffic. IIS 7.0 introduced modules that provide the same unrestricted access to HTTP requests and responses as ISAPI extensions and filters. IIS modules can be written as a DLL that exports RegisterModule, or as a .NET application that interfaces with ASP.NET APIs to access IIS HTTP requests.(Citation: Microsoft IIS Modules Overview 2007)(Citation: Trustwave IIS Module 2013)(Citation: ESET IIS Malware 2021)

Atomic Tests

Atomic Test #1 - Install IIS Module using AppCmd.exe

The following Atomic will utilize AppCmd.exe to install a new IIS Module. IIS must be installed. This atomic utilizes a DLL on disk, but to test further suspiciousness, compile and load IIS-Raid. A successful execution will install a module into IIS using AppCmd.exe. Managing and installing Modules Reference IIS Modules

Supported Platforms: windows

auto_generated_guid: 53adbdfa-8200-490c-871c-d3b1ab3324b2

Inputs:

Name Description Type Default Value
module_name The name of the IIS module string DefaultDocumentModule_Atomic
dll_path The path to the DLL to be loaded path %windir%\system32\inetsrv\defdoc.dll

Attack Commands: Run with command_prompt!

1
2
%windir%\system32\inetsrv\appcmd.exe install module /name:#{module_name} /image:#{dll_path}

Cleanup Commands:

1
2
%windir%\system32\inetsrv\appcmd.exe uninstall module #{module_name}

Dependencies: Run with powershell!

Description: IIS must be installed in order to add a module to IIS.

Check Prereq Commands:

1
2
3
$service = get-service w3svc -ErrorAction SilentlyContinue
if($service){ Write-Host "IIS installed on $env:computername" } else { Write-Host "IIS is not installed on $env:computername" } 

Get Prereq Commands:

1
2
Install IIS to continue.

Atomic Test #2 - Install IIS Module using PowerShell Cmdlet New-WebGlobalModule

The following Atomic will utilize PowerShell Cmdlet New-WebGlobalModule to install a new IIS Module. IIS must be installed. This atomic utilizes a DLL on disk, but to test further suspiciousness, compile and load IIS-Raid. A successful execution will install a module into IIS using New-WebGlobalModule. Managing IIS Modules with PowerShell IIS Modules

Supported Platforms: windows

auto_generated_guid: cc3381fb-4bd0-405c-a8e4-6cacfac3b06c

Inputs:

Name Description Type Default Value
module_name The name of the IIS module string DefaultDocumentModule_Atomic
dll_path The path to the DLL to be loaded path %windir%\system32\inetsrv\defdoc.dll

Attack Commands: Run with powershell!

1
2
New-WebGlobalModule -Name #{module_name} -Image #{dll_path}

Cleanup Commands:

1
2
Remove-WebGlobalModule -Name #{module_name}

Dependencies: Run with powershell!

Description: IIS must be installed in order to add a module to IIS.

Check Prereq Commands:

1
2
3
$service = get-service w3svc -ErrorAction SilentlyContinue
if($service){ Write-Host "IIS installed on $env:computername" } else { Write-Host "IIS is not installed on $env:computername" } 

Get Prereq Commands:

1
2
Install IIS to continue.

source