← Back to BrewedIntel
malwarehighBackdoorPost-ExploitationWebshell

Apr 02, 2026 • Microsoft Defender Security Research Team

Cookie-controlled PHP webshells: A stealthy tradecraft in Linux hosting environments

Microsoft researchers have documented a sophisticated webshell technique that uses HTTP cookies as a covert control channel for PHP-based backdoors on Linux...

Source
Microsoft Security Blog
Category
malware
Severity
high

Executive Summary

Microsoft researchers have documented a sophisticated webshell technique that uses HTTP cookies as a covert control channel for PHP-based backdoors on Linux servers. These cookie-gated webshells remain dormant until specific attacker-supplied cookie values are present, reducing visibility in normal traffic and evading traditional inspection controls. Observed variants include layered obfuscation loaders, direct cookie-driven payload stagers, and interactive webshells with file upload capabilities. The technique leverages PHP superglobals, runtime function reconstruction, and staged execution to evade pattern-based detection. Mitigations include Microsoft Defender XDR detection capabilities and standard hardening practices for PHP environments. Organizations should enhance web traffic monitoring and implement additional logging for cookie-based interactions.

Summary

Cookie-gated PHP webshells use obfuscation, php-fpm execution, and cron-based persistence to evade detection in Linux hosting environments. This post examines how this tradecraft conceals execution behind specially crafted HTTP cookies. The post Cookie-controlled PHP webshells: A stealthy tradecraft in Linux hosting environments appeared first on Microsoft Security Blog .

Published Analysis

Microsoft researchers have documented a sophisticated webshell technique that uses HTTP cookies as a covert control channel for PHP-based backdoors on Linux servers. These cookie-gated webshells remain dormant until specific attacker-supplied cookie values are present, reducing visibility in normal traffic and evading traditional inspection controls. Observed variants include layered obfuscation loaders, direct cookie-driven payload stagers, and interactive webshells with file upload capabilities. The technique leverages PHP superglobals, runtime function reconstruction, and staged execution to evade pattern-based detection. Mitigations include Microsoft Defender XDR detection capabilities and standard hardening practices for PHP environments. Organizations should enhance web traffic monitoring and implement additional logging for cookie-based interactions. Cookie-gated PHP webshells use obfuscation, php-fpm execution, and cron-based persistence to evade detection in Linux hosting environments. This post examines how this tradecraft conceals execution behind specially crafted HTTP cookies. The post Cookie-controlled PHP webshells: A stealthy tradecraft in Linux hosting environments appeared first on Microsoft Security Blog . In this article Cookie-controlled execution behavior Observed variants of cookie-controlled PHP web shells Mitigation and protection guidance Microsoft Defender XDR detections Microsoft Security Copilot prompts Microsoft Defender XDR threat analytics MITRE ATT&CK™ Techniques observed References Learn more Threat actors are increasingly abusing HTTP cookies as a control channel for PHP-based webshells on Linux servers. Instead of exposing command execution through URL parameters or request bodies, these webshells rely on threat actor-supplied cookie values to gate execution, pass instructions, and activate malicious functionality. This approach reduces visibility by allowing malicious code to remain dormant during normal application behavior and execute only when specific cookie conditions are met. This technique has been observed across multiple execution contexts, including web requests, scheduled tasks, and trusted background workers. The consistent use of cookies as a control mechanism suggests reuse of established webshell tradecraft. By shifting control logic into cookies, threat actors enable persistent post-compromise access that can evade many traditional inspection and logging controls. Cookie-controlled execution behavior Across the activity analyzed, HTTP cookies acted as the primary trigger for malicious execution. Instead of exposing functionality through visible URL parameters or request bodies, the webshell logic remained dormant unless specific cookie values were present. Only when those conditions were satisfied did the script reconstruct and execute threat actor–controlled behavior. Threat actors likely prefer this approach because cookies blend into normal web traffic and often receive less scrutiny than request paths or payloads. In PHP, cookie values are immediately available at runtime, for example through the $_COOKIE superglobal, allowing malicious code to consume attacker-supplied input without additional parsing. By shifting execution control into cookies, the webshell can remain hidden in normal traffic, activating only during deliberate interactions. This reduces routine logging and inspection visibility while enabling persistent access without frequent changes to files on disk. Observed variants of cookie-controlled PHP web shells Although the core technique remained consistent across incidents, the PHP implementations varied in structure and complexity. The following examples illustrate how attackers adapted the same cookie-controlled execution model across different environments. Loader with execution gating and layered obfuscation One observed implementation introduced an additional execution gate before processing any cookie input. The loader first evaluated request context and reconstructed core PHP functions dynamically using arithmetic operations and string manipulation. Sensitive function names were intentionally absent in cleartext, significantly reducing obvious indicators and complicating pattern-based detection. After the initial base64 decoding, the PHP script did not immediately reveal obvious command functionality. Instead, it exposed a second, deliberate layer of obfuscation. Critical operations were rebuilt programmatically at runtime, with function names and execution logic assembled character-by-character. This design ensured that meaningful behavior remained concealed until execution conditions were satisfied. Only after these runtime checks passed did the script begin parsing structured cookie input. Cookie values were segmented and transformed into function identifiers, file paths, and decoding routines. If a secondary payload was not already present, the loader reconstructed it from encoded data, wrote it to a dynamically determined...