file where host.os.type == "linux" and event.type == "creation" and file.name like "pam_*.so" and not file.path like (
"/lib/security/*",
"/lib64/security/*",
"/lib/x86_64-linux-gnu/security/*",
"/usr/lib/security/*",
"/usr/lib64/security/*",
"/usr/lib/x86_64-linux-gnu/security/*"
) and not (
process.name in ("dockerd", "containerd", "steam", "buildkitd", "unsquashfs", "pacman") or
file.path like (
"/build/rootImage/nix/store/*", "/home/*/.local/share/containers/*", "/nix/store/*", "/var/lib/containerd/*",
"/var/snap/*", "/usr/share/nix/nix/store/*", "/tmp/cura/squashfs-root/*", "/home/*/docker/*", "/tmp/containerd*"
)
)
Install detection rules in Elastic Security
Detect Pluggable Authentication Module (PAM) Creation in Unusual Directory in the Elastic Security detection engine by installing this rule into your Elastic Stack.
To setup this rule, check out the installation guide for Prebuilt Security Detection Rules(opens in a new tab or window).