File with Suspicious Double Extension Created by Web Server
This rule detects when a web server process creates a file with a double extension, where the real extension is a non-web extension. This is a common technique used by attackers to bypass security measures and to hide the true nature of the file.
Elastic rule (View on GitHub)
1[metadata]
2creation_date = "2026/09/07"
3integration = ["endpoint"]
4maturity = "production"
5updated_date = "2026/09/18"
6
7[rule]
8author = ["Elastic"]
9description = """
10This rule detects when a web server process creates a file with a double extension, where the
11real extension is a non-web extension. This is a common technique used by attackers to bypass security
12measures and to hide the true nature of the file.
13"""
14from = "now-9m"
15index = ["logs-endpoint.events.file*"]
16language = "eql"
17license = "Elastic License v2"
18name = "File with Suspicious Double Extension Created by Web Server"
19note = """## Triage and analysis
20
21> **Disclaimer**:
22> This investigation guide was created using generative AI technology and has been reviewed to improve its accuracy and relevance. While every effort has been made to ensure its quality, we recommend validating the content and adapting it to suit your specific environment and operational needs.
23
24### Investigating File with Suspicious Double Extension Created by Web Server
25
26This rule identifies Linux web server processes creating files whose names combine a web-executable suffix with a misleading image, archive, script, or binary extension, a pattern often used to conceal malicious content and bypass upload controls. For example, an attacker exploiting an upload endpoint may write `shell.php.jpg` into a served directory, then rely on a permissive or manipulated server configuration to execute it as a web shell for persistent remote access.
27
28### Possible investigation steps
29
30- Record the file’s full path, ownership, permissions, timestamps, cryptographic hash, MIME type, and magic bytes, then safely inspect its contents for obfuscated code, command execution, credential theft, or web-shell functionality.
31- Review virtual-host, handler, rewrite, and directory configuration to determine whether the file is web-accessible or interpreted as executable content despite its final extension.
32- Correlate the creation time with HTTP access, application, proxy, and authentication logs to identify the originating request, source address, user session, upload endpoint, and related reconnaissance or exploitation attempts.
33- Examine the creating process lineage and subsequent activity for spawned shells, interpreters, system utilities, outbound connections, privilege escalation, persistence changes, or additional file writes.
34- Hunt across endpoints and web logs for the file hash, naming pattern, source address, request indicators, and similar artifacts, and isolate the server while preserving evidence if malicious activity is confirmed.
35
36### False positive analysis
37
38- A legitimate upload or content-management workflow may preserve a user-supplied filename such as `template.php.jpg`; verify the associated HTTP request, authenticated user, expected upload path, file MIME type, and application behavior.
39- A deployment, backup, or testing process run through a web application may generate files such as `page.jsp.zip` or `handler.cgi.sh`; verify the change record, process lineage, file contents, ownership, and whether the destination is expected and non-executable.
40
41### Response and remediation
42
43- Isolate the affected web server from untrusted networks, restrict administrative access, preserve the suspicious file and relevant logs, and block identified source addresses, hashes, domains, and URLs.
44- Remove the double-extension file and any related web shells, unauthorized accounts, SSH keys, cron jobs, systemd units, startup scripts, modified web-server handlers, and attacker-created files after preserving forensic copies.
45- Rotate exposed application, database, service-account, API, and administrative credentials, revoke active sessions and tokens, and replace potentially compromised TLS or SSH keys.
46- Escalate immediately to incident response if the web server spawned shells, made suspicious outbound connections, accessed credentials, gained elevated privileges, or produced evidence of lateral movement or additional compromised hosts.
47- Rebuild the server from a known-good image or restore verified clean application content and configuration, patch the exploited web application or server component, and validate integrity before returning it to service.
48- Prevent recurrence by enforcing upload allowlists and content validation, storing uploads outside executable web roots, disabling script execution in upload directories, applying least-privilege permissions, and monitoring for similar filenames and web-process child activity.
49"""
50risk_score = 73
51rule_id = "5fc7e978-4fa0-47e9-a8e0-bad853c8d09b"
52setup = """## Setup
53
54This rule requires data coming in from Elastic Defend.
55
56### Elastic Defend Integration Setup
57Elastic Defend is integrated into the Elastic Agent using Fleet. Upon configuration, the integration allows the Elastic Agent to monitor events on your host and send data to the Elastic Security app.
58
59#### Prerequisite Requirements:
60- Fleet is required for Elastic Defend.
61- To configure Fleet Server refer to the [documentation](https://www.elastic.co/guide/en/fleet/current/fleet-server.html).
62
63#### The following steps should be executed in order to add the Elastic Defend integration on a Linux System:
64- Go to the Kibana home page and click "Add integrations".
65- In the query bar, search for "Elastic Defend" and select the integration to see more details about it.
66- Click "Add Elastic Defend".
67- Configure the integration name and optionally add a description.
68- Select the type of environment you want to protect, either "Traditional Endpoints" or "Cloud Workloads".
69- Select a configuration preset. Each preset comes with different default settings for Elastic Agent, you can further customize these later by configuring the Elastic Defend integration policy. [Helper guide](https://www.elastic.co/guide/en/security/current/configure-endpoint-integration-policy.html).
70- We suggest selecting "Complete EDR (Endpoint Detection and Response)" as a configuration setting, that provides "All events; all preventions"
71- Enter a name for the agent policy in "New agent policy name". If other agent policies already exist, you can click the "Existing hosts" tab and select an existing policy instead.
72For more details on Elastic Agent configuration settings, refer to the [helper guide](https://www.elastic.co/guide/en/fleet/8.10/agent-policy.html).
73- Click "Save and Continue".
74- To complete the integration, select "Add Elastic Agent to your hosts" and continue to the next section to install the Elastic Agent on your hosts.
75For more details on Elastic Defend refer to the [helper guide](https://www.elastic.co/guide/en/security/current/install-endpoint.html).
76"""
77severity = "high"
78tags = [
79 "Domain: Endpoint",
80 "OS: Linux",
81 "Use Case: Threat Detection",
82 "Use Case: Vulnerability",
83 "Tactic: Persistence",
84 "Tactic: Initial Access",
85 "Tactic: Lateral Movement",
86 "Data Source: Elastic Defend",
87 "Rule Type: Event Correlation (EQL)",
88 "Resources: Investigation Guide",
89 "Platform: Linux",
90]
91timestamp_override = "event.ingested"
92type = "eql"
93query = '''
94file where host.os.type == "linux" and event.action != "deletion" and
95(
96 process.name in (
97 "nginx", "apache2", "httpd", "caddy", "lighttpd", "httpd.worker", "httpd-worker", "httpd-prefork",
98 "php-cgi", "php-fcgi", "php-cgi.cagefs", "frankenphp", "lshttpd", "litespeed", "openlitespeed",
99 "fcgiwrap", "uwsgi", "daphne", "uvicorn", "hypercorn", "granian", "waitress-serve", "flask", "puma",
100 "unicorn", "unicorn_rails", "thin", "rackup", "mongrel_rails", "starman", "plackup", "twiggy",
101 "hypnotoad", "starlet", "unitd", "unitd-debug", "java", "node", "nodejs", "varnishd"
102 ) or
103 process.name like (
104 "php-fpm*", "lsphp*", "gunicorn*", "*.cgi", "*.fcgi", "mono*", "xsp*", "mod-mono-server*",
105 "fastcgi-mono-server*", "python*", "ruby*", "perl*", "lua*"
106 )
107) and
108file.name like~ (
109 "*.php.*", "*.php3.*", "*.php4.*", "*.php5.*", "*.php7.*", "*.php8.*", "*.phtml.*", "*.pht.*",
110 "*.asp.*", "*.aspx.*", "*.ashx.*", "*.asmx.*", "*.jsp.*", "*.jspx.*", "*.cfm.*", "*.cfc.*",
111 "*.cshtml.*", "*.razor.*", "*.cgi.*", "*.fcgi.*", "*.php;*", "*.asp;*", "*.aspx;*", "*.jsp;*"
112) and
113file.extension in~ (
114 "jpg", "jpeg", "png", "gif", "webp", "bmp", "ico", "tif", "tiff", "svg", "zip",
115 "sh", "elf"
116)
117'''
118
119[[rule.threat]]
120framework = "MITRE ATT&CK"
121
122 [rule.threat.tactic]
123 name = "Persistence"
124 id = "TA0003"
125 reference = "https://attack.mitre.org/tactics/TA0003/"
126
127 [[rule.threat.technique]]
128 id = "T1505"
129 name = "Server Software Component"
130 reference = "https://attack.mitre.org/techniques/T1505/"
131
132 [[rule.threat.technique.subtechnique]]
133 id = "T1505.003"
134 name = "Web Shell"
135 reference = "https://attack.mitre.org/techniques/T1505/003/"
136
137[[rule.threat]]
138framework = "MITRE ATT&CK"
139
140 [rule.threat.tactic]
141 name = "Initial Access"
142 id = "TA0001"
143 reference = "https://attack.mitre.org/tactics/TA0001/"
144
145 [[rule.threat.technique]]
146 name = "Exploit Public-Facing Application"
147 id = "T1190"
148 reference = "https://attack.mitre.org/techniques/T1190/"
149
150[[rule.threat]]
151framework = "MITRE ATT&CK"
152
153 [[rule.threat.technique]]
154 id = "T1210"
155 name = "Exploitation of Remote Services"
156 reference = "https://attack.mitre.org/techniques/T1210/"
157
158 [rule.threat.tactic]
159 id = "TA0008"
160 name = "Lateral Movement"
161 reference = "https://attack.mitre.org/tactics/TA0008/"
Triage and analysis
Disclaimer: This investigation guide was created using generative AI technology and has been reviewed to improve its accuracy and relevance. While every effort has been made to ensure its quality, we recommend validating the content and adapting it to suit your specific environment and operational needs.
Investigating File with Suspicious Double Extension Created by Web Server
This rule identifies Linux web server processes creating files whose names combine a web-executable suffix with a misleading image, archive, script, or binary extension, a pattern often used to conceal malicious content and bypass upload controls. For example, an attacker exploiting an upload endpoint may write shell.php.jpg into a served directory, then rely on a permissive or manipulated server configuration to execute it as a web shell for persistent remote access.
Possible investigation steps
- Record the file’s full path, ownership, permissions, timestamps, cryptographic hash, MIME type, and magic bytes, then safely inspect its contents for obfuscated code, command execution, credential theft, or web-shell functionality.
- Review virtual-host, handler, rewrite, and directory configuration to determine whether the file is web-accessible or interpreted as executable content despite its final extension.
- Correlate the creation time with HTTP access, application, proxy, and authentication logs to identify the originating request, source address, user session, upload endpoint, and related reconnaissance or exploitation attempts.
- Examine the creating process lineage and subsequent activity for spawned shells, interpreters, system utilities, outbound connections, privilege escalation, persistence changes, or additional file writes.
- Hunt across endpoints and web logs for the file hash, naming pattern, source address, request indicators, and similar artifacts, and isolate the server while preserving evidence if malicious activity is confirmed.
False positive analysis
- A legitimate upload or content-management workflow may preserve a user-supplied filename such as
template.php.jpg; verify the associated HTTP request, authenticated user, expected upload path, file MIME type, and application behavior. - A deployment, backup, or testing process run through a web application may generate files such as
page.jsp.ziporhandler.cgi.sh; verify the change record, process lineage, file contents, ownership, and whether the destination is expected and non-executable.
Response and remediation
- Isolate the affected web server from untrusted networks, restrict administrative access, preserve the suspicious file and relevant logs, and block identified source addresses, hashes, domains, and URLs.
- Remove the double-extension file and any related web shells, unauthorized accounts, SSH keys, cron jobs, systemd units, startup scripts, modified web-server handlers, and attacker-created files after preserving forensic copies.
- Rotate exposed application, database, service-account, API, and administrative credentials, revoke active sessions and tokens, and replace potentially compromised TLS or SSH keys.
- Escalate immediately to incident response if the web server spawned shells, made suspicious outbound connections, accessed credentials, gained elevated privileges, or produced evidence of lateral movement or additional compromised hosts.
- Rebuild the server from a known-good image or restore verified clean application content and configuration, patch the exploited web application or server component, and validate integrity before returning it to service.
- Prevent recurrence by enforcing upload allowlists and content validation, storing uploads outside executable web roots, disabling script execution in upload directories, applying least-privilege permissions, and monitoring for similar filenames and web-process child activity.
Related rules
- File with High Entropy Created by Web Server
- Potential Polyglot Bypass File Created by Web Server
- PHP File Creation in WordPress Plugin Directory
- Potential Telnet Authentication Bypass (CVE-2026-24061)
- Suspicious Child Execution via Web Server