Detection rules › Elastic

Multi-Value Secret Searching via Find

Time window
10s
Sequence by
process.parent.entity_id
Source
github.com/elastic/protections-artifacts

Identifies the execution of the find command with a multi-value search pattern to collect sensitive information. This is a common technique used by attackers to collect sensitive information from the system.

MITRE ATT&CK coverage

Rule body

[rule]
description = """
Identifies the execution of the find command with a multi-value search pattern to collect sensitive information. This is
a common technique used by attackers to collect sensitive information from the system.
"""
id = "18405ccf-5443-4577-8b25-629aac642002"
license = "Elastic License v2"
name = "Multi-Value Secret Searching via Find"
os_list = ["linux"]
reference = [
    "https://socket.dev/blog/10-npm-typosquatted-packages-deploy-credential-harvester",
    "https://futuresearch.ai/blog/litellm-pypi-supply-chain-attack/",
    "https://www.virustotal.com/gui/file/71e35aef03099cd1f2d6446734273025a163597de93912df321ef118bf135238",
]
version = "1.0.1"

query = '''
sequence by process.parent.entity_id with maxspan=10s
  [process where event.type == "start" and event.action == "exec" and process.name == "find" and 
  process.args == "-type" and process.args == "f" and process.command_line like~ (
    "*password*", "*passwd*", "*pwd*", "*secret*", "*token*", "*apikey*", "*api.key*", "*access_key*",
    "*private_key*", "*client_secret*", "*credential*", "*auth*", "*bearer*",
    "*begin private*", "*begin openssh private*", "*begin rsa private*", "*begin dsa private*", "*begin ec private*",
    "*id_rsa*", "*id_dsa*", "*id_ecdsa*", "*id_ed25519*", "*ssh-rsa*", "*ghp_*", "*github_pat*", "*xoxb-*",
    "*hooks.slack.com*", "*discord.com/api/webhooks*", "*/.aws/*", "*/.env *", "*/.azure/*",
    "*azure_client_id*", "*azure_tenant_id*", "*azure_client_secret*", "*azure_federated_token_file*",
    "*identity_endpoint*", "*identity_header*", "*msi_endpoint*", "*msi_secret*", "*/var/run/secrets/azure/*",
    "*/.config/gcloud/*", "*application_default_credentials.json*", "*type: service_account*", "*client_email*",
    "*/var/run/secrets/google/*", "*google_application_credentials*", "*/run/secrets/kubernetes.io/serviceaccount/*"
  ) and process.parent.executable != null and
  not (
    (process.args == "-L" and process.args == "-xdev") or
    process.parent.args like (
      "/etc/cron.daily/plesk-rrd-cleaner", "/war-deployment/ops.servers/backup.sh", "/home/*/tools/unyo/mulpay_deletelog.sh",
      "/usr/local/psa/admin/sbin/spamtrain", "plz-out/bin/pipeline/authn/authn.bin.sh", "/usr/bin/makepkg"
    ) or
    process.command_line in (
      "find /etc/zerum-stacks/lynx/wdr_proxy/.htpasswd -type f",
      "find /run/credentials/getty@tty4.service -xdev -type f ( -perm -0002 -a ! -perm -1000 )",
      "find /run/credentials/getty@tty3.service -xdev -type f ( -perm -0002 -a ! -perm -1000 )",
      "find /run/snapd/ns/authd-msentraid.mnt -xdev -type f -perm -002 -exec chmod o-w {} ;"
    ) or
    process.command_line like "find /var/tmp/portage/*" or
    process.parent.executable in ("/usr/bin/make", "/usr/bin/sw-engine", "/usr/local/bin/build_rpm") or
    process.working_directory like (
      "/opt/rapid7/ir_agent/components/endpoint_broker/common", "/__w/Modular-Teepee/Modular-Teepee",
      "/build*", "/opt/netconfs/home/*", "/tmp/plz_sandbox"
    ) or
    process.args like (
      "/run/credentials/systemd-*.service", "/var/lib/sannav/docker/containers/*/mounts/secrets", "/snap/authd-msentraid/*",
      "/home/*/.cache/yay/1password/pkg/1password/*", "/var/tmp/dracut.*/initramfs"
    ) or
    (process.parent.name == "bash" and process.parent.command_line like "*XDG_CONFIG_HOME*" and process.working_directory == "/tmp/plz_sandbox")
  )] as event0
  [process where event.type == "start" and event.action == "exec" and process.name == "find" and 
  not startswith~(process.command_line, event0.process.command_line) and
  process.args == "-type" and process.args == "f" and process.command_line like~ (
    "*password*", "*passwd*", "*pwd*", "*secret*", "*token*", "*apikey*", "*api.key*", "*access_key*",
    "*private_key*", "*client_secret*", "*credential*", "*auth*", "*bearer*",
    "*begin private*", "*begin openssh private*", "*begin rsa private*", "*begin dsa private*", "*begin ec private*",
    "*id_rsa*", "*id_dsa*", "*id_ecdsa*", "*id_ed25519*", "*ssh-rsa*", "*ghp_*", "*github_pat*", "*xoxb-*",
    "*hooks.slack.com*", "*discord.com/api/webhooks*", "*/.aws/*", "*/.env *", "*/.azure/*",
    "*azure_client_id*", "*azure_tenant_id*", "*azure_client_secret*", "*azure_federated_token_file*",
    "*identity_endpoint*", "*identity_header*", "*msi_endpoint*", "*msi_secret*", "*/var/run/secrets/azure/*",
    "*/.config/gcloud/*", "*application_default_credentials.json*", "*type: service_account*", "*client_email*",
    "*/var/run/secrets/google/*", "*google_application_credentials*", "*/run/secrets/kubernetes.io/serviceaccount/*"
  )] as event1
  [process where event.type == "start" and event.action == "exec" and process.name == "find" and
  not startswith~(process.command_line, event1.process.command_line) and
  process.args == "-type" and process.args == "f" and process.command_line like~ (
    "*password*", "*passwd*", "*pwd*", "*secret*", "*token*", "*apikey*", "*api.key*", "*access_key*",
    "*private_key*", "*client_secret*", "*credential*", "*auth*", "*bearer*",
    "*begin private*", "*begin openssh private*", "*begin rsa private*", "*begin dsa private*", "*begin ec private*",
    "*id_rsa*", "*id_dsa*", "*id_ecdsa*", "*id_ed25519*", "*ssh-rsa*", "*ghp_*", "*github_pat*", "*xoxb-*",
    "*hooks.slack.com*", "*discord.com/api/webhooks*", "*/.aws/*", "*/.env *", "*/.azure/*",
    "*azure_client_id*", "*azure_tenant_id*", "*azure_client_secret*", "*azure_federated_token_file*",
    "*identity_endpoint*", "*identity_header*", "*msi_endpoint*", "*msi_secret*", "*/var/run/secrets/azure/*",
    "*/.config/gcloud/*", "*application_default_credentials.json*", "*type: service_account*", "*client_email*",
    "*/var/run/secrets/google/*", "*google_application_credentials*", "*/run/secrets/kubernetes.io/serviceaccount/*"
  )]
'''

min_endpoint_version = "8.4.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0

[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 1

[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 2

[[actions]]
action = "kill_process"
field = "process.parent.entity_id"
state = 0

[[actions]]
action = "kill_process"
field = "process.parent.entity_id"
state = 1

[[actions]]
action = "kill_process"
field = "process.parent.entity_id"
state = 2

[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1082"
name = "System Information Discovery"
reference = "https://attack.mitre.org/techniques/T1082/"

[[threat.technique]]
id = "T1083"
name = "File and Directory Discovery"
reference = "https://attack.mitre.org/techniques/T1083/"


[threat.tactic]
id = "TA0007"
name = "Discovery"
reference = "https://attack.mitre.org/tactics/TA0007/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1074"
name = "Data Staged"
reference = "https://attack.mitre.org/techniques/T1074/"
[[threat.technique.subtechnique]]
id = "T1074.001"
name = "Local Data Staging"
reference = "https://attack.mitre.org/techniques/T1074/001/"


[[threat.technique]]
id = "T1119"
name = "Automated Collection"
reference = "https://attack.mitre.org/techniques/T1119/"


[threat.tactic]
id = "TA0009"
name = "Collection"
reference = "https://attack.mitre.org/tactics/TA0009/"

[internal]
min_endpoint_version = "8.4.0"

Stages and Predicates

Ordered sequence: each step below must occur in order within 10s, correlated by process.parent.entity_id.

Stage 1: process

[process where event.type == "start" and event.action == "exec" and process.name == "find" and 
  process.args == "-type" and process.args == "f" and process.command_line like~ (
    "*password*", "*passwd*", "*pwd*", "*secret*", "*token*", "*apikey*", "*api.key*", "*access_key*",
    "*private_key*", "*client_secret*", "*credential*", "*auth*", "*bearer*",
    "*begin private*", "*begin openssh private*", "*begin rsa private*", "*begin dsa private*", "*begin ec private*",
    "*id_rsa*", "*id_dsa*", "*id_ecdsa*", "*id_ed25519*", "*ssh-rsa*", "*ghp_*", "*github_pat*", "*xoxb-*",
    "*hooks.slack.com*", "*discord.com/api/webhooks*", "*/.aws/*", "*/.env *", "*/.azure/*",
    "*azure_client_id*", "*azure_tenant_id*", "*azure_client_secret*", "*azure_federated_token_file*",
    "*identity_endpoint*", "*identity_header*", "*msi_endpoint*", "*msi_secret*", "*/var/run/secrets/azure/*",
    "*/.config/gcloud/*", "*application_default_credentials.json*", "*type: service_account*", "*client_email*",
    "*/var/run/secrets/google/*", "*google_application_credentials*", "*/run/secrets/kubernetes.io/serviceaccount/*"
  ) and process.parent.executable != null and
  not (
    (process.args == "-L" and process.args == "-xdev") or
    process.parent.args like (
      "/etc/cron.daily/plesk-rrd-cleaner", "/war-deployment/ops.servers/backup.sh", "/home/*/tools/unyo/mulpay_deletelog.sh",
      "/usr/local/psa/admin/sbin/spamtrain", "plz-out/bin/pipeline/authn/authn.bin.sh", "/usr/bin/makepkg"
    ) or
    process.command_line in (
      "find /etc/zerum-stacks/lynx/wdr_proxy/.htpasswd -type f",
      "find /run/credentials/getty@tty4.service -xdev -type f ( -perm -0002 -a ! -perm -1000 )",
      "find /run/credentials/getty@tty3.service -xdev -type f ( -perm -0002 -a ! -perm -1000 )",
      "find /run/snapd/ns/authd-msentraid.mnt -xdev -type f -perm -002 -exec chmod o-w {} ;"
    ) or
    process.command_line like "find /var/tmp/portage/*" or
    process.parent.executable in ("/usr/bin/make", "/usr/bin/sw-engine", "/usr/local/bin/build_rpm") or
    process.working_directory like (
      "/opt/rapid7/ir_agent/components/endpoint_broker/common", "/__w/Modular-Teepee/Modular-Teepee",
      "/build*", "/opt/netconfs/home/*", "/tmp/plz_sandbox"
    ) or
    process.args like (
      "/run/credentials/systemd-*.service", "/var/lib/sannav/docker/containers/*/mounts/secrets", "/snap/authd-msentraid/*",
      "/home/*/.cache/yay/1password/pkg/1password/*", "/var/tmp/dracut.*/initramfs"
    ) or
    (process.parent.name == "bash" and process.parent.command_line like "*XDG_CONFIG_HOME*" and process.working_directory == "/tmp/plz_sandbox")
  )] as event0

Stage 2: process

[process where event.type == "start" and event.action == "exec" and process.name == "find" and 
  not startswith~(process.command_line, event0.process.command_line) and
  process.args == "-type" and process.args == "f" and process.command_line like~ (
    "*password*", "*passwd*", "*pwd*", "*secret*", "*token*", "*apikey*", "*api.key*", "*access_key*",
    "*private_key*", "*client_secret*", "*credential*", "*auth*", "*bearer*",
    "*begin private*", "*begin openssh private*", "*begin rsa private*", "*begin dsa private*", "*begin ec private*",
    "*id_rsa*", "*id_dsa*", "*id_ecdsa*", "*id_ed25519*", "*ssh-rsa*", "*ghp_*", "*github_pat*", "*xoxb-*",
    "*hooks.slack.com*", "*discord.com/api/webhooks*", "*/.aws/*", "*/.env *", "*/.azure/*",
    "*azure_client_id*", "*azure_tenant_id*", "*azure_client_secret*", "*azure_federated_token_file*",
    "*identity_endpoint*", "*identity_header*", "*msi_endpoint*", "*msi_secret*", "*/var/run/secrets/azure/*",
    "*/.config/gcloud/*", "*application_default_credentials.json*", "*type: service_account*", "*client_email*",
    "*/var/run/secrets/google/*", "*google_application_credentials*", "*/run/secrets/kubernetes.io/serviceaccount/*"
  )] as event1

Stage 3: process

[process where event.type == "start" and event.action == "exec" and process.name == "find" and
  not startswith~(process.command_line, event1.process.command_line) and
  process.args == "-type" and process.args == "f" and process.command_line like~ (
    "*password*", "*passwd*", "*pwd*", "*secret*", "*token*", "*apikey*", "*api.key*", "*access_key*",
    "*private_key*", "*client_secret*", "*credential*", "*auth*", "*bearer*",
    "*begin private*", "*begin openssh private*", "*begin rsa private*", "*begin dsa private*", "*begin ec private*",
    "*id_rsa*", "*id_dsa*", "*id_ecdsa*", "*id_ed25519*", "*ssh-rsa*", "*ghp_*", "*github_pat*", "*xoxb-*",
    "*hooks.slack.com*", "*discord.com/api/webhooks*", "*/.aws/*", "*/.env *", "*/.azure/*",
    "*azure_client_id*", "*azure_tenant_id*", "*azure_client_secret*", "*azure_federated_token_file*",
    "*identity_endpoint*", "*identity_header*", "*msi_endpoint*", "*msi_secret*", "*/var/run/secrets/azure/*",
    "*/.config/gcloud/*", "*application_default_credentials.json*", "*type: service_account*", "*client_email*",
    "*/var/run/secrets/google/*", "*google_application_credentials*", "*/run/secrets/kubernetes.io/serviceaccount/*"
  )]

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.argseq-Lexcludes:process.args field:"process.args" value:"-L"
process.argseq-xdevexcludes:process.args field:"process.args" value:"-xdev"
process.parent.command_linematchXDG_CONFIG_HOMEexcludes:process.parent.command_line field:"process.parent.command_line" value:"XDG_CONFIG_HOME"
process.parent.nameeqbashexcludes:process.parent.name field:"process.parent.name" value:"bash"
process.working_directoryeq/tmp/plz_sandboxexcludes:process.working_directory field:"process.working_directory" value:"/tmp/plz_sandbox"
process.argswildcard/run/credentials/systemd-*.service, /var/lib/sannav/docker/containers/*/mounts/secrets, /snap/authd-msentraid/*, /home/*/.cache/yay/1password/pkg/1password/*, /var/tmp/dracut.*/initramfsexcludes:process.args
process.command_lineinfind /etc/zerum-stacks/lynx/wdr_proxy/.htpasswd -type f, find /run/credentials/getty@tty3.service -xdev -type f ( -perm -0002 -a ! -perm -1000 ), find /run/credentials/getty@tty4.service -xdev -type f ( -perm -0002 -a ! -perm -1000 ), find /run/snapd/ns/authd-msentraid.mnt -xdev -type f -perm -002 -exec chmod o-w {} ;excludes:process.command_line
process.command_linestarts_withfind /var/tmp/portage/excludes:process.command_line field:"process.command_line" value:"find /var/tmp/portage/"
process.parent.argswildcard/etc/cron.daily/plesk-rrd-cleaner, /war-deployment/ops.servers/backup.sh, /home/*/tools/unyo/mulpay_deletelog.sh, /usr/local/psa/admin/sbin/spamtrain, plz-out/bin/pipeline/authn/authn.bin.sh, /usr/bin/makepkgexcludes:process.parent.args
process.parent.executablein/usr/bin/make, /usr/bin/sw-engine, /usr/local/bin/build_rpmexcludes:process.parent.executable field:"process.parent.executable" value:"/usr/bin/make" field:"process.parent.executable" value:"/usr/bin/sw-engine" field:"process.parent.executable" value:"/usr/local/bin/build_rpm"
process.working_directorywildcard/opt/rapid7/ir_agent/components/endpoint_broker/common, /__w/Modular-Teepee/Modular-Teepee, /build*, /opt/netconfs/home/*, /tmp/plz_sandboxexcludes:process.working_directory
process.command_linestarts_withevent0.process.command_lineexcludes:process.command_line field:"process.command_line" value:"event0.process.command_line"
process.command_linestarts_withevent1.process.command_lineexcludes:process.command_line field:"process.command_line" value:"event1.process.command_line"

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.actioneq
  • exec
field:"EventType" kind:eq value:"exec"
event.typeeq
  • start
field:"event.type" kind:eq value:"start"
process.argseq
  • -type
  • f
field:"process.args" kind:eq
process.command_linewildcard
  • */.aws/*
  • */.azure/*
  • */.config/gcloud/*
  • */.env *
  • */run/secrets/kubernetes.io/serviceaccount/*
  • */var/run/secrets/azure/*
  • */var/run/secrets/google/*
  • *access_key*
  • *api.key*
  • *apikey*
  • *application_default_credentials.json*
  • *auth*
  • *azure_client_id*
  • *azure_client_secret*
  • *azure_federated_token_file*
  • *azure_tenant_id*
  • *bearer*
  • *begin dsa private*
  • *begin ec private*
  • *begin openssh private*
  • *begin private*
  • *begin rsa private*
  • *client_email*
  • *client_secret*
  • *credential*
  • *discord.com/api/webhooks*
  • *ghp_*
  • *github_pat*
  • *google_application_credentials*
  • *hooks.slack.com*
  • *id_dsa*
  • *id_ecdsa*
  • *id_ed25519*
  • *id_rsa*
  • *identity_endpoint*
  • *identity_header*
  • *msi_endpoint*
  • *msi_secret*
  • *passwd*
  • *password*
  • *private_key*
  • *pwd*
  • *secret*
  • *ssh-rsa*
  • *token*
  • *type: service_account*
  • *xoxb-*
field:"CommandLine" kind:wildcard
process.nameeq
  • find
field:"process_name" kind:eq value:"find"
process.parent.executableis_not_null
  • (no value, null check)
field:"ParentImage" kind:is_not_null