PHP File Creation in WordPress Plugin Directory
Detects the creation of a PHP file in the WordPress plugin directory, which is a common technique used by attackers to establish persistence on a compromised web server. Attackers may upload a malicious PHP file and call it from a web browser to gain remote access to the server.
Elastic rule (View on GitHub)
1[metadata]
2creation_date = "2026/07/20"
3integration = ["endpoint"]
4maturity = "production"
5updated_date = "2026/07/22"
6
7[rule]
8author = ["Elastic"]
9description = """
10Detects the creation of a PHP file in the WordPress plugin directory, which is a common technique used
11by attackers to establish persistence on a compromised web server. Attackers may upload a malicious PHP
12file and call it from a web browser to gain remote access to the server.
13"""
14false_positives = [
15 """
16 Web servers or administrators may create PHP files in the WordPress plugin directory during maintenance.
17 """,
18]
19from = "now-9m"
20index = ["logs-endpoint.events.file*"]
21language = "eql"
22license = "Elastic License v2"
23name = "PHP File Creation in WordPress Plugin Directory"
24references = [
25 "https://github.com/Icex0/wp2shell-poc",
26]
27risk_score = 21
28rule_id = "fb76c80b-3eb2-4c56-9ed1-e4c529425d0f"
29setup = """## Setup
30
31This rule requires data coming in from Elastic Defend.
32
33### Elastic Defend Integration Setup
34Elastic 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.
35
36#### Prerequisite Requirements:
37- Fleet is required for Elastic Defend.
38- To configure Fleet Server refer to the [documentation](https://www.elastic.co/guide/en/fleet/current/fleet-server.html).
39
40#### The following steps should be executed in order to add the Elastic Defend integration on a Linux System:
41- Go to the Kibana home page and click "Add integrations".
42- In the query bar, search for "Elastic Defend" and select the integration to see more details about it.
43- Click "Add Elastic Defend".
44- Configure the integration name and optionally add a description.
45- Select the type of environment you want to protect, either "Traditional Endpoints" or "Cloud Workloads".
46- 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).
47- We suggest selecting "Complete EDR (Endpoint Detection and Response)" as a configuration setting, that provides "All events; all preventions"
48- 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.
49For more details on Elastic Agent configuration settings, refer to the [helper guide](https://www.elastic.co/guide/en/fleet/8.10/agent-policy.html).
50- Click "Save and Continue".
51- 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.
52For more details on Elastic Defend refer to the [helper guide](https://www.elastic.co/guide/en/security/current/install-endpoint.html).
53"""
54severity = "low"
55tags = [
56 "Domain: Endpoint",
57 "OS: Linux",
58 "Use Case: Threat Detection",
59 "Tactic: Persistence",
60 "Tactic: Initial Access",
61 "Use Case: Vulnerability",
62 "Data Source: Elastic Defend"
63]
64timestamp_override = "event.ingested"
65type = "eql"
66query = '''
67file where host.os.type == "linux" and event.type in ("creation", "change") and (
68 process.name in (
69 "nginx", "apache2", "httpd", "php-cgi", "php-fcgi", "php-cgi.cagefs", "sw-engine-fpm",
70 "wget", "curl", "bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish", "mksh", "busybox"
71 ) or
72 process.name like ("php-fpm*", "lsphp*", "*.cgi", "*.fcgi")
73) and
74file.path like~ "*/wp-content/plugins/*"
75'''
76
77[[rule.threat]]
78framework = "MITRE ATT&CK"
79
80[[rule.threat.technique]]
81id = "T1505"
82name = "Server Software Component"
83reference = "https://attack.mitre.org/techniques/T1505/"
84
85[[rule.threat.technique.subtechnique]]
86id = "T1505.003"
87name = "Web Shell"
88reference = "https://attack.mitre.org/techniques/T1505/003/"
89
90[rule.threat.tactic]
91id = "TA0003"
92name = "Persistence"
93reference = "https://attack.mitre.org/tactics/TA0003/"
94
95[[rule.threat]]
96framework = "MITRE ATT&CK"
97
98[[rule.threat.technique]]
99id = "T1190"
100name = "Exploit Public-Facing Application"
101reference = "https://attack.mitre.org/techniques/T1190/"
102
103[rule.threat.tactic]
104id = "TA0001"
105name = "Initial Access"
106reference = "https://attack.mitre.org/tactics/TA0001/"
107
108[[rule.threat]]
109framework = "MITRE ATT&CK"
110
111[[rule.threat.technique]]
112id = "T1059"
113name = "Command and Scripting Interpreter"
114reference = "https://attack.mitre.org/techniques/T1059/"
115
116[rule.threat.tactic]
117id = "TA0002"
118name = "Execution"
119reference = "https://attack.mitre.org/tactics/TA0002/"
References
Related rules
- Suspicious Child Execution via Web Server
- Suspicious Command Execution via Web Server
- Potential Webshell Deployed via Apache Struts CVE-2023-50164 Exploitation
- Initial Access via File Upload Followed by GET Request
- Potential Telnet Authentication Bypass (CVE-2026-24061)