Skip to content

Commit e116665

Browse files
Aegrahimays11
andauthored
[New Rule] Web Server Potential Remote File Inclusion Activity (#5394)
* [New Rule] Web Server Potential Remote File Inclusion Activity * Add min_stack_version and comments to TOML file Added minimum stack version and comments for clarity. * Update rules/cross-platform/discovery_web_server_remote_file_inclusion_activity.toml Co-authored-by: Isai <[email protected]> * Add data_stream.namespace to event stats --------- Co-authored-by: Isai <[email protected]>
1 parent 4920e9a commit e116665

File tree

1 file changed

+100
-0
lines changed

1 file changed

+100
-0
lines changed
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
[metadata]
2+
creation_date = "2025/12/02"
3+
integration = ["nginx", "apache", "apache_tomcat", "iis"]
4+
maturity = "production"
5+
min_stack_version = "9.2.0"
6+
min_stack_comments = "The esql url_decode() operator was introduced in version 9.2.0"
7+
updated_date = "2025/12/02"
8+
9+
[rule]
10+
author = ["Elastic"]
11+
description = """
12+
This rule detects potential Remote File Inclusion (RFI) activity on web servers by identifying HTTP GET requests that
13+
attempt to access sensitive remote files through directory traversal techniques or known file paths. Attackers may
14+
exploit RFI vulnerabilities to read sensitive files, gain system information, or further compromise the server.
15+
"""
16+
from = "now-11m"
17+
interval = "10m"
18+
language = "esql"
19+
license = "Elastic License v2"
20+
name = "Web Server Potential Remote File Inclusion Activity"
21+
risk_score = 21
22+
rule_id = "45d099b4-a12e-4913-951c-0129f73efb41"
23+
severity = "low"
24+
tags = [
25+
"Domain: Web",
26+
"Use Case: Threat Detection",
27+
"Tactic: Discovery",
28+
"Tactic: Command and Control",
29+
"Data Source: Nginx",
30+
"Data Source: Apache",
31+
"Data Source: Apache Tomcat",
32+
"Data Source: IIS",
33+
]
34+
timestamp_override = "event.ingested"
35+
type = "esql"
36+
query = '''
37+
from
38+
logs-nginx.access-*,
39+
logs-apache.access-*,
40+
logs-apache_tomcat.access-*,
41+
logs-iis.access-*
42+
| where
43+
http.request.method == "GET" and
44+
http.response.status_code == 200 and
45+
url.original like "*=*"
46+
47+
| eval Esql.url_original_url_decoded_to_lower = to_lower(URL_DECODE(url.original))
48+
49+
| where
50+
Esql.url_original_url_decoded_to_lower like "*=http://*" or
51+
Esql.url_original_url_decoded_to_lower like "*=https://*" or
52+
Esql.url_original_url_decoded_to_lower like "*=ftp://*" or
53+
Esql.url_original_url_decoded_to_lower like "*=smb://*" or
54+
Esql.url_original_url_decoded_to_lower like "*=file://*" or
55+
Esql.url_original_url_decoded_to_lower rlike """.*=.*[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}.*"""
56+
57+
| keep
58+
@timestamp,
59+
Esql.url_original_url_decoded_to_lower,
60+
source.ip,
61+
agent.id,
62+
host.name,
63+
http.request.method,
64+
http.response.status_code,
65+
event.dataset,
66+
data_stream.namespace
67+
68+
| stats
69+
Esql.event_count = count(),
70+
Esql.url_original_url_decoded_to_lower_count_distinct = count_distinct(Esql.url_original_url_decoded_to_lower),
71+
Esql.host_name_values = values(host.name),
72+
Esql.agent_id_values = values(agent.id),
73+
Esql.http_request_method_values = values(http.request.method),
74+
Esql.http_response_status_code_values = values(http.response.status_code),
75+
Esql.url_original_url_decoded_to_lower_values = values(Esql.url_original_url_decoded_to_lower),
76+
Esql.event_dataset_values = values(event.dataset),
77+
Esql.data_stream_namespace_values = values(data_stream.namespace)
78+
by source.ip
79+
'''
80+
81+
[[rule.threat]]
82+
framework = "MITRE ATT&CK"
83+
84+
[[rule.threat.technique]]
85+
id = "T1083"
86+
name = "File and Directory Discovery"
87+
reference = "https://attack.mitre.org/techniques/T1083/"
88+
89+
[rule.threat.tactic]
90+
id = "TA0007"
91+
name = "Discovery"
92+
reference = "https://attack.mitre.org/tactics/TA0007/"
93+
94+
[[rule.threat]]
95+
framework = "MITRE ATT&CK"
96+
97+
[rule.threat.tactic]
98+
id = "TA0011"
99+
name = "Command and Control"
100+
reference = "https://attack.mitre.org/tactics/TA0011/"

0 commit comments

Comments
 (0)