Skip to content

Commit 5ecd183

Browse files
Update latest docs (#7085)
1 parent b6db03d commit 5ecd183

File tree

244 files changed

+21107
-895
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

244 files changed

+21107
-895
lines changed
Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
[[prebuilt-rule-8-18-15-attempt-to-clear-logs-via-journalctl]]
2+
=== Attempt to Clear Logs via Journalctl
3+
4+
This rule monitors for attempts to clear logs using the "journalctl" command on Linux systems. Adversaries may use this technique to cover their tracks by deleting or truncating log files, making it harder for defenders to investigate their activities. The rule looks for the execution of "journalctl" with arguments that indicate log clearing actions, such as "--vacuum-time", "--vacuum-size", or "--vacuum-files".
5+
6+
*Rule type*: eql
7+
8+
*Rule indices*:
9+
10+
* auditbeat-*
11+
* endgame-*
12+
* logs-auditd_manager.auditd-*
13+
* logs-crowdstrike.fdr*
14+
* logs-endpoint.events.process*
15+
* logs-sentinel_one_cloud_funnel.*
16+
17+
*Severity*: low
18+
19+
*Risk score*: 21
20+
21+
*Runs every*: 5m
22+
23+
*Searches indices from*: now-9m ({ref}/common-options.html#date-math[Date Math format], see also <<rule-schedule, `Additional look-back time`>>)
24+
25+
*Maximum alerts per execution*: 100
26+
27+
*References*: None
28+
29+
*Tags*:
30+
31+
* Domain: Endpoint
32+
* OS: Linux
33+
* Use Case: Threat Detection
34+
* Tactic: Defense Evasion
35+
* Data Source: Elastic Defend
36+
* Data Source: Elastic Endgame
37+
* Data Source: Auditd Manager
38+
* Data Source: Crowdstrike
39+
* Data Source: SentinelOne
40+
* Resources: Investigation Guide
41+
42+
*Version*: 1
43+
44+
*Rule authors*:
45+
46+
* Elastic
47+
48+
*Rule license*: Elastic License v2
49+
50+
51+
==== Investigation guide
52+
53+
54+
55+
*Triage and analysis*
56+
57+
58+
> **Disclaimer**:
59+
> This investigation guide was created using generative AI technology and has been reviewed to improve its accuracy and relevance. While every effort has been made to ensure its quality, we recommend validating the content and adapting it to suit your specific environment and operational needs.
60+
61+
62+
*Investigating Attempt to Clear Logs via Journalctl*
63+
64+
65+
This detection flags attempts to purge systemd journal logs by invoking journalctl with vacuum options, which attackers use to erase evidence and impede investigations. A common pattern is a compromised user escalating to root and immediately running sudo journalctl --vacuum-time=1s or --vacuum-size=1M, sometimes via a script or cron job, to rapidly truncate the journal across all boots and hide prior execution traces.
66+
67+
68+
*Possible investigation steps*
69+
70+
71+
- Enrich with user/UID, effective privileges, parent and command-line, session/TTY, and origin (SSH IP or local), and determine if execution came from a scheduled job (cron/systemd timer) or a script.
72+
- Quantify destructiveness by extracting the exact vacuum parameter value(s) and immediately checking journal state (journalctl --disk-usage and --list-boots) and /var/log/journal size/mtime to see how much history was removed.
73+
- Inspect configuration and persistence paths for intentional log suppression, including recent changes in /etc/systemd/journald.conf (Storage=volatile, SystemMaxUse, SystemMaxFileSize, MaxRetentionSec) and any new systemd units or scripts invoking journalctl vacuum.
74+
- Correlate the vacuum timestamp with preceding activity to identify what might be concealed (privilege escalation, new accounts, sudoers edits, suspicious binaries), using auditd/EDR telemetry and shell history to rebuild the timeline.
75+
- Verify remote log forwarding and SIEM ingestion for this host, compare gaps around the vacuum time, and recover pre-vacuum events from central storage to assess impact and intent.
76+
77+
78+
*False positive analysis*
79+
80+
81+
- A sysadmin or maintenance script ran journalctl --vacuum-time or --vacuum-size to reclaim space on a host under log disk pressure, which should correlate with low-free-space alerts, approved retention policy, and a scheduled systemd timer or cron job.
82+
- OS provisioning or image-preparation steps vacuumed the journal with journalctl --vacuum-files to sanitize logs before snapshotting, typically a one-time root action occurring near installation and matching documented build procedures.
83+
84+
85+
*Response and remediation*
86+
87+
88+
- Immediately kill any active journalctl vacuum invocation (e.g., pkill -x journalctl), lock or remove sudo for the initiating user, and network-quarantine the host to prevent further tampering.
89+
- Remove persistence by disabling systemd units/timers and cron jobs that call "journalctl --vacuum-*", inspecting /etc/systemd/system/* for ExecStart=journalctl vacuum and /etc/crontab, /etc/cron.*, and user crontabs, then deleting the offending scripts.
90+
- Recover logging by setting Storage=persistent and policy-compliant SystemMaxUse/SystemMaxFileSize/MaxRetentionSec in /etc/systemd/journald.conf, restarting systemd-journald, and backfilling missing events from central log archives.
91+
- Harden by enabling remote forwarding (ForwardToSyslog=yes and rsyslog/syslog-ng to SIEM), adding auditd rules to alert on "journalctl --vacuum-*", and tightening sudoers to require MFA and record command I/O for journalctl on critical hosts.
92+
- Preserve evidence by archiving remaining /var/log/journal entries, journald.conf and its mtime, modified unit files under /etc/systemd/system, and shell/auth logs, and capture a disk snapshot before making further changes.
93+
- Escalate to incident response if root executed "journalctl --vacuum-time/size/files" outside a documented maintenance window, if Storage=volatile was set or retention reduced below policy, or if the same actor performed vacuums on multiple hosts within 24 hours.
94+
95+
96+
==== Setup
97+
98+
99+
100+
*Setup*
101+
102+
103+
This rule requires data coming in from Elastic Defend.
104+
105+
106+
*Elastic Defend Integration Setup*
107+
108+
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.
109+
110+
111+
*Prerequisite Requirements:*
112+
113+
- Fleet is required for Elastic Defend.
114+
- To configure Fleet Server refer to the https://www.elastic.co/guide/en/fleet/current/fleet-server.html[documentation].
115+
116+
117+
*The following steps should be executed in order to add the Elastic Defend integration on a Linux System:*
118+
119+
- Go to the Kibana home page and click "Add integrations".
120+
- In the query bar, search for "Elastic Defend" and select the integration to see more details about it.
121+
- Click "Add Elastic Defend".
122+
- Configure the integration name and optionally add a description.
123+
- Select the type of environment you want to protect, either "Traditional Endpoints" or "Cloud Workloads".
124+
- 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].
125+
- We suggest selecting "Complete EDR (Endpoint Detection and Response)" as a configuration setting, that provides "All events; all preventions"
126+
- 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.
127+
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].
128+
- Click "Save and Continue".
129+
- 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.
130+
For more details on Elastic Defend refer to the https://www.elastic.co/guide/en/security/current/install-endpoint.html[helper guide].
131+
132+
133+
==== Rule query
134+
135+
136+
[source, js]
137+
----------------------------------
138+
process where host.os.type == "linux" and event.type == "start" and
139+
event.action in ("exec", "exec_event", "start", "ProcessRollup2", "executed", "process_started") and
140+
process.name == "journalctl" and process.args like ("--vacuum-time=*", "--vacuum-size=*", "--vacuum-files=*")
141+
142+
----------------------------------
143+
144+
*Framework*: MITRE ATT&CK^TM^
145+
146+
* Tactic:
147+
** Name: Defense Evasion
148+
** ID: TA0005
149+
** Reference URL: https://attack.mitre.org/tactics/TA0005/
150+
* Technique:
151+
** Name: Indicator Removal
152+
** ID: T1070
153+
** Reference URL: https://attack.mitre.org/techniques/T1070/
154+
* Sub-technique:
155+
** Name: Clear Linux or Mac System Logs
156+
** ID: T1070.002
157+
** Reference URL: https://attack.mitre.org/techniques/T1070/002/
158+
* Technique:
159+
** Name: Impair Defenses
160+
** ID: T1562
161+
** Reference URL: https://attack.mitre.org/techniques/T1562/
162+
* Sub-technique:
163+
** Name: Disable or Modify Tools
164+
** ID: T1562.001
165+
** Reference URL: https://attack.mitre.org/techniques/T1562/001/
Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
[[prebuilt-rule-8-18-15-attempt-to-disable-syslog-service]]
2+
=== Attempt to Disable Syslog Service
3+
4+
Adversaries may attempt to disable the syslog service in an attempt to an attempt to disrupt event logging and evade detection by security controls.
5+
6+
*Rule type*: eql
7+
8+
*Rule indices*:
9+
10+
* auditbeat-*
11+
* endgame-*
12+
* logs-crowdstrike.fdr*
13+
* logs-endpoint.events.process*
14+
* logs-sentinel_one_cloud_funnel.*
15+
16+
*Severity*: medium
17+
18+
*Risk score*: 47
19+
20+
*Runs every*: 5m
21+
22+
*Searches indices from*: now-9m ({ref}/common-options.html#date-math[Date Math format], see also <<rule-schedule, `Additional look-back time`>>)
23+
24+
*Maximum alerts per execution*: 100
25+
26+
*References*:
27+
28+
* https://www.elastic.co/security-labs/detecting-log4j2-with-elastic-security
29+
30+
*Tags*:
31+
32+
* Domain: Endpoint
33+
* OS: Linux
34+
* Use Case: Threat Detection
35+
* Tactic: Defense Evasion
36+
* Data Source: Elastic Endgame
37+
* Data Source: Elastic Defend
38+
* Data Source: Crowdstrike
39+
* Data Source: SentinelOne
40+
* Resources: Investigation Guide
41+
42+
*Version*: 215
43+
44+
*Rule authors*:
45+
46+
* Elastic
47+
48+
*Rule license*: Elastic License v2
49+
50+
51+
==== Investigation guide
52+
53+
54+
55+
*Triage and analysis*
56+
57+
58+
> **Disclaimer**:
59+
> This investigation guide was created using generative AI technology and has been reviewed to improve its accuracy and relevance. While every effort has been made to ensure its quality, we recommend validating the content and adapting it to suit your specific environment and operational needs.
60+
61+
62+
*Investigating Attempt to Disable Syslog Service*
63+
64+
65+
Syslog is a critical component in Linux environments, responsible for logging system events and activities. Adversaries may target syslog to disable logging, thereby evading detection and obscuring their malicious actions. The detection rule identifies attempts to stop or disable syslog services by monitoring specific process actions and arguments, flagging suspicious commands that could indicate an attempt to impair logging defenses.
66+
67+
68+
*Possible investigation steps*
69+
70+
71+
- Review the process details to identify the user account associated with the command execution, focusing on the process.name and process.args fields to determine if the action was legitimate or suspicious.
72+
- Check the system's recent login history and user activity to identify any unauthorized access attempts or anomalies around the time the syslog service was targeted.
73+
- Investigate the parent process of the flagged command to understand the context of its execution and determine if it was initiated by a legitimate application or script.
74+
- Examine other logs and alerts from the same host around the time of the event to identify any correlated suspicious activities or patterns that might indicate a broader attack.
75+
- Assess the system for any signs of compromise, such as unexpected changes in configuration files, unauthorized software installations, or unusual network connections, to determine if the attempt to disable syslog is part of a larger attack.
76+
77+
78+
*False positive analysis*
79+
80+
81+
- Routine maintenance activities may trigger this rule, such as scheduled service restarts or system updates. To manage this, create exceptions for known maintenance windows or specific administrative accounts performing these tasks.
82+
- Automated scripts or configuration management tools like Ansible or Puppet might stop or disable syslog services as part of their operations. Identify these scripts and whitelist their execution paths or associated user accounts.
83+
- Testing environments often simulate service disruptions, including syslog, for resilience testing. Exclude these environments from the rule or adjust the rule to ignore specific test-related processes.
84+
- Some legitimate software installations or updates may require stopping syslog services temporarily. Monitor installation logs and exclude these processes if they are verified as non-threatening.
85+
- In environments with multiple syslog implementations, ensure that the rule is not overly broad by refining the process arguments to match only the specific syslog services in use.
86+
87+
88+
*Response and remediation*
89+
90+
91+
- Immediately isolate the affected system from the network to prevent further malicious activity and potential lateral movement by the adversary.
92+
- Terminate any suspicious processes identified in the alert, specifically those attempting to stop or disable syslog services, to restore normal logging functionality.
93+
- Restart the syslog service on the affected system to ensure that logging is re-enabled and operational, using commands like `systemctl start syslog` or `service syslog start`.
94+
- Conduct a thorough review of recent logs, if available, to identify any additional suspicious activities or indicators of compromise that may have occurred prior to the syslog service being disabled.
95+
- Escalate the incident to the security operations team for further investigation and to determine if the attack is part of a larger campaign or if other systems are affected.
96+
- Implement additional monitoring on the affected system and similar systems to detect any further attempts to disable logging services, using enhanced logging and alerting mechanisms.
97+
- Review and update access controls and permissions to ensure that only authorized personnel have the ability to modify or stop critical services like syslog, reducing the risk of future incidents.
98+
99+
==== Setup
100+
101+
102+
103+
*Setup*
104+
105+
106+
This rule requires data coming in from one of the following integrations:
107+
- Elastic Defend
108+
- Auditbeat
109+
110+
111+
*Elastic Defend Integration Setup*
112+
113+
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.
114+
115+
116+
*Prerequisite Requirements:*
117+
118+
- Fleet is required for Elastic Defend.
119+
- To configure Fleet Server refer to the https://www.elastic.co/guide/en/fleet/current/fleet-server.html[documentation].
120+
121+
122+
*The following steps should be executed in order to add the Elastic Defend integration on a Linux System:*
123+
124+
- Go to the Kibana home page and click "Add integrations".
125+
- In the query bar, search for "Elastic Defend" and select the integration to see more details about it.
126+
- Click "Add Elastic Defend".
127+
- Configure the integration name and optionally add a description.
128+
- Select the type of environment you want to protect, either "Traditional Endpoints" or "Cloud Workloads".
129+
- 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].
130+
- We suggest selecting "Complete EDR (Endpoint Detection and Response)" as a configuration setting, that provides "All events; all preventions"
131+
- 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.
132+
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].
133+
- Click "Save and Continue".
134+
- 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.
135+
For more details on Elastic Defend refer to the https://www.elastic.co/guide/en/security/current/install-endpoint.html[helper guide].
136+
137+
138+
*Auditbeat Setup*
139+
140+
Auditbeat is a lightweight shipper that you can install on your servers to audit the activities of users and processes on your systems. For example, you can use Auditbeat to collect and centralize audit events from the Linux Audit Framework. You can also use Auditbeat to detect changes to critical files, like binaries and configuration files, and identify potential security policy violations.
141+
142+
143+
*The following steps should be executed in order to add the Auditbeat on a Linux System:*
144+
145+
- Elastic provides repositories available for APT and YUM-based distributions. Note that we provide binary packages, but no source packages.
146+
- To install the APT and YUM repositories follow the setup instructions in this https://www.elastic.co/guide/en/beats/auditbeat/current/setup-repositories.html[helper guide].
147+
- To run Auditbeat on Docker follow the setup instructions in the https://www.elastic.co/guide/en/beats/auditbeat/current/running-on-docker.html[helper guide].
148+
- To run Auditbeat on Kubernetes follow the setup instructions in the https://www.elastic.co/guide/en/beats/auditbeat/current/running-on-kubernetes.html[helper guide].
149+
- For complete “Setup and Run Auditbeat” information refer to the https://www.elastic.co/guide/en/beats/auditbeat/current/setting-up-and-running.html[helper guide].
150+
151+
152+
==== Rule query
153+
154+
155+
[source, js]
156+
----------------------------------
157+
process where host.os.type == "linux" and event.action in ("exec", "exec_event", "start", "ProcessRollup2") and
158+
( (process.name == "service" and process.args == "stop") or
159+
(process.name == "chkconfig" and process.args == "off") or
160+
(process.name == "systemctl" and process.args in ("disable", "stop", "kill"))
161+
) and process.args in ("syslog", "rsyslog", "syslog-ng", "syslog.service", "rsyslog.service", "syslog-ng.service") and
162+
not (
163+
process.parent.name == "rsyslog-rotate" or
164+
process.args == "HUP"
165+
)
166+
167+
----------------------------------
168+
169+
*Framework*: MITRE ATT&CK^TM^
170+
171+
* Tactic:
172+
** Name: Defense Evasion
173+
** ID: TA0005
174+
** Reference URL: https://attack.mitre.org/tactics/TA0005/
175+
* Technique:
176+
** Name: Impair Defenses
177+
** ID: T1562
178+
** Reference URL: https://attack.mitre.org/techniques/T1562/
179+
* Sub-technique:
180+
** Name: Disable or Modify Tools
181+
** ID: T1562.001
182+
** Reference URL: https://attack.mitre.org/techniques/T1562/001/

0 commit comments

Comments
 (0)