|
1 | 1 | [metadata] |
2 | | -creation_date = "2025/08/28" |
3 | | -integration = ["endpoint"] |
| 2 | +creation_date = "2025/09/01" |
| 3 | +integration = ["endpoint", "windows", "sentinel_one_cloud_funnel", "crowdstrike"] |
4 | 4 | maturity = "production" |
5 | | -updated_date = "2025/08/28" |
| 5 | +updated_date = "2025/09/01" |
6 | 6 |
|
7 | 7 |
|
8 | 8 | [rule] |
9 | 9 | author = ["Elastic"] |
10 | 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. |
| 11 | +Identifies DNS queries known Large Language Model domains by unsigned binaries or common Windows scripting utilities. |
| 12 | +Malwares may leverage the capabilities of LLM to perform actions in the affected system in a dynamic way. |
15 | 13 | """ |
16 | 14 | from = "now-9m" |
17 | | -index = ["logs-endpoint.events.network-*"] |
| 15 | +index = [ |
| 16 | + "endgame-*", |
| 17 | + "logs-endpoint.events.network-*", |
| 18 | + "logs-sentinel_one_cloud_funnel.*", |
| 19 | + "logs-crowdstrike.fdr*", |
| 20 | + "logs-windows.forwarded*", |
| 21 | + "logs-windows.sysmon_operational-*", |
| 22 | + "winlogbeat-*" |
| 23 | +] |
18 | 24 | language = "eql" |
19 | 25 | license = "Elastic License v2" |
20 | 26 | name = "Connection to Common Large Language Model Endpoints" |
21 | 27 | note = """## Triage and analysis |
22 | 28 |
|
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. |
| 29 | +### Investigating Connection to Common Large Language Model Endpoints |
32 | 30 |
|
33 | 31 | #### Possible investigation steps |
34 | 32 |
|
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. |
| 33 | +- Investigate the process execution chain (parent process tree) for unknown processes or malicious scripts. |
| 34 | +- Verify if the executed process is persistent on the host like common mechanisms Startup folder, task or Run key. |
| 35 | +- Review any unusual network, files or registry events by the same process. |
36 | 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. |
| 37 | +- Extract this communication's indicators of compromise (IoCs) and use traffic logs to search for other potentially compromised hosts. |
55 | 38 |
|
56 | 39 | ### False positive analysis |
57 | 40 |
|
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. |
| 41 | +- Trusted applications from an expected process running in the environment. |
59 | 42 |
|
60 | 43 | ### Response and remediation |
61 | 44 |
|
62 | 45 | - Initiate the incident response process based on the outcome of the triage. |
63 | 46 | - 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. |
| 47 | +- Immediately block the identified indicators of compromise (IoCs). |
| 48 | +- Implement any temporary network rules, procedures, and segmentation required to contain the attack. |
| 49 | +- Investigate credential exposure on systems compromised or used by the attacker to ensure all compromised accounts are identified. Reset passwords for these accounts and other potentially compromised credentials, such as email, business systems, and web services. |
| 50 | +- Update firewall rules to be more restrictive. |
| 51 | +- Reimage the host operating system or restore the compromised files to clean versions. |
70 | 52 | - Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components. |
71 | 53 | - Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector. |
72 | 54 | - 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 | 55 | """ |
74 | 56 | references = ["https://malpedia.caad.fkie.fraunhofer.de/details/py.lamehug"] |
75 | 57 | risk_score = 43 |
76 | | -rule_id = "54aa452c-a997-4f8d-b7f0-c69e56d4c05a" |
| 58 | +rule_id = "4ae94fc1-f08f-419f-b692-053d28219380" |
77 | 59 | severity = "medium" |
78 | 60 | tags = [ |
79 | 61 | "Domain: Endpoint", |
80 | 62 | "OS: Windows", |
81 | 63 | "Use Case: Threat Detection", |
| 64 | + "Tactic: Discovery", |
82 | 65 | "Tactic: Command and Control", |
83 | 66 | "Resources: Investigation Guide", |
| 67 | + "Data Source: Elastic Endgame", |
84 | 68 | "Data Source: Elastic Defend", |
| 69 | + "Data Source: SentinelOne", |
| 70 | + "Data Source: Crowdstrike", |
| 71 | + "Data Source: Sysmon", |
85 | 72 | ] |
86 | 73 | timestamp_override = "event.ingested" |
87 | 74 | type = "eql" |
88 | 75 |
|
89 | 76 | 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 |
| 77 | +network where host.os.type == "windows" and dns.question.name != null and |
| 78 | +( |
| 79 | + process.name : ("MSBuild.exe", "mshta.exe", "wscript.exe", "powershell.exe", "pwsh.exe", "msiexec.exe", "rundll32.exe", |
| 80 | + "bitsadmin.exe", "InstallUtil.exe", "RegAsm.exe", "vbc.exe", "RegSvcs.exe", "python.exe", "regsvr32.exe", "dllhost.exe", |
| 81 | + "node.exe", "javaw.exe", "java.exe", "*.pif", "*.com") or |
| 82 | +
|
| 83 | + ?process.code_signature.exists == false or ?process.code_signature.trused == false or |
| 84 | +
|
| 85 | + ?process.code_signature.subject_name in ("AUTOIT CONSULTING LTD", "AutoIt Consulting Ltd", "OpenJS Foundation", "Python Software Foundation") or |
| 86 | +
|
| 87 | + ?process.executable : ("?:\\Users\\*.exe", "", "?:\\ProgramData\\*.exe", "?\\Device\\HarddiskVolume?\\Users\\*.exe", "?\\Device\\HarddiskVolume?\\ProgramData\\*.exe") |
| 88 | + ) and |
92 | 89 | dns.question.name : ( |
93 | 90 | // Major LLM APIs |
94 | 91 | "api.openai.com", |
@@ -129,21 +126,21 @@ network where host.os.type == "windows" and network.protocol == "dns" and |
129 | 126 | "poe.com", |
130 | 127 | "chat.forefront.ai", |
131 | 128 | "chat.deepseek.com" |
132 | | - ) |
133 | | - /* Insert noisy false positives here */ |
134 | | - not process.executable : ( |
| 129 | + ) and |
| 130 | +
|
| 131 | + not ?process.executable : ( |
135 | 132 | "?:\\Program Files\\*.exe", |
136 | 133 | "?:\\Program Files (x86)\\*.exe", |
137 | | - "C:\\Windows\\System32\\svchost.exe", |
| 134 | + "?:\\Windows\\System32\\svchost.exe", |
| 135 | + "?:\\Windows\\SystemApps\\Microsoft.LockApp_*\\LockApp.exe", |
138 | 136 | "?:\\Users\\*\\AppData\\Local\\Google\\Chrome\\Application\\chrome.exe", |
139 | 137 | "?:\\Users\\*\\AppData\\Local\\BraveSoftware\\*\\Application\\brave.exe", |
140 | | - "?:\\Windows\\SystemApps\\Microsoft.LockApp_*\\LockApp.exe", |
141 | 138 | "?:\\Users\\*\\AppData\\Local\\Vivaldi\\Application\\vivaldi.exe", |
142 | 139 | "?:\\Users\\*\\AppData\\Local\\Programs\\Opera*\\opera.exe", |
143 | 140 | "?:\\Users\\*\\AppData\\Local\\Programs\\Fiddler\\Fiddler.exe" |
144 | 141 | ) 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. (*)") |
| 142 | + not (?process.code_signature.trusted == true and |
| 143 | + ?process.code_signature.subject_name in ("Anthropic, PBC", "Google LLC", "Mozilla Corporation", "Brave Software, Inc.", "Island Technology Inc.", "Opera Norway AS")) |
147 | 144 | ''' |
148 | 145 |
|
149 | 146 |
|
|
0 commit comments