Elastic low stable eql

File Execution Permission Modification Detected via Defend for Containers

This rule detects when chmod is used to add the execute permission to a file inside a container. Modifying file permissions to make a file executable could indicate malicious activity, as an attacker may attempt to run unauthorized or malicious code inside the container.

View Source

Detection Logic

any where event.category in ("file", "process") and event.type in ("change", "creation", "start") and (
  process.name == "chmod" or
  (
    /* account for tools that execute utilities as a subprocess, in this case the target utility name will appear as a process arg */
    process.name in ("bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish", "busybox") and
    process.args in (
      "chmod", "/bin/chmod", "/usr/bin/chmod", "/usr/local/bin/chmod"
    ) and
    /* default exclusion list to not FP on default multi-process commands */
    not process.args in (
      "which", "/bin/which", "/usr/bin/which", "/usr/local/bin/which",
      "man", "/bin/man", "/usr/bin/man", "/usr/local/bin/man"
    )
  )
) and process.args in ("4755", "755", "0755", "777", "0777", "444", "+x", "a+x", "700", "0700") and
container.id like "?*" and
not (
  process.args == "-x" or
  (process.args like "/tmp/apt-key-gpghome.*" and process.parent.args == "/usr/bin/apt-key") or
  (process.parent.args == "/var/lib/dpkg/info/ca-certificates.postinst" and process.args == "/usr/local/share/ca-certificates")
)

Field Validations

Loading…

Comments (0)

Loading comments...