Potential Subnet Scanning Activity from Compromised Host

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

About

This rule detects potential subnet scanning activity from a compromised host. Subnet scanning is a common reconnaissance technique used by attackers to identify live hosts within a network range. A compromised host may exhibit subnet scanning behavior when an attacker is attempting to map out the network topology, identify vulnerable hosts, or prepare for further exploitation. This rule identifies potential subnet scanning activity by monitoring network connection attempts from a single host to a large number of hosts within a short time frame. 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: DiscoveryData Source: Elastic DefendLanguage: esql
Severity
medium
Risk Score
47
MITRE ATT&CK™

Discovery (TA0007)(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.network-* metadata _id, _index, _version | mv_expand event.action | where host.os.type == "linux" and event.type == "start" and event.action == "connection_attempted" and not ( process.executable in ("/usr/local/bin/prometheus", "/app/extra/chrome", "/usr/lib/virtualbox/VBoxHeadless", "/usr/bin/prometheus") or process.executable like "/usr/local/prometheus/*/prometheus" or process.executable like "/usr/share/elastic-agent/*" or process.executable like "/var/lib/docker/overlay*connectord" or process.executable like "/opt/rumble/bin/rumble-agent*" or process.executable like "/opt/gitlab/*" or process.executable like "/opt/google/chrome/chrome*" or process.executable like "/snap/firefox/*/firefox" or process.executable like "/var/lib/docker/overlay2/*/qbittorrent-nox" ) | keep @timestamp, _id, _index, _version, host.os.type, event.type, event.action, process.executable, destination.ip, agent.id, host.name, event.dataset, data_stream.namespace | stats Esql.event_count = count(), Esql.destination_ip_count_distinct = count_distinct(destination.ip), 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 | where Esql.agent_id_count_distinct == 1 and Esql.destination_ip_count_distinct > 250 | 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, Esql.*

Install detection rules in Elastic Security

Detect Potential Subnet Scanning Activity from Compromised Host 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).