Rare User Logon

A machine learning job found an unusual user name in the authentication logs. An unusual user name is one way of detecting credentialed access by means of a new or dormant user account. An inactive user account (because the user has left the organization) that becomes active may be due to credentialed access using a compromised account password. Threat actors will sometimes also create new users as a means of persisting in a compromised web application.

Elastic rule (View on GitHub)

  1[metadata]
  2creation_date = "2021/06/10"
  3integration = ["auditd_manager", "endpoint", "system"]
  4maturity = "production"
  5updated_date = "2024/06/18"
  6
  7[rule]
  8anomaly_threshold = 75
  9author = ["Elastic"]
 10description = """
 11A machine learning job found an unusual user name in the authentication logs. An unusual user name is one way of
 12detecting credentialed access by means of a new or dormant user account. An inactive user account (because the user has
 13left the organization) that becomes active may be due to credentialed access using a compromised account password.
 14Threat actors will sometimes also create new users as a means of persisting in a compromised web application.
 15"""
 16false_positives = [
 17    """
 18    User accounts that are rarely active, such as a site reliability engineer (SRE) or developer logging into a
 19    production server for troubleshooting, may trigger this alert. Under some conditions, a newly created user account
 20    may briefly trigger this alert while the model is learning.
 21    """,
 22]
 23from = "now-30m"
 24interval = "15m"
 25license = "Elastic License v2"
 26machine_learning_job_id = "auth_rare_user"
 27name = "Rare User Logon"
 28setup = """## Setup
 29
 30This rule requires the installation of associated Machine Learning jobs, as well as data coming in from one of the following integrations:
 31- Elastic Defend
 32- Auditd Manager
 33- System
 34
 35### Anomaly Detection Setup
 36
 37Once the rule is enabled, the associated Machine Learning job will start automatically. You can view the Machine Learning job linked under the "Definition" panel of the detection rule. If the job does not start due to an error, the issue must be resolved for the job to commence successfully. For more details on setting up anomaly detection jobs, refer to the [helper guide](https://www.elastic.co/guide/en/kibana/current/xpack-ml-anomalies.html).
 38
 39### Elastic Defend Integration Setup
 40Elastic 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.
 41
 42#### Prerequisite Requirements:
 43- Fleet is required for Elastic Defend.
 44- To configure Fleet Server refer to the [documentation](https://www.elastic.co/guide/en/fleet/current/fleet-server.html).
 45
 46#### The following steps should be executed in order to add the Elastic Defend integration to your system:
 47- Go to the Kibana home page and click "Add integrations".
 48- In the query bar, search for "Elastic Defend" and select the integration to see more details about it.
 49- Click "Add Elastic Defend".
 50- Configure the integration name and optionally add a description.
 51- Select the type of environment you want to protect, either "Traditional Endpoints" or "Cloud Workloads".
 52- 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).
 53- We suggest selecting "Complete EDR (Endpoint Detection and Response)" as a configuration setting, that provides "All events; all preventions"
 54- 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.
 55For more details on Elastic Agent configuration settings, refer to the [helper guide](https://www.elastic.co/guide/en/fleet/current/agent-policy.html).
 56- Click "Save and Continue".
 57- 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.
 58For more details on Elastic Defend refer to the [helper guide](https://www.elastic.co/guide/en/security/current/install-endpoint.html).
 59
 60### Auditd Manager Integration Setup
 61The Auditd Manager Integration receives audit events from the Linux Audit Framework which is a part of the Linux kernel.
 62Auditd 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.
 63
 64#### The following steps should be executed in order to add the Elastic Agent System integration "auditd_manager" to your system:
 65- Go to the Kibana home page and click “Add integrations”.
 66- In the query bar, search for “Auditd Manager” and select the integration to see more details about it.
 67- Click “Add Auditd Manager”.
 68- Configure the integration name and optionally add a description.
 69- Review optional and advanced settings accordingly.
 70- 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.
 71- Click “Save and Continue”.
 72- For more details on the integration refer to the [helper guide](https://docs.elastic.co/integrations/auditd_manager).
 73
 74#### Rule Specific Setup Note
 75Auditd Manager subscribes to the kernel and receives events as they occur without any additional configuration.
 76However, 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.
 77- For this detection rule no additional audit rules are required.
 78
 79### System Integration Setup
 80The System integration allows you to collect system logs and metrics from your servers with Elastic Agent.
 81
 82#### The following steps should be executed in order to add the Elastic Agent System integration "system" to your system:
 83- Go to the Kibana home page and click “Add integrations”.
 84- In the query bar, search for “System” and select the integration to see more details about it.
 85- Click “Add System”.
 86- Configure the integration name and optionally add a description.
 87- Review optional and advanced settings accordingly.
 88- Add the newly installed “system” to an existing or a new agent policy, and deploy the agent on your system from which system log files are desirable.
 89- Click “Save and Continue”.
 90- For more details on the integration refer to the [helper guide](https://docs.elastic.co/integrations/system).
 91"""
 92note = """## Triage and analysis
 93
 94### Investigating Rare User Logon
 95
 96This rule uses a machine learning job to detect an unusual user name in authentication logs, which could detect new accounts created for persistence.
 97
 98#### Possible investigation steps
 99
100- Check if the user was newly created and if the company policies were followed.
101  - Identify the user account that performed the action and whether it should perform this kind of action.
102- Investigate other alerts associated with the involved users during the past 48 hours.
103- Investigate any abnormal account behavior, such as command executions, file creations or modifications, and network connections.
104
105### False positive analysis
106
107- Accounts that are used for specific purposes — and therefore not normally active — may trigger the alert.
108
109### Response and remediation
110
111- Initiate the incident response process based on the outcome of the triage.
112- 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.
113- 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).
114"""
115references = ["https://www.elastic.co/guide/en/security/current/prebuilt-ml-jobs.html"]
116risk_score = 21
117rule_id = "138c5dd5-838b-446e-b1ac-c995c7f8108a"
118severity = "low"
119tags = [
120    "Use Case: Identity and Access Audit",
121    "Use Case: Threat Detection",
122    "Rule Type: ML",
123    "Rule Type: Machine Learning",
124    "Tactic: Initial Access",
125    "Resources: Investigation Guide",
126]
127type = "machine_learning"
128[[rule.threat]]
129framework = "MITRE ATT&CK"
130[[rule.threat.technique]]
131id = "T1078"
132name = "Valid Accounts"
133reference = "https://attack.mitre.org/techniques/T1078/"
134[[rule.threat.technique.subtechnique]]
135id = "T1078.002"
136name = "Domain Accounts"
137reference = "https://attack.mitre.org/techniques/T1078/002/"
138
139[[rule.threat.technique.subtechnique]]
140id = "T1078.003"
141name = "Local Accounts"
142reference = "https://attack.mitre.org/techniques/T1078/003/"
143
144
145
146[rule.threat.tactic]
147id = "TA0001"
148name = "Initial Access"
149reference = "https://attack.mitre.org/tactics/TA0001/"

Triage and analysis

Investigating Rare User Logon

This rule uses a machine learning job to detect an unusual user name in authentication logs, which could detect new accounts created for persistence.

Possible investigation steps

  • Check if the user was newly created and if the company policies were followed.
    • Identify the user account that performed the action and whether it should perform this kind of action.
  • Investigate other alerts associated with the involved users during the past 48 hours.
  • Investigate any abnormal account behavior, such as command executions, file creations or modifications, and network connections.

False positive analysis

  • Accounts that are used for specific purposes — and therefore not normally active — may trigger the alert.

Response and remediation

  • Initiate the incident response process based on the outcome of the triage.
  • 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.
  • 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).

References

Related rules

to-top