Suspicious File Creation in /etc for Persistence

Last updated 5 days ago on 2024-09-23
Created 2 years ago on 2022-07-22

About

Detects the manual creation of files in specific etc directories, via user root, used by Linux malware to persist and elevate privileges on compromised systems. File creation in these directories should not be entirely common and could indicate a malicious binary or script installing persistence mechanisms for long term access.
Tags
Domain: EndpointOS: LinuxUse Case: Threat DetectionTactic: PersistenceThreat: OrbitThreat: Lightning FrameworkData Source: Elastic EndgameData Source: Elastic Defend
Severity
medium
Risk Score
47
MITRE ATT&CK™

Persistence (TA0003)(opens in a new tab or window)

Execution (TA0002)(opens in a new tab or window)

Privilege Escalation (TA0004)(opens in a new tab or window)

License
Elastic License v2(opens in a new tab or window)

Definition

Rule Type
Event Correlation Rule
Integration Pack
Prebuilt Security Detection Rules
Index Patterns
logs-endpoint.events.*endgame-*
Related Integrations

endpoint(opens in a new tab or window)

Query
file where host.os.type == "linux" and event.type in ("creation", "file_create_event") and user.id == "0" and
file.path : ("/etc/ld.so.conf.d/*", "/etc/cron.d/*", "/etc/sudoers.d/*", "/etc/init.d/*", "/etc/systemd/system/*",
"/usr/lib/systemd/system/*") and not (
  (process.name : (
    "chef-client", "ruby", "pacman", "packagekitd", "python*", "platform-python", "dpkg", "yum", "apt", "dnf", "rpm",
    "systemd", "snapd", "dnf-automatic", "yum-cron", "elastic-agent", "dnfdaemon-system", "dockerd", "executor",
    "rhn_check"
    )
  ) or 
  (file.extension in ("swp", "swpx", "tmp"))
)

Install detection rules in Elastic Security

Detect Suspicious File Creation in /etc for Persistence 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).