System Log File Deletion
Identifies the deletion of sensitive Linux system logs. This may indicate an attempt to evade detection or destroy forensic evidence on a system.
Elastic rule (View on GitHub)
1[metadata]
2creation_date = "2020/11/03"
3integration = ["endpoint"]
4maturity = "production"
5updated_date = "2024/09/23"
6
7[rule]
8author = ["Elastic"]
9description = """
10Identifies the deletion of sensitive Linux system logs. This may indicate an attempt to evade detection or destroy
11forensic evidence on a system.
12"""
13from = "now-9m"
14index = ["auditbeat-*", "logs-endpoint.events.*", "endgame-*"]
15language = "eql"
16license = "Elastic License v2"
17name = "System Log File Deletion"
18references = [
19 "https://www.fireeye.com/blog/threat-research/2020/11/live-off-the-land-an-overview-of-unc1945.html",
20 "https://www.elastic.co/security-labs/detecting-log4j2-with-elastic-security",
21]
22risk_score = 47
23rule_id = "aa895aea-b69c-4411-b110-8d7599634b30"
24setup = """## Setup
25
26This rule requires data coming in from one of the following integrations:
27- Elastic Defend
28- Auditbeat
29
30### Elastic Defend Integration Setup
31Elastic 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.
32
33#### Prerequisite Requirements:
34- Fleet is required for Elastic Defend.
35- To configure Fleet Server refer to the [documentation](https://www.elastic.co/guide/en/fleet/current/fleet-server.html).
36
37#### The following steps should be executed in order to add the Elastic Defend integration on a Linux System:
38- Go to the Kibana home page and click "Add integrations".
39- In the query bar, search for "Elastic Defend" and select the integration to see more details about it.
40- Click "Add Elastic Defend".
41- Configure the integration name and optionally add a description.
42- Select the type of environment you want to protect, either "Traditional Endpoints" or "Cloud Workloads".
43- 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. [Helper guide](https://www.elastic.co/guide/en/security/current/configure-endpoint-integration-policy.html).
44- We suggest selecting "Complete EDR (Endpoint Detection and Response)" as a configuration setting, that provides "All events; all preventions"
45- 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.
46For more details on Elastic Agent configuration settings, refer to the [helper guide](https://www.elastic.co/guide/en/fleet/8.10/agent-policy.html).
47- Click "Save and Continue".
48- 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.
49For more details on Elastic Defend refer to the [helper guide](https://www.elastic.co/guide/en/security/current/install-endpoint.html).
50
51### Auditbeat Setup
52Auditbeat 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.
53
54#### The following steps should be executed in order to add the Auditbeat on a Linux System:
55- Elastic provides repositories available for APT and YUM-based distributions. Note that we provide binary packages, but no source packages.
56- To install the APT and YUM repositories follow the setup instructions in this [helper guide](https://www.elastic.co/guide/en/beats/auditbeat/current/setup-repositories.html).
57- To run Auditbeat on Docker follow the setup instructions in the [helper guide](https://www.elastic.co/guide/en/beats/auditbeat/current/running-on-docker.html).
58- To run Auditbeat on Kubernetes follow the setup instructions in the [helper guide](https://www.elastic.co/guide/en/beats/auditbeat/current/running-on-kubernetes.html).
59- For complete “Setup and Run Auditbeat” information refer to the [helper guide](https://www.elastic.co/guide/en/beats/auditbeat/current/setting-up-and-running.html).
60
61#### Custom Ingest Pipeline
62For versions <8.2, you need to add a custom ingest pipeline to populate `event.ingested` with @timestamp for non-elastic-agent indexes, like auditbeats/filebeat/winlogbeat etc. For more details to add a custom ingest pipeline refer to the [guide](https://www.elastic.co/guide/en/fleet/current/data-streams-pipeline-tutorial.html).
63"""
64severity = "medium"
65tags = [
66 "Domain: Endpoint",
67 "OS: Linux",
68 "Use Case: Threat Detection",
69 "Tactic: Defense Evasion",
70 "Data Source: Elastic Endgame",
71 "Data Source: Elastic Defend",
72]
73timestamp_override = "event.ingested"
74type = "eql"
75
76query = '''
77file where host.os.type == "linux" and event.type == "deletion" and
78 file.path :
79 (
80 "/var/run/utmp",
81 "/var/log/wtmp",
82 "/var/log/btmp",
83 "/var/log/lastlog",
84 "/var/log/faillog",
85 "/var/log/syslog",
86 "/var/log/messages",
87 "/var/log/secure",
88 "/var/log/auth.log",
89 "/var/log/boot.log",
90 "/var/log/kern.log",
91 "/var/log/dmesg"
92 ) and
93 not process.name in ("gzip", "executor", "dockerd")
94'''
95
96
97[[rule.threat]]
98framework = "MITRE ATT&CK"
99[[rule.threat.technique]]
100id = "T1070"
101name = "Indicator Removal"
102reference = "https://attack.mitre.org/techniques/T1070/"
103[[rule.threat.technique.subtechnique]]
104id = "T1070.002"
105name = "Clear Linux or Mac System Logs"
106reference = "https://attack.mitre.org/techniques/T1070/002/"
107
108
109
110[rule.threat.tactic]
111id = "TA0005"
112name = "Defense Evasion"
113reference = "https://attack.mitre.org/tactics/TA0005/"
References
Related rules
- Attempt to Disable IPTables or Firewall
- Attempt to Disable Syslog Service
- Tampering of Shell Command-Line History
- SELinux Configuration Creation or Renaming
- Attempt to Disable Auditd Service