Successful SSH Authentication from Unusual IP Address

This rule leverages the new_terms rule type to detect successful SSH authentications by an IP- address that has not been authenticated in the last 10 days. This behavior may indicate an attacker attempting to gain access to the system using a valid account.

Elastic rule (View on GitHub)

 1[metadata]
 2creation_date = "2025/02/21"
 3integration = ["system"]
 4maturity = "production"
 5updated_date = "2025/02/21"
 6
 7[rule]
 8author = ["Elastic"]
 9description = """
10This rule leverages the new_terms rule type to detect successful SSH authentications by an IP-
11address that has not been authenticated in the last 10 days. This behavior may indicate an
12attacker attempting to gain access to the system using a valid account.
13"""
14from = "now-9m"
15index = ["logs-system.auth-*", "filebeat-*"]
16language = "kuery"
17license = "Elastic License v2"
18name = "Successful SSH Authentication from Unusual IP Address"
19risk_score = 21
20rule_id = "5c495612-9992-49a7-afe3-0f647671fb60"
21setup = """## Setup
22
23This rule requires data coming in from one of the following integrations:
24- Filebeat
25
26### Filebeat Setup
27Filebeat is a lightweight shipper for forwarding and centralizing log data. Installed as an agent on your servers, Filebeat monitors the log files or locations that you specify, collects log events, and forwards them either to Elasticsearch or Logstash for indexing.
28
29#### The following steps should be executed in order to add the Filebeat for the Linux System:
30- Elastic provides repositories available for APT and YUM-based distributions. Note that we provide binary packages, but no source packages.
31- To install the APT and YUM repositories follow the setup instructions in this [helper guide](https://www.elastic.co/guide/en/beats/filebeat/current/setup-repositories.html).
32- To run Filebeat on Docker follow the setup instructions in the [helper guide](https://www.elastic.co/guide/en/beats/filebeat/current/running-on-docker.html).
33- To run Filebeat on Kubernetes follow the setup instructions in the [helper guide](https://www.elastic.co/guide/en/beats/filebeat/current/running-on-kubernetes.html).
34- For quick start information for Filebeat refer to the [helper guide](https://www.elastic.co/guide/en/beats/filebeat/8.11/filebeat-installation-configuration.html).
35- For complete Setup and Run Filebeat information refer to the [helper guide](https://www.elastic.co/guide/en/beats/filebeat/current/setting-up-and-running.html).
36
37#### Rule Specific Setup Note
38- This rule requires the Filebeat System Module to be enabled.
39- The system module collects and parses logs created by the system logging service of common Unix/Linux based distributions.
40- To run the system module of Filebeat on Linux follow the setup instructions in the [helper guide](https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-module-system.html).
41"""
42severity = "low"
43tags = [
44    "Domain: Endpoint",
45    "OS: Linux",
46    "Use Case: Threat Detection",
47    "Tactic: Initial Access",
48    "Data Source: Elastic Defend"
49]
50timestamp_override = "event.ingested"
51type = "new_terms"
52query = '''
53event.category:authentication and host.os.type:linux and event.action:ssh_login and event.outcome:success
54'''
55
56[[rule.threat]]
57framework = "MITRE ATT&CK"
58
59[rule.threat.tactic]
60id = "TA0001"
61name = "Initial Access"
62reference = "https://attack.mitre.org/tactics/TA0001/"
63
64[[rule.threat.technique]]
65id = "T1078"
66name = "Valid Accounts"
67reference = "https://attack.mitre.org/techniques/T1078/"
68
69[rule.new_terms]
70field = "new_terms_fields"
71value = ["related.ip"]
72
73[[rule.new_terms.history_window_start]]
74field = "history_window_start"
75value = "now-10d"

Related rules

to-top