Suspicious Network Connection via systemd

Last updated 24 days ago on 2025-12-09
Created 2 years ago on 2024-02-01

About

Detects suspicious network events executed by systemd, potentially indicating persistence through a systemd backdoor. Systemd is a system and service manager for Linux operating systems, used to initialize and manage system processes. Attackers can backdoor systemd for persistence by creating or modifying systemd unit files to execute malicious scripts or commands, or by replacing legitimate systemd binaries with compromised ones, ensuring that their malicious code is automatically executed at system startup or during certain system events.
Tags
Domain: EndpointOS: LinuxUse Case: Threat DetectionTactic: PersistenceTactic: Command and ControlTactic: Defense EvasionData Source: Elastic DefendLanguage: eql
Severity
medium
Risk Score
47
MITRE ATT&CK™

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

Command and Control (TA0011)(external, opens in a new tab or window)

Defense Evasion (TA0005)(external, opens in a new tab or window)

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

Definition

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

endpoint(external, opens in a new tab or window)

Query
text code block:
sequence by host.id with maxspan=5s [process where host.os.type == "linux" and event.type == "start" and event.action == "exec" and process.parent.name == "systemd" and ( process.name in ( "openssl", "nc", "ncat", "netcat", "nc.openbsd", "nc.traditional", "socat", "busybox", "mkfifo", "nohup", "setsid", "xterm", "telnet", "awk" ) or (process.name : "python*" and process.args : "-c" and process.args : ( "*import*pty*spawn*", "*import*subprocess*call*" )) or (process.name : "perl*" and process.args : "-e" and process.args : "*socket*" and process.args : ( "*exec*", "*system*" )) or (process.name : "ruby*" and process.args : ("-e", "-rsocket") and process.args : ( "*TCPSocket.new*", "*TCPSocket.open*" )) or (process.name : "lua*" and process.args : "-e" and process.args : "*socket.tcp*" and process.args : ( "*io.popen*", "*os.execute*" )) or (process.name : "php*" and process.args : "-r" and process.args : "*fsockopen*" and process.args : "*/bin/*sh*") or (process.name == "node" and process.args == "-e" and process.args : "*spawn*sh*" and process.args : "*connect*") or (process.name : ("awk", "gawk", "mawk", "nawk") and process.args : "*/inet/tcp/*") or (process.name in ("rvim", "vim", "vimdiff", "rview", "view") and process.args == "-c" and process.args : "*socket*") ) and not ( process.args in ("/usr/bin/pg_ctlcluster", "/usr/bin/pveproxy", "/usr/sbin/pveum", "/usr/bin/pveupdate") or process.executable like ("/usr/local/cpanel/*/bin/perl", "/opt/puppetlabs/puppet/bin/ruby") ) ] by process.entity_id [network where host.os.type == "linux" and event.action == "connection_attempted" and event.type == "start" and not process.executable == "/tmp/newroot/bin/curl"] by process.parent.entity_id

Install detection rules in Elastic Security

Detect Suspicious Network Connection via systemd 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(external, opens in a new tab or window).