Unusual Process Spawned from Web Server Parent

Last updated 22 days ago on 2026-01-16
Created a year ago on 2025-03-04

About

This rule detects unusual processes spawned from a web server parent process by identifying low frequency counts of process spawning activity. Unusual process spawning activity may indicate an attacker attempting to establish persistence, execute malicious commands, or establish command and control channels on the host system. ESQL rules have limited fields available in its alert documents. Make sure to review the original documents to aid in the investigation of this alert.
Tags
Domain: EndpointOS: LinuxUse Case: Threat DetectionTactic: PersistenceTactic: ExecutionTactic: Command and ControlData Source: Elastic DefendLanguage: esql
Severity
low
Risk Score
21
MITRE ATT&CK™

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

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

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

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

Definition

Integration Pack
Prebuilt Security Detection Rules
Related Integrations

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

Query
text code block:
from logs-endpoint.events.process-* metadata _id, _index, _version | mv_expand event.action | where host.os.type == "linux" and event.type == "start" and event.action == "exec" and ( ( process.parent.name in ( "apache", "nginx", "apache2", "httpd", "lighttpd", "caddy", "mongrel_rails", "gunicorn", "uwsgi", "openresty", "cherokee", "h2o", "resin", "puma", "unicorn", "traefik", "tornado", "hypercorn", "daphne", "twistd", "yaws", "webfsd", "httpd.worker", "flask", "rails", "mongrel", "php-cgi", "php-fcgi", "php-cgi.cagefs", "catalina.sh", "hiawatha", "lswsctrl" ) or process.parent.name like "php-fpm*" or user.name in ("apache", "www-data", "httpd", "nginx", "lighttpd", "tomcat", "tomcat8", "tomcat9") or user.id in ("33", "498", "48") or (process.parent.name == "java" and process.parent.working_directory like "/u0?/*") or process.parent.working_directory like "/var/www/*" ) ) and ( process.name in ( "bash", "dash", "sh", "tcsh", "csh", "zsh", "ksh", "fish", "socat", "openssl", "busybox", "nc", "ncat", "netcat", "nc.openbsd", "nc.traditional", "nohup", "setsid", "mkfifo", "mknod", "node", "socket" ) or process.name like "python*" or process.name like "php*" or process.name like "perl" or process.name like "ruby*" or process.name like "lua*" or process.executable like "/tmp/*" or process.executable like "/var/tmp/*" or process.executable like "/dev/shm/*" or process.executable like "/var/log/*" or process.executable like "/sys/*" or process.executable like "/media/*" or process.executable like "/proc/*" or process.executable like "/var/backups/*" or process.executable like "/var/mail/*" or process.executable like "/var/spool/*" or process.executable like "/var/www/*" or process.executable like "./*" or process.name like ".*" ) and not ( process.working_directory like "/home/*" or process.working_directory == "/" or process.working_directory like "/var/www/*.ch" or process.parent.executable like "/vscode/vscode-server/*" ) | keep @timestamp, _id, _index, _version, host.os.type, event.type, event.action, process.parent.name, user.name, user.id, process.working_directory, process.parent.working_directory, process.name, process.executable, process.command_line, process.parent.executable, agent.id, host.name, event.dataset, data_stream.namespace | stats Esql.event_count = count(), Esql.agent_id_count_distinct = count_distinct(agent.id), Esql.host_name_values = values(host.name), Esql.agent_id_values = values(agent.id), Esql.event_dataset_values = values(event.dataset), Esql.data_stream_namespace_values = values(data_stream.namespace) by process.executable, process.working_directory, process.parent.executable | where Esql.agent_id_count_distinct == 1 and Esql.event_count < 5 | sort Esql.event_count asc // Extract unique values to ECS fields for alerts exclusion | eval agent.id = mv_min(Esql.agent_id_values), host.name = mv_min(Esql.host_name_values) | keep agent.id, host.name, process.executable, process.working_directory, process.parent.executable, Esql.*

Install detection rules in Elastic Security

Detect Unusual Process Spawned from Web Server Parent 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).