T1056.003

Web Portal Capture

Adversaries may install code on externally facing portals, such as a VPN login page, to capture and transmit credentials of users who attempt to log into the service. A compromised login page may log provided user credentials before logging the user in to the service. This variation on input capture may be conducted post-compromise using legitimate administrative access as a backup measure to maintain network access through External Remote Services and Valid Accounts, or as part of the initial compromise by exploitation of the externally facing web service. Notable examples include IceApple's OWA credential logger, WARPWIRE targeting Ivanti VPN portals, and Winter Vivern mimicking government email logon sites.

Microsoft Sentinel / Defender
kusto
let WebPortalPaths = dynamic([
  "\\inetpub\\", "\\wwwroot\\", "\\webroot\\",
  "\\pulse\\", "\\juniper\\", "\\vpn\\",
  "\\owa\\", "\\ecp\\", "\\exchange\\",
  "\\fortiweb\\", "\\sslvpn\\", "\\remote\\",
  "/var/www/", "/opt/web/", "/usr/share/"
]);
let SuspiciousWebFileExtensions = dynamic([".php", ".aspx", ".asp", ".jsp", ".js", ".html", ".htm", ".config"]);
let CredentialKeywords = dynamic(["password", "passwd", "credential", "username", "login", "auth", "token", "session", "cookie"]);
// Detection 1: File modification in web portal directories by web server processes
let WebFileModifications = DeviceFileEvents
| where Timestamp > ago(24h)
| where ActionType in ("FileCreated", "FileModified")
| where InitiatingProcessFileName in~ ("w3wp.exe", "httpd", "nginx", "apache2", "tomcat", "java", "node", "python", "ruby", "php-cgi", "php")
    or FolderPath has_any (WebPortalPaths)
| where FileName has_any (SuspiciousWebFileExtensions)
| extend IsWebServerProcess = InitiatingProcessFileName in~ ("w3wp.exe", "httpd", "nginx", "apache2")
| extend IsWebPath = FolderPath has_any (WebPortalPaths)
| project Timestamp, DeviceName, ActionType, FolderPath, FileName,
         InitiatingProcessFileName, InitiatingProcessCommandLine,
         InitiatingProcessAccountName, IsWebServerProcess, IsWebPath;
// Detection 2: Suspicious script execution by web server processes with credential-related content
let WebProcessExecution = DeviceProcessEvents
| where Timestamp > ago(24h)
| where InitiatingProcessFileName in~ ("w3wp.exe", "httpd", "nginx", "apache2", "iisexpress.exe")
    or (FileName in~ ("cmd.exe", "powershell.exe", "sh", "bash", "python", "python3", "perl") 
        and InitiatingProcessFileName in~ ("w3wp.exe", "httpd", "nginx", "apache2"))
| extend IsChildShell = FileName in~ ("cmd.exe", "powershell.exe", "sh", "bash")
| project Timestamp, DeviceName, FileName, ProcessCommandLine,
         InitiatingProcessFileName, InitiatingProcessCommandLine,
         AccountName, IsChildShell;
// Detection 3: Registry modifications by web processes (persistence of credential capture code)
let WebRegistryChanges = DeviceRegistryEvents
| where Timestamp > ago(24h)
| where InitiatingProcessFileName in~ ("w3wp.exe", "httpd", "nginx", "apache2", "iisexpress.exe")
| where ActionType in ("RegistryValueSet", "RegistryKeyCreated")
| project Timestamp, DeviceName, ActionType, RegistryKey, RegistryValueName, RegistryValueData,
         InitiatingProcessFileName, InitiatingProcessAccountName;
WebFileModifications
| union WebProcessExecution
| union WebRegistryChanges
| extend DetectionSource = case(
    isnotempty(ActionType) and ActionType in ("FileCreated", "FileModified"), "WebFileModification",
    isnotempty(FileName) and FileName in~ ("cmd.exe", "powershell.exe", "sh", "bash"), "WebShellExecution",
    isnotempty(RegistryKey), "WebRegistryChange",
    "Unknown")
| sort by Timestamp desc
high severity medium confidence

Data Sources

File: File Creation File: File Modification Process: Process Creation Windows Registry: Registry Key Modification Microsoft Defender for Endpoint

Required Tables

DeviceFileEvents DeviceProcessEvents DeviceRegistryEvents

False Positives

  • Legitimate web application deployments or updates that modify web portal files via w3wp.exe or deployment scripts
  • Web application frameworks (ASP.NET, PHP) dynamically generating or caching compiled files in wwwroot directories
  • Security scanning tools or web application firewalls writing log or config files to web directories
  • IIS application pool recycles or maintenance scripts spawning cmd.exe or powershell.exe for configuration tasks

Unlock Pro Content

Get the full detection package for T1056.003 including response playbook, investigation guide, and atomic red team tests.

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections