diff --git a/rules/cross-platform/credential_access_sudo_brute_force.toml b/rules/cross-platform/credential_access_sudo_brute_force.toml new file mode 100644 index 0000000000..08e51a9b34 --- /dev/null +++ b/rules/cross-platform/credential_access_sudo_brute_force.toml @@ -0,0 +1,139 @@ +[metadata] +creation_date = "2026/12/01" +integration = ["endpoint"] +maturity = "production" +min_stack_comments = "MV_CONTAINS was added to ES|QL in 9.2.0 and is not available on 8.19; 9.4.0 is the lowest supported 9.x release." +min_stack_version = "9.4.0" +updated_date = "2026/12/01" + +[rule] +author = ["Elastic"] +description = """ +Detects repeated sudo credential-cache invalidation and password submission through standard input from the same parent +process. Adversaries may invalidate cached credentials before repeatedly supplying passwords to guess credentials or +validate a captured password. This behavior can occur on Linux and macOS. +""" +false_positives = [ + """ + Administrative scripts may deliberately reset the sudo timestamp and submit credentials through standard input. + Review the parent process and command lines before excluding known automation. + """, +] +from = "now-9m" +interval = "5m" +language = "esql" +license = "Elastic License v2" +name = "Repeated Sudo Credential Cache Resets and Password Submissions" +note = """## Triage and analysis + +### Investigating Repeated Sudo Credential Cache Resets and Password Submissions + +This rule groups sudo executions by host and parent process. A match contains at least three credential-cache resets +using `-k`, `--reset-timestamp`, `-K`, or `--remove-timestamp` and at least three password submissions using `-S` or +`--stdin`. + +### Possible investigation steps + +- Review `Esql.command_line_values` and `Esql.user_name_values` to identify the attempted commands and account. +- Inspect the parent process and its ancestry for an interactive shell, script, remote session, or recently created + executable. +- Correlate the time window with authentication failures, successful privilege escalation, and follow-on root activity. + +### False positive analysis + +- Confirm whether approved automation resets sudo timestamps and provides passwords through standard input. +- Exclude only the verified parent executable or automation account rather than suppressing sudo globally. + +### Response and remediation + +- Isolate the host if the attempts are unauthorized or followed by successful privileged activity. +- Reset affected credentials and review sudoers configuration and authentication logs. +""" +references = [ + "https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1110.001/T1110.001.yaml", + "https://www.sudo.ws/docs/man/sudo.man/", +] +risk_score = 47 +rule_id = "bba8ac38-f025-4679-997d-b500f614b953" +severity = "medium" +tags = [ + "Domain: Endpoint", + "OS: Linux", + "OS: macOS", + "Use Case: Threat Detection", + "Tactic: Credential Access", + "Data Source: Elastic Defend", + "Resources: Investigation Guide", + "Rule Type: ES|QL", + "Platform: Linux", + "Platform: macOS", +] +timestamp_override = "event.ingested" +type = "esql" + +query = ''' +FROM logs-endpoint.events.process-* +| WHERE host.os.type IN ("linux", "macos") AND + MV_CONTAINS(event.type, "start") AND + MV_CONTAINS(event.action, "exec") AND + process.name == "sudo" AND + ( + MV_CONTAINS(process.args, "-S") OR + MV_CONTAINS(process.args, "--stdin") OR + MV_CONTAINS(process.args, "-k") OR + MV_CONTAINS(process.args, "--reset-timestamp") OR + MV_CONTAINS(process.args, "-K") OR + MV_CONTAINS(process.args, "--remove-timestamp") + ) +| WHERE process.parent.entity_id IS NOT NULL +| STATS + Esql.sudo_stdin_attempts = COUNT(*) WHERE + MV_CONTAINS(process.args, "-S") OR MV_CONTAINS(process.args, "--stdin"), + Esql.sudo_timestamp_resets = COUNT(*) WHERE + MV_CONTAINS(process.args, "-k") OR + MV_CONTAINS(process.args, "--reset-timestamp") OR + MV_CONTAINS(process.args, "-K") OR + MV_CONTAINS(process.args, "--remove-timestamp"), + Esql.command_line_values = VALUES(process.command_line), + Esql.user_name_values = VALUES(user.name), + Esql.agent_id_values = VALUES(agent.id), + Esql.first_seen = MIN(@timestamp), + Esql.last_seen = MAX(@timestamp) + BY host.id, process.parent.entity_id +| WHERE + Esql.sudo_stdin_attempts >= 3 AND + Esql.sudo_timestamp_resets >= 3 +| KEEP host.id, process.parent.entity_id, Esql.* +''' + + +[[rule.threat]] +framework = "MITRE ATT&CK" +[[rule.threat.technique]] +id = "T1110" +name = "Brute Force" +reference = "https://attack.mitre.org/techniques/T1110/" +[[rule.threat.technique.subtechnique]] +id = "T1110.001" +name = "Password Guessing" +reference = "https://attack.mitre.org/techniques/T1110/001/" + + + +[rule.threat.tactic] +id = "TA0006" +name = "Credential Access" +reference = "https://attack.mitre.org/tactics/TA0006/" + +[rule.investigation_fields] +field_names = [ + "host.id", + "process.parent.entity_id", + "Esql.sudo_stdin_attempts", + "Esql.sudo_timestamp_resets", + "Esql.command_line_values", + "Esql.user_name_values", + "Esql.agent_id_values", + "Esql.first_seen", + "Esql.last_seen", +] diff --git a/rules/linux/defense_evasion_root_certificate_installation.toml b/rules/linux/defense_evasion_root_certificate_installation.toml index 77824ba37a..2fe0f80405 100644 --- a/rules/linux/defense_evasion_root_certificate_installation.toml +++ b/rules/linux/defense_evasion_root_certificate_installation.toml @@ -2,7 +2,7 @@ creation_date = "2024/08/28" integration = ["endpoint", "sentinel_one_cloud_funnel"] maturity = "production" -updated_date = "2026/09/18" +updated_date = "2026/12/01" [rule] author = ["Elastic"] @@ -100,38 +100,50 @@ tags = [ ] timestamp_override = "event.ingested" type = "eql" + query = ''' -process where host.os.type == "linux" and event.type == "start" and event.action in ("exec", "exec_event", "start") and -process.name in ("update-ca-trust", "update-ca-certificates") and not ( - process.parent.name like ( - "ca-certificates.postinst", "ca-certificates-*.trigger", "pacman", "pamac-daemon", "autofirma.postinst", - "ipa-client-install", "su", "platform-python", "python*", "kesl", "execd", "systemd", "flock" - ) or - process.parent.args like "/var/tmp/rpm*" or - (process.parent.name in ("sh", "bash", "zsh") and process.args == "-e") or - process.parent.executable in ( - "/app/update-cert-trust.sh", "/opt/puppetlabs/puppet/bin/puppet", "/opt/puppetlabs/puppet/bin/ruby", - "/start-haproxy", "/usr/bin/entrypoint.sh", "/usr/bin/crun" - ) or - process.parent.args like ( - "/entrypoint.sh", "/entrypoint", "./bootstrap-RHEL*", "lib/apk/exec/ca-certificates-*trigger" - ) or - ?process.working_directory == "/var/lib/rancher" -) +process where host.os.type == "linux" and + event.type == "start" and + event.action in ("exec", "exec_event", "start") and + ( + process.name in ("update-ca-trust", "update-ca-certificates") or + ( + process.name in ("sh", "dash", "bash") and + process.args in ("/bin/update-ca-trust", "/usr/bin/update-ca-trust", "/usr/sbin/update-ca-certificates") + ) + ) and + not ( + process.parent.name like ( + "ca-certificates.postinst", "ca-certificates-*.trigger", "pacman", "pamac-daemon", "autofirma.postinst", + "ipa-client-install", "su", "platform-python", "python*", "kesl", "execd", "systemd", "flock" + ) or + process.parent.args like "/var/tmp/rpm*" or + (process.parent.name in ("sh", "bash", "zsh") and process.args == "-e") or + process.parent.executable in ( + "/app/update-cert-trust.sh", "/opt/puppetlabs/puppet/bin/puppet", "/opt/puppetlabs/puppet/bin/ruby", + "/start-haproxy", "/usr/bin/entrypoint.sh", "/usr/bin/crun" + ) or + process.parent.args like ( + "/entrypoint.sh", "/entrypoint", "./bootstrap-RHEL*", "lib/apk/exec/ca-certificates-*trigger" + ) or + ?process.working_directory == "/var/lib/rancher" + ) ''' + + [[rule.threat]] framework = "MITRE ATT&CK" - [[rule.threat.technique]] id = "T1553" name = "Subvert Trust Controls" reference = "https://attack.mitre.org/techniques/T1553/" - [[rule.threat.technique.subtechnique]] id = "T1553.004" name = "Install Root Certificate" reference = "https://attack.mitre.org/techniques/T1553/004/" + + [rule.threat.tactic] id = "TA0005" name = "Defense Evasion" diff --git a/rules_building_block/collection_find_exec_sensitive_files.toml b/rules_building_block/collection_find_exec_sensitive_files.toml new file mode 100644 index 0000000000..2326eb4b30 --- /dev/null +++ b/rules_building_block/collection_find_exec_sensitive_files.toml @@ -0,0 +1,168 @@ +[metadata] +bypass_bbr_timing = true +creation_date = "2026/11/23" +integration = ["endpoint"] +maturity = "production" +updated_date = "2026/12/01" + +[rule] +author = ["Elastic"] +building_block_type = "default" +description = """ +Identifies the find utility started with -exec, -execdir, -ok, or -okdir and an argument that names a sensitive file. +Adversaries use this to locate browser history and credential stores, keychains, SSH, TLS, and GnuPG keys, cloud, +Terraform, and database credentials, or cryptocurrency wallets and then run a command against each match, such as echo, +cat, or cp. Each matching process start produces one signal with full process context for correlation. +""" +from = "now-9m" +index = ["logs-endpoint.events.process-*"] +language = "eql" +license = "Elastic License v2" +name = "Sensitive File Collection via Find -exec" +references = ["https://attack.mitre.org/techniques/T1217/", "https://attack.mitre.org/techniques/T1119/"] +risk_score = 21 +rule_id = "afee5aa8-3e45-48b8-b872-bbc2b9555e93" +severity = "low" +tags = [ + "Domain: Endpoint", + "OS: Linux", + "OS: macOS", + "Use Case: Threat Detection", + "Tactic: Collection", + "Tactic: Credential Access", + "Tactic: Discovery", + "Data Source: Elastic Defend", + "Rule Type: BBR", + "Rule Type: Event Correlation (EQL)", + "Platform: Linux", + "Platform: macOS", +] +timestamp_override = "event.ingested" +type = "eql" + +query = ''' +process where host.os.type in ("linux", "macos") and + event.type == "start" and + event.action == "exec" and + process.name == "find" and + process.args in ("-exec", "-execdir", "-ok", "-okdir") and + ( + /* Substrings go to process.command_line. That field is mapped as wildcard, so a leading + asterisk is an ngram lookup. The same pattern on process.args scans the keyword dictionary. */ + process.command_line like~ ( + /* Firefox profile stores */ + "*places.sqlite*", "*cookies.sqlite*", "*formhistory.sqlite*", "*signons.sqlite*", "*logins.json*", + "*key3.db*", "*key4.db*", "*cert8.db*", "*cert9.db*", + /* Safari stores */ + "*Bookmarks.plist*", "*Cookies.binarycookies*", "*Safari/History.db*", "*Safari/CloudTabs.db*", + /* Chromium password and key files. The name is distinctive without a browser path. */ + "*Login Data*", + /* Keychains and SSH keys */ + "*Library/Keychains*", "*login.keychain*", "*System.keychain*", + "*id_rsa*", "*id_ed25519*", "*id_ecdsa*", "*id_dsa*", "*id_xmss*", + "*/.ssh/id_*", "*/.ssh/authorized_keys*", + /* GnuPG directory, and TLS key and certificate files by extension at the end of an argument */ + "*.gnupg*", "*.pem", "*.pem *", "*.key", "*.key *", "*.pfx", "*.pfx *", "*.p12", "*.p12 *", + /* Cloud, kube, and token files */ + "*/.aws/credentials*", "*/.aws/config*", + "*gcloud/credentials.db*", "*gcloud/access_tokens.db*", "*application_default_credentials.json*", + "*/.azure/accessTokens.json*", "*/.azure/azureProfile.json*", "*/.azure/msal_token_cache.json*", + "*/.kube/config*", "*/.docker/config.json*", + "*git-credentials*", "*.netrc*", "*.npmrc*", "*.vault-token*", "*/.config/gh/hosts.yml*", + /* Terraform variable and state files, and database client credential files */ + "*.tfvars*", "*.tfstate*", "*.pgpass*", "*.my.cnf*", "*.mongorc.js*", + "*.env", "*.env *", "*.env.*", + /* Cryptocurrency wallets */ + "*/.electrum/*", + "*Application Support/Electrum*", "*Application Support/Exodus*", "*Application Support/Coinomi*", + "*Application Support/Atomic*", "*Application Support/@trezor*", "*Application Support/Ledger Live*", + "*Application Support/WasabiWallet*", "*Application Support/Bitcoin*", "*Application Support/Litecoin*", + "*Application Support/DashCore*", "*Application Support/ElectronCash*", "*Application Support/Guarda*", + "*Application Support/Dogecoin*", "*/Monero/*" + ) or + ( + process.command_line like~ ( + "*Chrome*", "*Edge*", "*Brave*", "*Chromium*", "*Opera*", "*Vivaldi*", "*Application Support/Arc*" + ) and + process.command_line like~ ("*Bookmarks*", "*History*", "*Cookies*", "*Web Data*", "*Local State*") + ) + ) +''' + + +[[rule.threat]] +framework = "MITRE ATT&CK" +[[rule.threat.technique]] +id = "T1005" +name = "Data from Local System" +reference = "https://attack.mitre.org/techniques/T1005/" + +[[rule.threat.technique]] +id = "T1119" +name = "Automated Collection" +reference = "https://attack.mitre.org/techniques/T1119/" + + +[rule.threat.tactic] +id = "TA0009" +name = "Collection" +reference = "https://attack.mitre.org/tactics/TA0009/" +[[rule.threat]] +framework = "MITRE ATT&CK" +[[rule.threat.technique]] +id = "T1083" +name = "File and Directory Discovery" +reference = "https://attack.mitre.org/techniques/T1083/" + +[[rule.threat.technique]] +id = "T1217" +name = "Browser Information Discovery" +reference = "https://attack.mitre.org/techniques/T1217/" + + +[rule.threat.tactic] +id = "TA0007" +name = "Discovery" +reference = "https://attack.mitre.org/tactics/TA0007/" +[[rule.threat]] +framework = "MITRE ATT&CK" +[[rule.threat.technique]] +id = "T1539" +name = "Steal Web Session Cookie" +reference = "https://attack.mitre.org/techniques/T1539/" + +[[rule.threat.technique]] +id = "T1552" +name = "Unsecured Credentials" +reference = "https://attack.mitre.org/techniques/T1552/" +[[rule.threat.technique.subtechnique]] +id = "T1552.001" +name = "Credentials In Files" +reference = "https://attack.mitre.org/techniques/T1552/001/" + +[[rule.threat.technique.subtechnique]] +id = "T1552.004" +name = "Private Keys" +reference = "https://attack.mitre.org/techniques/T1552/004/" + + +[[rule.threat.technique]] +id = "T1555" +name = "Credentials from Password Stores" +reference = "https://attack.mitre.org/techniques/T1555/" +[[rule.threat.technique.subtechnique]] +id = "T1555.001" +name = "Keychain" +reference = "https://attack.mitre.org/techniques/T1555/001/" + +[[rule.threat.technique.subtechnique]] +id = "T1555.003" +name = "Credentials from Web Browsers" +reference = "https://attack.mitre.org/techniques/T1555/003/" + + + +[rule.threat.tactic] +id = "TA0006" +name = "Credential Access" +reference = "https://attack.mitre.org/tactics/TA0006/" diff --git a/rules_building_block/discovery_of_domain_groups.toml b/rules_building_block/discovery_of_domain_groups.toml index 65ca05fe1a..b001fec1fa 100644 --- a/rules_building_block/discovery_of_domain_groups.toml +++ b/rules_building_block/discovery_of_domain_groups.toml @@ -2,7 +2,7 @@ creation_date = "2023/08/23" integration = ["endpoint", "auditd_manager", "crowdstrike"] maturity = "production" -updated_date = "2026/09/18" +updated_date = "2026/12/01" [rule] author = ["Elastic"] @@ -12,7 +12,13 @@ Identifies the execution of Linux built-in commands related to account or group and group information to orient themselves before deciding how to act. """ from = "now-119m" -index = ["logs-endpoint.events.*", "endgame-*", "auditbeat-*", "logs-auditd_manager.auditd-*", "logs-crowdstrike.fdr*"] +index = [ + "logs-endpoint.events.*", + "endgame-*", + "auditbeat-*", + "logs-auditd_manager.auditd-*", + "logs-crowdstrike.fdr*", +] interval = "60m" language = "eql" license = "Elastic License v2" @@ -37,26 +43,34 @@ timestamp_override = "event.ingested" type = "eql" query = ''' -process where host.os.type == "linux" and event.type == "start" and event.action in ("exec", "exec_event", "executed", "process_started", "ProcessRollup2") - and ( - process.name in ("ldapsearch", "dscacheutil") or (process.name == "dscl" and process.args : "*-list*") -) +process where host.os.type == "linux" and + event.type == "start" and + event.action in ("exec", "exec_event", "executed", "process_started", "ProcessRollup2") and + ( + process.name in ("ldapsearch", "dscacheutil") or + (process.name == "dscl" and process.args : "*-list*") or + ( + process.name like "python*" and + process.command_line like~ "*/ldapdomaindump*" and + process.args in ("-u", "--username") + ) + ) ''' [[rule.threat]] framework = "MITRE ATT&CK" - [[rule.threat.technique]] id = "T1069" name = "Permission Groups Discovery" reference = "https://attack.mitre.org/techniques/T1069/" - [[rule.threat.technique.subtechnique]] id = "T1069.002" name = "Domain Groups" reference = "https://attack.mitre.org/techniques/T1069/002/" + + [rule.threat.tactic] id = "TA0007" name = "Discovery" diff --git a/rules_building_block/persistence_linux_directory_account_creation_via_command_line.toml b/rules_building_block/persistence_linux_directory_account_creation_via_command_line.toml new file mode 100644 index 0000000000..dfec340e0c --- /dev/null +++ b/rules_building_block/persistence_linux_directory_account_creation_via_command_line.toml @@ -0,0 +1,77 @@ +[metadata] +bypass_bbr_timing = true +creation_date = "2026/12/01" +integration = ["endpoint"] +maturity = "production" +updated_date = "2026/12/01" + +[rule] +author = ["Elastic"] +building_block_type = "default" +description = """ +Identifies Linux directory account creation commands executed through common LDAP, Samba, and Active Directory +administration utilities. These commands are legitimate in directory administration but can provide useful persistence +context when correlated with other suspicious activity. +""" +from = "now-9m" +index = ["logs-endpoint.events.process-*"] +language = "eql" +license = "Elastic License v2" +name = "Directory Account Creation via Linux Command Line" +references = ["https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1136.002/T1136.002.yaml"] +risk_score = 47 +rule_id = "7e0598c2-45f2-400c-a579-31146df6277d" +severity = "medium" +tags = [ + "Domain: Endpoint", + "OS: Linux", + "Use Case: Threat Detection", + "Tactic: Persistence", + "Data Source: Elastic Defend", + "Rule Type: BBR", + "Rule Type: Event Correlation (EQL)", + "Platform: Linux", +] +timestamp_override = "event.ingested" +type = "eql" + +query = ''' +process where host.os.type == "linux" and + event.type == "start" and + event.action == "exec" and + ( + (process.name == "ldapmodify" and process.args in ("ldapadd", "-a")) or + (process.name == "ldapadd" and process.args == "ldapadd") or + ( + process.name == "samba-tool" and + process.args == "user" and + process.args in ("add", "create") + ) or + ( + process.name == "net" and + process.args in ("ads", "rpc") and + process.args == "user" and + process.args == "add" + ) or + (process.name == "adtool" and process.args == "useradd") + ) +''' + + +[[rule.threat]] +framework = "MITRE ATT&CK" +[[rule.threat.technique]] +id = "T1136" +name = "Create Account" +reference = "https://attack.mitre.org/techniques/T1136/" +[[rule.threat.technique.subtechnique]] +id = "T1136.002" +name = "Domain Account" +reference = "https://attack.mitre.org/techniques/T1136/002/" + + + +[rule.threat.tactic] +id = "TA0003" +name = "Persistence" +reference = "https://attack.mitre.org/tactics/TA0003/"