Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
139 changes: 139 additions & 0 deletions rules/cross-platform/credential_access_sudo_brute_force.toml
Original file line number Diff line number Diff line change
@@ -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",
]
52 changes: 32 additions & 20 deletions rules/linux/defense_evasion_root_certificate_installation.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down Expand Up @@ -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"
Expand Down
168 changes: 168 additions & 0 deletions rules_building_block/collection_find_exec_sensitive_files.toml
Original file line number Diff line number Diff line change
@@ -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/"
Loading
Loading