Detection rules › Elastic

Creation of Hidden Shared Object File

Source
github.com/elastic/protections-artifacts

Identifies the creation of a hidden shared object (.so) file. Users can mark specific files as hidden simply by putting a "." as the first character in the file or folder name. Adversaries can use this to their advantage to hide files and folders on the system for persistence and defense evasion.

MITRE ATT&CK coverage

Rule body

[rule]
description = """
Identifies the creation of a hidden shared object (.so) file. Users can mark specific files as hidden simply by putting
a "." as the first character in the file or folder name. Adversaries can use this to their advantage to hide files and
folders on the system for persistence and defense evasion.
"""
id = "61b20f0f-d342-4b32-bc77-195037b0dc82"
license = "Elastic License v2"
name = "Creation of Hidden Shared Object File"
os_list = ["linux"]
version = "1.0.3"

query = '''
file where event.type == "creation" and file.name like~ ".*.so" and (
  process.name in (
    "sudo", "link", "find", "xargs", "install", "coreutils", "gzip", "bzip2", "mv", "ln", "busybox",
    "bash", "zsh", "sh", "tcsh", "csh", "ksh", "fish", "mksh", "touch", "curl", "wget"
  ) or
  process.name like ".*" or
  process.executable like (
    "./*", "/dev/shm/*", "/tmp/*", "/var/tmp/*", "/run/*", "/var/run/*", "/boot/*", "/sys/*",
    "/lost+found/*", "/proc/*", "/var/mail/*", "/var/www/*", "/root/*", "/home/*"
  )
) and
not (
  process.executable like (
    "/home/*/.opencode/bin/opencode", "/home/*/.nvm/*/bin/kilo", "/home/*/.vscode-server/*/server/node",
    "/home/*/.local/share/containers/storage/overlay/*/opencode", "./usr/bin/podman",
    "/usr/local/share/npm-global/lib/node_modules/opencode-ai/bin/.opencode", "/home/*/.aimee-code/bin/opencode"
  ) or
  file.name like ("._*", ".*-00000000.so") or
  file.path like ("/home/*/.local/share/containers/storage/overlay/*", "/scratch/user/*/ZEBULON/CODE/.files-libLocal.so")
)
'''

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

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

[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1129"
name = "Shared Modules"
reference = "https://attack.mitre.org/techniques/T1129/"


[threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1564"
name = "Hide Artifacts"
reference = "https://attack.mitre.org/techniques/T1564/"
[[threat.technique.subtechnique]]
id = "T1564.001"
name = "Hidden Files and Directories"
reference = "https://attack.mitre.org/techniques/T1564/001/"



[threat.tactic]
id = "TA0005"
name = "Defense Evasion"
reference = "https://attack.mitre.org/tactics/TA0005/"

[internal]
min_endpoint_version = "7.15.0"

Stages and Predicates

Stage 1: file

file where event.type == "creation" and file.name like~ ".*.so" and (
  process.name in (
    "sudo", "link", "find", "xargs", "install", "coreutils", "gzip", "bzip2", "mv", "ln", "busybox",
    "bash", "zsh", "sh", "tcsh", "csh", "ksh", "fish", "mksh", "touch", "curl", "wget"
  ) or
  process.name like ".*" or
  process.executable like (
    "./*", "/dev/shm/*", "/tmp/*", "/var/tmp/*", "/run/*", "/var/run/*", "/boot/*", "/sys/*",
    "/lost+found/*", "/proc/*", "/var/mail/*", "/var/www/*", "/root/*", "/home/*"
  )
) and
not (
  process.executable like (
    "/home/*/.opencode/bin/opencode", "/home/*/.nvm/*/bin/kilo", "/home/*/.vscode-server/*/server/node",
    "/home/*/.local/share/containers/storage/overlay/*/opencode", "./usr/bin/podman",
    "/usr/local/share/npm-global/lib/node_modules/opencode-ai/bin/.opencode", "/home/*/.aimee-code/bin/opencode"
  ) or
  file.name like ("._*", ".*-00000000.so") or
  file.path like ("/home/*/.local/share/containers/storage/overlay/*", "/scratch/user/*/ZEBULON/CODE/.files-libLocal.so")
)

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
file.namewildcard._*, .*-00000000.soexcludes:file.name field:"file.name" value:"._*" field:"file.name" value:".*-00000000.so"
file.pathwildcard/home/*/.local/share/containers/storage/overlay/*, /scratch/user/*/ZEBULON/CODE/.files-libLocal.soexcludes:file.path field:"file.path" value:"/home/*/.local/share/containers/storage/overlay/*" field:"file.path" value:"/scratch/user/*/ZEBULON/CODE/.files-libLocal.so"
process.executablewildcard/home/*/.opencode/bin/opencode, /home/*/.nvm/*/bin/kilo, /home/*/.vscode-server/*/server/node, /home/*/.local/share/containers/storage/overlay/*/opencode, ./usr/bin/podman, /usr/local/share/npm-global/lib/node_modules/opencode-ai/bin/.opencode, /home/*/.aimee-code/bin/opencodeexcludes:process.executable

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.typeeq
  • creation
field:"event.type" kind:eq value:"creation"
file.namewildcard
  • .*.so
field:"file.name" kind:wildcard value:".*.so"
process.executablewildcard
  • ./*
  • /boot/*
  • /dev/shm/*
  • /home/*
  • /lost+found/*
  • /proc/*
  • /root/*
  • /run/*
  • /sys/*
  • /tmp/*
  • /var/mail/*
  • /var/run/*
  • /var/tmp/*
  • /var/www/*
field:"Image" kind:wildcard
process.namein
  • bash
  • busybox
  • bzip2
  • coreutils
  • csh
  • curl
  • find
  • fish
  • gzip
  • install
  • ksh
  • link
  • ln
  • mksh
  • mv
  • sh
  • sudo
  • tcsh
  • touch
  • wget
  • xargs
  • zsh
field:"process_name" kind:in
process.namewildcard
  • .*
field:"process_name" kind:wildcard value:".*"