Microsoft Details PHP Webshell Tradecraft and Defender Hunting Guidance for Linux Hosting

Summary
Microsoft describes attackers using exposed web applications and hosting tools such as cPanel to deploy PHP webshells, encoded payloads and cron persistence on Linux hosts, and provides Defender detections, Copilot promptbooks and hunting queries.
Key points
- Microsoft describes attackers gaining access through exposed web applications or hosting environments and deploying PHP webshells in web-accessible directories.
- Reported persistence methods include cron jobs, sometimes recurring every minute, and PHP files such as index.php.
- The described activity uses obfuscated or base64-encoded payloads, decoded at runtime, and may retrieve additional scripts with curl or wget.
- Microsoft Defender coverage targets suspicious shell execution by web-server processes, cron job creation, PHP file writes, and file-permission changes; the article says active WebShell and Obfuse samples were blocked.
- Microsoft provides Advanced Hunting queries for web-server-spawned shells, base64 or tee-based PHP writes, cPanel or jailshell activity, and repeated cron execution.
- Security Copilot promptbooks are offered to assist with incident investigation and analysis of obfuscated or encoded scripts.
Article Details
- Defense Focus
- Detect and investigate PHP webshell deployment, cron-based persistence, encoded payloads, and suspicious shell activity originating from web-facing services in Linux hosting environments.
- Detection Methods
- Hunt for web-server processes such as php-fpm, httpd, apache2, or nginx spawning bash, sh, or dash.
- Identify shell commands containing both base64 and .php, or using tee to write PHP files.
- Investigate cPanel or jailshell process activity associated with suspicious file writes or cron-job creation.
- Correlate web-server or cron process activity with base64 commands and references to .php, public_html, or vendor paths.
- Look for backend workers unexpectedly spawning shells and for repeated cron execution patterns, including more than 10 executions within a one-minute interval.
- Review alerts for suspicious script execution, cron-job creation, file or directory permission changes, and active WebShell or Obfuse detections.
- Data Sources
- Microsoft Defender XDR DeviceProcessEvents, including process names, initiating process names, command lines, file paths, timestamps, device names, and account names.
- Microsoft Defender for Endpoint alerts concerning suspicious scripts, shell commands, cron jobs, elevated processes, and file or directory permission changes.
- Microsoft Defender Antivirus detections for active WebShell and Obfuse samples.
- Web-accessible PHP files and cron-job activity on hosting environments.
- Rule Types
- Microsoft Defender XDR Advanced Hunting queries written in Kusto Query Language (KQL).
- Platforms
- Linux hosting environments
- Microsoft Defender for Endpoint
- Microsoft Defender Antivirus
- Microsoft Defender XDR
- Microsoft Sentinel
- Microsoft Security Copilot
- Defensive Actions
- Use the provided Advanced Hunting queries to investigate web-server-spawned shells, base64 or tee-based PHP writes, cPanel or jailshell activity, unexpected backend-worker shells, and frequent cron execution.
- Inspect newly created or modified PHP files in web-accessible directories and review associated file and directory permissions.
- Review cron jobs for recurring or attacker-controlled commands, including short-interval execution.
- Analyze obfuscated or encoded scripts and payloads during incident triage, including runtime base64 decoding behavior.
- Investigate and respond to Defender alerts for webshell deployment and block detected active malware.
MITRE ATT&CK
T1027 · Obfuscated Files or InformationScripts and payloads are obfuscated or encoded, including with high-entropy strings and base64 blobs, to evade inspection.T1053.003 · CronCron jobs, including jobs created through hosting tooling and recurring one-minute patterns, are used to establish persistence.T1059.004 · Unix ShellWeb-facing processes such as php-fpm, apache2, or nginx spawn sh, bash, or dash to execute commands associated with webshell logic or injected requests.T1105 · Ingress Tool TransferThe article describes retrieving additional files or second-stage scripts with curl or wget and writing them into web directories or application paths.T1140 · Deobfuscate/Decode Files or InformationInline payloads are decoded at runtime with commands such as base64 -d to reconstruct PHP content on disk.T1190 · Exploit Public-Facing ApplicationThe article describes attackers gaining access through exposed web applications or hosting environments before introducing server-side tooling.T1222.002 · Linux and Mac PermissionsFile or directory permissions in web paths are modified to enable write or execute access or keep persistence artifacts accessible.T1505.003 · Web ShellA PHP webshell such as index.php is placed in a web-accessible location to maintain access through HTTP requests.
People
Vendors
Products
Microsoft Defender Antimalware PlatformMicrosoft Security Copilot augments Microsoft Defender capabilities to help security teams investigate web shell and post-compromise incidents by analyzing obfuscated or encoded scripts and accelerating triage.Microsoft Defender AntivirusMicrosoft Defender Antivirus An active ‘Webshell’ malware was blocked ‘WebShell’ malware was prevented An active ‘Obfuse’ malware was blocked Microsoft Defender for EndpointMicrosoft Defender for Endpoint and Defender Antivirus detect suspicious script execution, cron job creation, modified web files/permissions, and blocked active WebShell and Obfuse samples.Microsoft Defender XDRNote that some promptbooks require access to plugins for Microsoft products such as Microsoft Defender XDR or Microsoft Sentinel.Microsoft Security CopilotMicrosoft Security Copilot augments Microsoft Defender capabilities to help security teams investigate web shell and post-compromise incidents by analyzing obfuscated or encoded scripts and accelerating triage.Microsoft SentinelNote that some promptbooks require access to plugins for Microsoft products such as Microsoft Defender XDR or Microsoft Sentinel.
