Skip to content

Commit ef53061

Browse files
Update latest docs
1 parent b8c4b3e commit ef53061

2,043 files changed

Lines changed: 180010 additions & 2660 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 198 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,198 @@
1+
[[prebuilt-rule-8-19-20-abnormal-process-id-or-lock-file-created]]
2+
=== Abnormal Process ID or Lock File Created
3+
4+
Identifies the creation of a Process ID (PID), lock or reboot file created in temporary file storage paradigm (tmpfs) directory /var/run. On Linux, the PID files typically hold the process ID to track previous copies running and manage other tasks. Certain Linux malware use the /var/run directory for holding data, executables and other tasks, disguising itself or these files as legitimate PID files.
5+
6+
*Rule type*: new_terms
7+
8+
*Rule indices*:
9+
10+
* logs-endpoint.events.*
11+
* endgame-*
12+
13+
*Severity*: medium
14+
15+
*Risk score*: 47
16+
17+
*Runs every*: 5m
18+
19+
*Searches indices from*: now-9m ({ref}/common-options.html#date-math[Date Math format], see also <<rule-schedule, `Additional look-back time`>>)
20+
21+
*Maximum alerts per execution*: 100
22+
23+
*References*:
24+
25+
* https://www.sandflysecurity.com/blog/linux-file-masquerading-and-malicious-pids-sandfly-1-2-6-update/
26+
* https://twitter.com/GossiTheDog/status/1522964028284411907
27+
* https://exatrack.com/public/Tricephalic_Hellkeeper.pdf
28+
* https://www.elastic.co/security-labs/a-peek-behind-the-bpfdoor
29+
30+
*Tags*:
31+
32+
* Domain: Endpoint
33+
* OS: Linux
34+
* Use Case: Threat Detection
35+
* Tactic: Execution
36+
* Threat: BPFDoor
37+
* Resources: Investigation Guide
38+
* Data Source: Elastic Defend
39+
* Data Source: Elastic Endgame
40+
41+
*Version*: 219
42+
43+
*Rule authors*:
44+
45+
* Elastic
46+
47+
*Rule license*: Elastic License v2
48+
49+
50+
==== Investigation guide
51+
52+
53+
54+
*Triage and analysis*
55+
56+
57+
58+
*Investigating Abnormal Process ID or Lock File Created*
59+
60+
61+
Linux applications may need to save their process identification number (PID) for various purposes: from signaling that a program is running to serving as a signal that a previous instance of an application didn't exit successfully. PID files contain its creator process PID in an integer value.
62+
63+
Linux lock files are used to coordinate operations in files so that conflicts and race conditions are prevented.
64+
65+
This rule identifies the creation of PID, lock, or reboot files in the /var/run/ directory. Attackers can masquerade malware, payloads, staged data for exfiltration, and more as legitimate PID files.
66+
67+
68+
*Possible investigation steps*
69+
70+
71+
- Retrieve the file and determine if it is malicious:
72+
- Check the contents of the PID files. They should only contain integer strings.
73+
- Check the file type of the lock and PID files to determine if they are executables. This is only observed in malicious files.
74+
- Check the size of the subject file. Legitimate PID files should be under 10 bytes.
75+
- Check if the lock or PID file has high entropy. This typically indicates an encrypted payload.
76+
- Analysts can use tools like `ent` to measure entropy.
77+
- Examine the reputation of the SHA-256 hash in the PID file. Use a database like VirusTotal to identify additional pivots and artifacts for investigation.
78+
- Trace the file's creation to ensure it came from a legitimate or authorized process.
79+
- Investigate other alerts associated with the user/host during the past 48 hours.
80+
- Investigate any abnormal account behavior, such as command executions, file creations or modifications, and network connections.
81+
- Investigate any abnormal behavior by the subject process such as network connections, file modifications, and any spawned child processes.
82+
83+
84+
*False positive analysis*
85+
86+
87+
- False positives can appear if the PID file is legitimate and holding a process ID as intended. If the PID file is an executable or has a file size that's larger than 10 bytes, it should be ruled suspicious.
88+
- If this activity is expected and noisy in your environment, consider adding exceptions — preferably with a combination of file name and process executable conditions.
89+
90+
91+
*Response and remediation*
92+
93+
94+
- Initiate the incident response process based on the outcome of the triage.
95+
- Isolate the involved host to prevent further post-compromise behavior.
96+
- 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.
97+
- Block the identified indicators of compromise (IoCs).
98+
- Take actions to terminate processes and connections used by the attacker.
99+
- Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
100+
- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
101+
- 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).
102+
103+
104+
==== Setup
105+
106+
107+
108+
*Setup*
109+
110+
111+
This rule requires data coming in from Elastic Defend.
112+
113+
114+
*Elastic Defend Integration Setup*
115+
116+
Elastic 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.
117+
118+
119+
*Prerequisite Requirements:*
120+
121+
- Fleet is required for Elastic Defend.
122+
- To configure Fleet Server refer to the https://www.elastic.co/guide/en/fleet/current/fleet-server.html[documentation].
123+
124+
125+
*The following steps should be executed in order to add the Elastic Defend integration on a Linux System:*
126+
127+
- Go to the Kibana home page and click "Add integrations".
128+
- In the query bar, search for "Elastic Defend" and select the integration to see more details about it.
129+
- Click "Add Elastic Defend".
130+
- Configure the integration name and optionally add a description.
131+
- Select the type of environment you want to protect, either "Traditional Endpoints" or "Cloud Workloads".
132+
- 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. https://www.elastic.co/guide/en/security/current/configure-endpoint-integration-policy.html[Helper guide].
133+
- We suggest selecting "Complete EDR (Endpoint Detection and Response)" as a configuration setting, that provides "All events; all preventions"
134+
- 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.
135+
For more details on Elastic Agent configuration settings, refer to the https://www.elastic.co/guide/en/fleet/8.10/agent-policy.html[helper guide].
136+
- Click "Save and Continue".
137+
- 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.
138+
For more details on Elastic Defend refer to the https://www.elastic.co/guide/en/security/current/install-endpoint.html[helper guide].
139+
140+
141+
==== Rule query
142+
143+
144+
[source, js]
145+
----------------------------------
146+
host.os.type:linux and event.category:file and event.action:(creation or file_create_event) and
147+
file.extension:(pid or lock or reboot) and file.path:(/var/run/* or /run/*) and (
148+
(process.name : (
149+
bash or dash or sh or tcsh or csh or zsh or ksh or fish or ash or touch or nano or vim or vi or editor or mv or cp)
150+
) or (
151+
process.executable : (
152+
./* or /tmp/* or /var/tmp/* or /dev/shm/* or /var/run/* or /boot/* or /srv/* or /run/*
153+
))
154+
) and not (
155+
process.executable : (
156+
/tmp/newroot/* or /run/containerd/* or /run/k3s/containerd/* or /run/k0s/container* or /snap/* or /vz/* or
157+
/var/lib/docker/* or /etc/*/universal-hooks/pkgs/mysql-community-server/* or /var/lib/snapd/* or /etc/rubrik/* or
158+
/run/udev/data/*
159+
) or
160+
process.name : (
161+
go or git or containerd* or snap-confine or cron or crond or sshd or unattended-upgrade or vzctl or ifup or
162+
rpcbind or runc or gitlab-runner-helper or elastic-agent or metricbeat or redis-server or libvirt_leaseshelper or
163+
s6-ipcserver-socketbinder or xinetd or libvirtd or veeamdeploymentsvc or dnsmasq or virtlogd or lynis or
164+
veeamtransport or bash or dash or sh or touch or podman or chrome_crashpad_handler or snmpd or automount or
165+
chrome or yumBackend.py or rhsmcertd-worker or snapd or cp or dotnet or leapp or haproxy or multipathd or
166+
falcond or python* or atopacctd or postmaster or httpd or pulseaudio or iptables or atd or package-cleanup or local
167+
) or
168+
file.name : (
169+
jem.*.pid or lynis.pid or redis.pid or yum.pid or MFS.pid or jenkins.pid or nvmupdate.pid or openlitespeed.pid or
170+
rhnsd.pid
171+
) or
172+
file.path : (/run/containerd/* or /var/run/docker/containerd/* or /var/run/jem*.pid)
173+
)
174+
175+
----------------------------------
176+
177+
*Framework*: MITRE ATT&CK^TM^
178+
179+
* Tactic:
180+
** Name: Execution
181+
** ID: TA0002
182+
** Reference URL: https://attack.mitre.org/tactics/TA0002/
183+
* Technique:
184+
** Name: Native API
185+
** ID: T1106
186+
** Reference URL: https://attack.mitre.org/techniques/T1106/
187+
* Tactic:
188+
** Name: Defense Evasion
189+
** ID: TA0005
190+
** Reference URL: https://attack.mitre.org/tactics/TA0005/
191+
* Technique:
192+
** Name: Masquerading
193+
** ID: T1036
194+
** Reference URL: https://attack.mitre.org/techniques/T1036/
195+
* Sub-technique:
196+
** Name: Match Legitimate Resource Name or Location
197+
** ID: T1036.005
198+
** Reference URL: https://attack.mitre.org/techniques/T1036/005/
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
[[prebuilt-rule-8-19-20-abnormally-large-dns-response]]
2+
=== Abnormally Large DNS Response
3+
4+
Specially crafted DNS requests can manipulate a known overflow vulnerability in some Windows DNS servers, resulting in Remote Code Execution (RCE) or a Denial of Service (DoS) from crashing the service.
5+
6+
*Rule type*: query
7+
8+
*Rule indices*:
9+
10+
* packetbeat-*
11+
* filebeat-*
12+
* logs-network_traffic.*
13+
14+
*Severity*: medium
15+
16+
*Risk score*: 47
17+
18+
*Runs every*: 5m
19+
20+
*Searches indices from*: None ({ref}/common-options.html#date-math[Date Math format], see also <<rule-schedule, `Additional look-back time`>>)
21+
22+
*Maximum alerts per execution*: 100
23+
24+
*References*:
25+
26+
* https://research.checkpoint.com/2020/resolving-your-way-into-domain-admin-exploiting-a-17-year-old-bug-in-windows-dns-servers/
27+
* https://msrc-blog.microsoft.com/2020/07/14/july-2020-security-update-cve-2020-1350-vulnerability-in-windows-domain-name-system-dns-server/
28+
* https://github.com/maxpl0it/CVE-2020-1350-DoS
29+
* https://www.elastic.co/security-labs/detection-rules-for-sigred-vulnerability
30+
31+
*Tags*:
32+
33+
* Use Case: Threat Detection
34+
* Tactic: Lateral Movement
35+
* Tactic: Impact
36+
* Resources: Investigation Guide
37+
* Use Case: Vulnerability
38+
39+
*Version*: 108
40+
41+
*Rule authors*:
42+
43+
* Elastic
44+
45+
*Rule license*: Elastic License v2
46+
47+
48+
==== Investigation guide
49+
50+
51+
52+
*Triage and analysis*
53+
54+
55+
56+
*Investigating Abnormally Large DNS Response*
57+
58+
59+
Detection alerts from this rule indicate possible anomalous activity around large byte DNS responses from a Windows DNS server. This detection rule was created based on activity represented in exploitation of vulnerability (CVE-2020-1350) also known as https://www.elastic.co/blog/detection-rules-for-sigred-vulnerability[SigRed] during July 2020.
60+
61+
62+
*Possible investigation steps*
63+
64+
65+
- This specific rule is sourced from network log activity such as DNS or network level data. It's important to validate the source of the incoming traffic and determine if this activity has been observed previously within an environment.
66+
- Activity can be further investigated and validated by reviewing any associated Intrusion Detection Signatures (IDS) alerts.
67+
- Further examination can include a review of the `dns.question_type` network fieldset with a protocol analyzer, such as Zeek, Packetbeat, or Suricata, for `SIG` or `RRSIG` data.
68+
- Validate the patch level and OS of the targeted DNS server to validate the observed activity was not large-scale internet vulnerability scanning.
69+
- Validate that the source of the network activity was not from an authorized vulnerability scan or compromise assessment.
70+
71+
72+
*False positive analysis*
73+
74+
75+
- Based on this rule, which looks for a threshold of 60k bytes, it is possible for activity to be generated under 65k bytes and related to legitimate behavior. In packet capture files received by the https://isc.sans.edu/forums/diary/PATCH+NOW+SIGRed+CVE20201350+Microsoft+DNS+Server+Vulnerability/26356/[SANS Internet Storm Center], byte responses were all observed as greater than 65k bytes.
76+
- This activity can be triggered by compliance/vulnerability scanning or compromise assessment; it's important to determine the source of the activity and potentially allowlist the source host.
77+
78+
79+
*Related rules*
80+
81+
82+
- Unusual Child Process of dns.exe - 8c37dc0e-e3ac-4c97-8aa0-cf6a9122de45
83+
- Unusual File Modification by dns.exe - c7ce36c0-32ff-4f9a-bfc2-dcb242bf99f9
84+
85+
86+
*Response and remediation*
87+
88+
89+
- Initiate the incident response process based on the outcome of the triage.
90+
- Ensure that you have deployed the latest Microsoft https://portal.msrc.microsoft.com/en-US/security-guidance/advisory/CVE-2020-1350[Security Update] (Monthly Rollup or Security Only) and restarted the patched machines. If unable to patch immediately, Microsoft https://support.microsoft.com/en-us/help/4569509/windows-dns-server-remote-code-execution-vulnerability[released] a registry-based workaround that doesn’t require a restart. This can be used as a temporary solution before the patch is applied.
91+
- Maintain backups of your critical systems to aid in quick recovery.
92+
- Perform routine vulnerability scans of your systems, monitor https://us-cert.cisa.gov/ncas/current-activity[CISA advisories] and patch identified vulnerabilities.
93+
- If you observe a true positive, implement a remediation plan and monitor host-based artifacts for additional post-exploitation behavior.
94+
95+
96+
==== Rule query
97+
98+
99+
[source, js]
100+
----------------------------------
101+
(event.dataset: network_traffic.dns or (event.category: (network or network_traffic) and destination.port: 53)) and
102+
(event.dataset:zeek.dns or type:dns or event.type:connection) and network.bytes > 60000
103+
104+
----------------------------------
105+
106+
*Framework*: MITRE ATT&CK^TM^
107+
108+
* Tactic:
109+
** Name: Lateral Movement
110+
** ID: TA0008
111+
** Reference URL: https://attack.mitre.org/tactics/TA0008/
112+
* Technique:
113+
** Name: Exploitation of Remote Services
114+
** ID: T1210
115+
** Reference URL: https://attack.mitre.org/techniques/T1210/
116+
* Tactic:
117+
** Name: Impact
118+
** ID: TA0040
119+
** Reference URL: https://attack.mitre.org/tactics/TA0040/
120+
* Technique:
121+
** Name: Endpoint Denial of Service
122+
** ID: T1499
123+
** Reference URL: https://attack.mitre.org/techniques/T1499/
124+
* Sub-technique:
125+
** Name: Application or System Exploitation
126+
** ID: T1499.004
127+
** Reference URL: https://attack.mitre.org/techniques/T1499/004/

0 commit comments

Comments
 (0)