T1491.002

External Defacement

Adversaries may deface systems external to an organization in an attempt to deliver messaging, intimidate, or otherwise mislead an organization or users. External Defacement may ultimately cause users to distrust the systems and to question/discredit the system's integrity. Externally-facing websites are a common victim of defacement; often targeted by adversary and hacktivist groups in order to push a political message or spread propaganda. External Defacement may be used as a catalyst to trigger events, or as a response to actions taken by an organization or government. Similarly, website defacement may also be used as setup, or a precursor, for future attacks such as Drive-by Compromise. Notable examples include Ember Bear's defacement of Ukrainian organization websites and Sandworm Team's defacement of approximately 15,000 Georgian government and private sector websites in 2019.

Microsoft Sentinel / Defender
kusto
let WebServerProcesses = dynamic(["w3wp.exe", "httpd.exe", "nginx.exe", "php-cgi.exe", "php.exe", "tomcat.exe", "java.exe", "apache.exe"]);
let ShellProcesses = dynamic(["cmd.exe", "powershell.exe", "pwsh.exe", "wscript.exe", "cscript.exe", "bash", "sh", "python.exe", "python3", "perl.exe", "mshta.exe"]);
let WebRootPaths = dynamic(["\\inetpub\\wwwroot\\", "\\wwwroot\\", "\\htdocs\\", "\\public_html\\", "\\web\\", "\\webroot\\"]);
let WebFileExtensions = dynamic([".html", ".htm", ".asp", ".aspx", ".php", ".js", ".css", ".jsp"]);
// Branch 1: Web server processes spawning shells (indicates RCE/web shell exploitation)
let WebShellBranch = DeviceProcessEvents
| where Timestamp > ago(24h)
| where InitiatingProcessFileName has_any (WebServerProcesses)
| where FileName has_any (ShellProcesses)
| extend DetectionType = "WebServerSpawnedShell"
| extend Severity = "Critical"
| project Timestamp, DeviceName, AccountName, FileName, FolderPath = "",
         ProcessCommandLine, InitiatingProcessFileName, InitiatingProcessCommandLine,
         DetectionType, Severity;
// Branch 2: Non-standard processes modifying web root content files
let FileModBranch = DeviceFileEvents
| where Timestamp > ago(24h)
| where ActionType in ("FileCreated", "FileModified")
| where FolderPath has_any (WebRootPaths)
| where FileName has_any (WebFileExtensions)
    or FileName in~ ("index.html", "index.php", "index.asp", "index.aspx",
                     "default.htm", "default.asp", "default.aspx", "home.html")
| where InitiatingProcessFileName !in~ ("svchost.exe", "TrustedInstaller.exe",
         "WaAppAgent.exe", "msiexec.exe", "WUDFHost.exe", "MicrosoftEdgeUpdate.exe")
| extend DetectionType = "WebFileModified"
| extend Severity = iff(InitiatingProcessFileName has_any (ShellProcesses), "High", "Medium")
| project Timestamp, DeviceName, AccountName = InitiatingProcessAccountName,
         FileName, FolderPath, ProcessCommandLine = InitiatingProcessCommandLine,
         InitiatingProcessFileName, InitiatingProcessCommandLine,
         DetectionType, Severity;
WebShellBranch
| union FileModBranch
| sort by Timestamp desc
high severity medium confidence

Data Sources

Process: Process Creation File: File Modification Microsoft Defender for Endpoint

Required Tables

DeviceProcessEvents DeviceFileEvents

False Positives

  • CI/CD deployment agents (Jenkins agents, GitHub Actions runners, Azure DevOps build agents) writing updated web content to wwwroot as part of legitimate deployments
  • CMS auto-update processes — WordPress, Drupal, and Joomla modify PHP and HTML files during plugin, theme, or core updates, often via the same httpd or php-fpm worker process
  • Web developers directly editing files on development or staging servers via SSH, FTP, or mounted network shares, where the modifying process is an editor (code.exe, notepad++.exe) that is excluded
  • IIS Application Initialization Module or health-check handlers causing w3wp.exe to spawn cmd.exe for application warmup or custom startup scripts
  • Monitoring and observability agents (Datadog agent, New Relic, Dynatrace OneAgent) that instrument web server processes and may appear as unexpected child processes of w3wp.exe or httpd

Unlock Pro Content

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

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections