Skip to content

Commit 2cb790a

Browse files
committed
[New] Connection to Common Large Language Model Endpoints
1 parent fbfc696 commit 2cb790a

File tree

1 file changed

+164
-0
lines changed

1 file changed

+164
-0
lines changed
Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
[metadata]
2+
creation_date = "2025/08/28"
3+
integration = ["endpoint"]
4+
maturity = "production"
5+
updated_date = "2025/08/28"
6+
7+
8+
[rule]
9+
author = ["Elastic"]
10+
description = """
11+
Adversaries may implement command and control (C2) communications that use common web services to hide their activity.
12+
This attack technique is typically targeted at an organization and uses web services common to the victim network, which
13+
allows the adversary to blend into legitimate traffic activity. These popular services are typically targeted since they
14+
have most likely been used before compromise, which helps malicious traffic blend in.
15+
"""
16+
from = "now-9m"
17+
index = ["logs-endpoint.events.network-*"]
18+
language = "eql"
19+
license = "Elastic License v2"
20+
name = "Connection to Common Large Language Model Endpoints"
21+
note = """## Triage and analysis
22+
23+
### Investigating Connection to Commonly Abused Web Services
24+
25+
Adversaries may use an existing, legitimate external Web service as a means for relaying data to/from a compromised system. Popular websites and social media acting as a mechanism for C2 may give a significant amount of cover due to the likelihood that hosts within a network are already communicating with them prior to a compromise.
26+
27+
This rule looks for processes outside known legitimate program locations communicating with a list of services that can be abused for exfiltration or command and control.
28+
29+
> **Note**:
30+
> This investigation guide uses the [Osquery Markdown Plugin](https://www.elastic.co/guide/en/security/current/invest-guide-run-osquery.html) introduced in Elastic Stack version 8.5.0. Older Elastic Stack versions will display unrendered Markdown in this guide.
31+
> This investigation guide uses the [Investigate Markdown Plugin](https://www.elastic.co/guide/en/security/current/interactive-investigation-guides.html) introduced in Elastic Stack version 8.8.0. Older Elastic Stack versions will display unrendered Markdown in this guide.
32+
33+
#### Possible investigation steps
34+
35+
- Investigate the process execution chain (parent process tree) for unknown processes. Examine their executable files for prevalence, whether they are located in expected locations, and if they are signed with valid digital signatures.
36+
- Investigate other alerts associated with the user/host during the past 48 hours.
37+
- $investigate_0
38+
- $investigate_1
39+
- Verify whether the digital signature exists in the executable.
40+
- Identify the operation type (upload, download, tunneling, etc.).
41+
- Examine the host for derived artifacts that indicate suspicious activities:
42+
- Analyze the process executable using a private sandboxed analysis system.
43+
- Observe and collect information about the following activities in both the sandbox and the alert subject host:
44+
- Attempts to contact external domains and addresses.
45+
- Use the Elastic Defend network events to determine domains and addresses contacted by the subject process by filtering by the process' `process.entity_id`.
46+
- $investigate_2
47+
- Examine the DNS cache for suspicious or anomalous entries.
48+
- $osquery_0
49+
- Use the Elastic Defend registry events to examine registry keys accessed, modified, or created by the related processes in the process tree.
50+
- Examine the host services for suspicious or anomalous entries.
51+
- $osquery_1
52+
- $osquery_2
53+
- $osquery_3
54+
- Retrieve the files' SHA-256 hash values using the PowerShell `Get-FileHash` cmdlet and search for the existence and reputation of the hashes in resources like VirusTotal, Hybrid-Analysis, CISCO Talos, Any.run, etc.
55+
56+
### False positive analysis
57+
58+
- This rule has a high chance to produce false positives because it detects communication with legitimate services. Noisy false positives can be added as exceptions.
59+
60+
### Response and remediation
61+
62+
- Initiate the incident response process based on the outcome of the triage.
63+
- Isolate the involved host to prevent further post-compromise behavior.
64+
- If the triage identified malware, search the environment for additional compromised hosts.
65+
- Implement temporary network rules, procedures, and segmentation to contain the malware.
66+
- Stop suspicious processes.
67+
- Immediately block the identified indicators of compromise (IoCs).
68+
- Inspect the affected systems for additional malware backdoors like reverse shells, reverse proxies, or droppers that attackers could use to reinfect the system.
69+
- Remove and block malicious artifacts identified during triage.
70+
- Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
71+
- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
72+
- Using the incident response data, update logging and audit policies to improve the mean time to detect (MTTD) and the mean time to respond (MTTR).
73+
"""
74+
references = ["https://malpedia.caad.fkie.fraunhofer.de/details/py.lamehug"]
75+
risk_score = 43
76+
rule_id = "54aa452c-a997-4f8d-b7f0-c69e56d4c05a"
77+
severity = "medium"
78+
tags = [
79+
"Domain: Endpoint",
80+
"OS: Windows",
81+
"Use Case: Threat Detection",
82+
"Tactic: Command and Control",
83+
"Resources: Investigation Guide",
84+
"Data Source: Elastic Defend",
85+
]
86+
timestamp_override = "event.ingested"
87+
type = "eql"
88+
89+
query = '''
90+
network where host.os.type == "windows" and network.protocol == "dns" and
91+
process.name != null and not ?user.id in ("S-1-5-18", "S-1-5-19", "S-1-5-20") and
92+
dns.question.name : (
93+
// Major LLM APIs
94+
"api.openai.com",
95+
"*.openai.azure.com",
96+
"api.anthropic.com",
97+
"api.mistral.ai",
98+
"api.cohere.ai",
99+
"api.ai21.com",
100+
"api.groq.com",
101+
"api.perplexity.ai",
102+
"api.x.ai",
103+
"api.deepseek.com",
104+
"api.gemini.google.com",
105+
"generativelanguage.googleapis.com",
106+
"api.azure.com",
107+
"api.bedrock.aws",
108+
"bedrock-runtime.amazonaws.com",
109+
110+
// Hugging Face & other ML infra
111+
"api-inference.huggingface.co",
112+
"inference-endpoint.huggingface.cloud",
113+
"*.hf.space",
114+
"*.replicate.com",
115+
"api.replicate.com",
116+
"api.runpod.ai",
117+
"*.runpod.io",
118+
"api.modal.com",
119+
"*.forefront.ai",
120+
121+
// Consumer-facing AI chat portals
122+
"chat.openai.com",
123+
"chatgpt.com",
124+
"copilot.microsoft.com",
125+
"bard.google.com",
126+
"gemini.google.com",
127+
"claude.ai",
128+
"perplexity.ai",
129+
"poe.com",
130+
"chat.forefront.ai",
131+
"chat.deepseek.com"
132+
)
133+
/* Insert noisy false positives here */
134+
not process.executable : (
135+
"?:\\Program Files\\*.exe",
136+
"?:\\Program Files (x86)\\*.exe",
137+
"C:\\Windows\\System32\\svchost.exe",
138+
"?:\\Users\\*\\AppData\\Local\\Google\\Chrome\\Application\\chrome.exe",
139+
"?:\\Users\\*\\AppData\\Local\\BraveSoftware\\*\\Application\\brave.exe",
140+
"?:\\Windows\\SystemApps\\Microsoft.LockApp_*\\LockApp.exe",
141+
"?:\\Users\\*\\AppData\\Local\\Vivaldi\\Application\\vivaldi.exe",
142+
"?:\\Users\\*\\AppData\\Local\\Programs\\Opera*\\opera.exe",
143+
"?:\\Users\\*\\AppData\\Local\\Programs\\Fiddler\\Fiddler.exe"
144+
) and
145+
not ?process.code_signature.subject_name like ("Anthropic, PBC", "Developer ID Application: Google LLC (*)", "Google LLC",
146+
"Brave Software, Inc.", "Developer ID Application: Mozilla Corporation (*)", "Developer ID Application: Island Technology, Inc. (*)")
147+
'''
148+
149+
150+
[[rule.threat]]
151+
framework = "MITRE ATT&CK"
152+
[[rule.threat.technique]]
153+
id = "T1102"
154+
name = "Web Service"
155+
reference = "https://attack.mitre.org/techniques/T1102/"
156+
157+
158+
159+
[rule.threat.tactic]
160+
id = "TA0011"
161+
name = "Command and Control"
162+
reference = "https://attack.mitre.org/tactics/TA0011/"
163+
164+

0 commit comments

Comments
 (0)