User or Group Creation/Modification

This rule leverages the auditd_manager integration to detect user or group creation or modification events on Linux systems. Threat actors may attempt to create or modify users or groups to establish persistence on the system.

Elastic rule (View on GitHub)

 1[metadata]
 2creation_date = "2024/06/20"
 3integration = ["auditd_manager"]
 4maturity = "production"
 5updated_date = "2024/09/23"
 6
 7[rule]
 8author = ["Elastic"]
 9description = """
10This rule leverages the `auditd_manager` integration to detect user or group creation or modification events on Linux
11systems. Threat actors may attempt to create or modify users or groups to establish persistence on the system.
12"""
13from = "now-9m"
14index = ["auditbeat-*", "logs-auditd_manager.auditd-*"]
15language = "eql"
16license = "Elastic License v2"
17name = "User or Group Creation/Modification"
18references = ["https://www.elastic.co/security-labs/primer-on-persistence-mechanisms"]
19risk_score = 21
20rule_id = "fcf733d5-7801-4eb0-92ac-8ffacf3658f2"
21setup = """## Setup
22
23This rule requires data coming in from Auditd Manager.
24
25### Auditd Manager Integration Setup
26The Auditd Manager Integration receives audit events from the Linux Audit Framework which is a part of the Linux kernel.
27Auditd Manager provides a user-friendly interface and automation capabilities for configuring and monitoring system auditing through the auditd daemon. With `auditd_manager`, administrators can easily define audit rules, track system events, and generate comprehensive audit reports, improving overall security and compliance in the system.
28
29#### The following steps should be executed in order to add the Elastic Agent System integration "auditd_manager" on a Linux System:
30- Go to the Kibana home page and click “Add integrations”.
31- In the query bar, search for “Auditd Manager” and select the integration to see more details about it.
32- Click “Add Auditd Manager”.
33- Configure the integration name and optionally add a description.
34- Review optional and advanced settings accordingly.
35- Add the newly installed “auditd manager” to an existing or a new agent policy, and deploy the agent on a Linux system from which auditd log files are desirable.
36- Click “Save and Continue”.
37- For more details on the integration refer to the [helper guide](https://docs.elastic.co/integrations/auditd_manager).
38
39#### Rule Specific Setup Note
40Auditd Manager subscribes to the kernel and receives events as they occur without any additional configuration.
41However, if more advanced configuration is required to detect specific behavior, audit rules can be added to the integration in either the "audit rules" configuration box or the "auditd rule files" box by specifying a file to read the audit rules from.
42For this detection rule to trigger, the following additional audit rules are required to be added to the integration:

-w /usr/sbin/groupadd -p x -k group_modification -w /sbin/groupadd -p x -k group_modification -w /usr/sbin/groupmod -p x -k group_modification -w /sbin/groupmod -p x -k group_modification -w /usr/sbin/addgroup -p x -k group_modification -w /sbin/addgroup -p x -k group_modification -w /usr/sbin/usermod -p x -k user_modification -w /sbin/usermod -p x -k user_modification -w /usr/sbin/userdel -p x -k user_modification -w /sbin/userdel -p x -k user_modification -w /usr/sbin/useradd -p x -k user_modification -w /sbin/useradd -p x -k user_modification -w /usr/sbin/adduser -p x -k user_modification -w /sbin/adduser -p x -k user_modification

 1"""
 2severity = "low"
 3tags = [
 4    "Domain: Endpoint",
 5    "OS: Linux",
 6    "Use Case: Threat Detection",
 7    "Tactic: Persistence",
 8    "Data Source: Auditd Manager",
 9]
10timestamp_override = "event.ingested"
11type = "eql"
12
13query = '''
14iam where host.os.type == "linux" and event.type in ("creation", "change") and auditd.result == "success" and 
15event.action in ("changed-password", "added-user-account", "added-group-account-to")
16'''
17
18
19[[rule.threat]]
20framework = "MITRE ATT&CK"
21[[rule.threat.technique]]
22id = "T1136"
23name = "Create Account"
24reference = "https://attack.mitre.org/techniques/T1136/"
25[[rule.threat.technique.subtechnique]]
26id = "T1136.001"
27name = "Local Account"
28reference = "https://attack.mitre.org/techniques/T1136/001/"
29
30
31
32[rule.threat.tactic]
33id = "TA0003"
34name = "Persistence"
35reference = "https://attack.mitre.org/tactics/TA0003/"

References

Related rules

to-top