Skip to main content

security-threat-hunting

We earn commissions when you shop through the links below.

Hypothesis-driven threat hunting in Elastic Security using iterative ES|QL exploration. Covers IOC search, anomaly identification, baseline comparison, lateral movement tracking, and turning hunt findings into cases and detection rules. Use when running a proactive hunt, investigating suspicious activity patterns, searching for indicators of compromise, or looking for rare events in security telemetry.

v1.0.0New

Install this skill

No account required. Pick your tool, or use the command that detects it for you.

Run in your terminal. It detects your AI tool.

npx @skills-hub-ai/cli install elastic-security-threat-hunting
Or get the file:
Browse all CLI commands β†’
Manual setup by platform

Claude Code

~/.claude/skills/elastic-security-threat-hunting/SKILL.md

Setup guide β†’

Signing

SignedSLSA L2
Signed by
skills-hub.ai distributor
Method
Distributor-signed by skills-hub.aiCryptographically signed by the skills-hub.ai distributor key at publish time.
Signed
0Save

Instructions

Threat Hunting

Hunt proactively for threats that detection rules have not surfaced. Start from a specific hypothesis, explore security
data iteratively with ES|QL, separate anomalies from legitimate behavior, and document what you find.

Environment Configuration

This skill executes Elasticsearch operations through the elastic CLI. If the
elastic CLI is not installed, tell the user what it is needed for. Do
not guess credentials, call the HTTP API directly, or attempt other workarounds.

This skill references operations in HTTP-shorthand form (e.g., GET /, GET /_cat/indices, GET /{index}/_mapping,
GET /{index}/_settings/index.mode, POST /_query). The Operations table at the end of this document
maps each shorthand to the equivalent elastic CLI command β€” always use the CLI rather than calling the HTTP API
directly.

Critical principles

  • Start with a hypothesis. Do not explore without direction. Tie each hunt to a MITRE ATT&CK technique, a threat
    report, or a specific question about your environment.
  • Rare is not malicious. A single-host, low-count result is a lead, not a finding. Corroborate it before escalating.
  • Zero rows does not mean clean. It means the hypothesis is not confirmed in this window, data source, and field
    set. Say so explicitly.
  • Report tool output verbatim. Copy hostnames, IPs, hashes, and counts exactly as returned. Do not invent details.

Hunting approaches

MethodDescriptionWhen to use
Hypothesis-drivenStart with a specific theory about adversary behaviorNew threat intel, emerging technique, "could this happen here?"
CTI-drivenSearch for known IOCs or TTPs from threat reportsAfter reading a threat report, advisory, or news
Data-drivenUse frequency analysis and statistical outliersBaseline hunting, anomaly detection, "what's unusual?"

Process

Step 1 β€” Formulate a hypothesis

Every hunt starts with a question. Good hypotheses are specific, testable, and scoped:

  • Good: "Are there LOLBin processes making DNS queries to rare external domains in our Windows fleet?"
  • Good: "Has any process established persistence via Run keys on a single host in the last 7 days?"
  • Bad: "Is there malware in our environment?" (too broad, not testable)

Define the expected data sources and the time window. Use 7–30 days for behavioral patterns and shorter windows for IOC
sweeps. Sources for hypotheses:

  • MITRE ATT&CK techniques relevant to your environment
  • Recent threat intelligence or advisories (CTI-driven)
  • Alert triage patterns, such as recurring false positives that hint at coverage gaps
  • Elastic Security Labs research

Data needed: a one-sentence hypothesis, the technique or actor it maps to, the data sources, and the time window.

Step 2 β€” Identify data sources

Discover which security indices exist with GET /_cat/indices, then confirm field availability before you query. Run
POST /_query with FROM <pattern> | LIMIT 0 to list the available fields without returning documents. Use
GET /{index}/_mapping only for a single concrete index: on a wildcard pattern it returns the mapping of every backing
index, which can reach megabytes. Prefer ECS field names for cross-source portability.

Common sources are in the table under Common indices for hunting. If an index the
hypothesis depends on is absent, say so and stop or adjust the hypothesis β€” do not query a pattern that matches nothing.

Data needed: confirmed index patterns and the fields available in each.

Step 3 β€” Explore iteratively

Run each query with POST /_query. Use an existing template from
references/query-templates.md (lateral movement, C2 beaconing, brute force, rare
process execution) or write a custom query.

Write custom ES|QL with these principles:

  • FROM: use the narrowest index pattern, such as logs-endpoint.events.process-*.
  • WHERE: scope every query with an @timestamp range, such as WHERE @timestamp >= NOW() - 7 DAYS, and filter
    early.
  • KEEP: select only the fields you need.
  • STATS: use COUNT(*), COUNT_DISTINCT(host.id), and VALUES() for frequency and outlier analysis. Aggregate
    before you pull raw events to understand data volume.
  • LIMIT: cap output, including aggregations.

Start broad to establish a baseline, then chain WHERE clauses to narrow. Avoid one overly complex query.

Data needed: aggregate results that show the shape of the data and which entities to examine.

Step 4 β€” Identify anomalies

Look for statistical outliers using the frequency pattern: aggregate by a field, count occurrences and distinct hosts,
then keep only the rare items.

FROM logs-endpoint.events.process-*
| WHERE @timestamp > NOW() - 7 day
  AND host.os.family == "windows"
  AND event.action == "start"
| STATS count = COUNT(*), hosts = COUNT_DISTINCT(host.id) BY process.executable
| WHERE hosts == 1 AND count <= 3
| SORT count ASC
| LIMIT 50

Interpret results:

  • Zero rows: the hypothesis is not confirmed in this window. Expand the lookback or adjust filters before you
    conclude anything.
  • Low count, single host: a high-interest finding. Investigate that host.
  • High count, many hosts: likely legitimate or systemic. Refine filters to reduce noise.
  • Aggregation outliers: rows with hosts == 1 or cc == 1 in frequency hunts are the most interesting.

Use percentile and standard deviation analysis (PERCENTILE(), STD_DEV()) to find volumetric anomalies. Compare
current activity against a historical baseline before you escalate. Normalize user-specific paths and GUIDs with
REPLACE() before aggregating β€” see references/hunting-guide.md.

Data needed: a short list of anomalous entities, each with the count and host spread that made it stand out.

Step 5 β€” Search for IOCs

For CTI-driven hunts, query for known-bad indicators: IP addresses, domains, file hashes, and registry keys. Use
POST /{index}/_search for exact-match lookups across indices, and check for related activity on the same entities
within a time window. Cross-reference findings against the threat intelligence you started from.

Data needed: which indicators matched, on which hosts, and when.

Step 6 β€” Investigate findings

When a hunt returns an interesting result, pivot into deeper investigation. Query the process tree around the finding
with POST /_query, anchored on the finding's absolute timestamp:

FROM logs-endpoint.events.process-*
| WHERE agent.id == "<agent_id>"
  AND @timestamp >= "<finding_time - 5min>"
  AND @timestamp <= "<finding_time + 10min>"
| KEEP @timestamp, process.name, process.command_line, process.pid, process.parent.name, process.executable
| SORT @timestamp
| LIMIT 50

For network context, file lineage, related alerts, and entity risk pivots, see
references/hunting-guide.md. For triage of related alerts, use the
security-alert-analysis skill.

Data needed: enough context to classify the finding as a confirmed threat, suspicious (needs more data), or benign.

Step 7 β€” Document and operationalize

Record the hypothesis, data explored, queries used, time range, and result. Then act on the finding:

  • Confirmed threat: create a case with IOCs, MITRE techniques, and affected entities. Use the kibana-cases skill
    for the case-management operation. Do not leave hunt results undocumented.
  • New detection gap: convert the hunting query into a detection rule so the coverage runs continuously. Validate the
    query against recent data before you enable the rule.
  • No findings: record the hypothesis, query, time range, and the "no findings" result. Consider scheduling the query
    as a recurring hunt or converting it to a detection rule for continuous coverage.

Data needed: classification, evidence summary, and the chosen follow-up action.

Common indices for hunting

Data sourceIndex patternKey fields
Endpoint processeslogs-endpoint.events.process-*process.name, process.command_line, process.parent.name, process.executable
Endpoint networklogs-endpoint.events.network-*destination.ip, destination.port, process.name, dns.question.name
Endpoint fileslogs-endpoint.events.file-*file.path, file.name, event.action
Endpoint registrylogs-endpoint.events.registry-*registry.path, registry.data.strings, process.name
Security alerts.alerts-security.alerts-*kibana.alert.rule.name, kibana.alert.severity
AWS CloudTraillogs-aws.cloudtrail-*event.action, aws.cloudtrail.user_identity.type

Guidelines

  • Hunt with direction. Every query serves the stated hypothesis. Stop and re-scope when it does not.
  • Aggregate before drilling down. Use STATS to understand volume before you pull raw events.
  • Report only tool output. Do not invent IDs, hostnames, IPs, or details not present in the tool response.
  • Preserve identifiers. Use the exact values the analyst provides in queries and responses.
  • Distinguish facts from inference. Label conclusions beyond tool output as your assessment.
  • Use absolute timestamps for pivots. Anchor follow-up queries on the finding's @timestamp, not NOW().
  • Validate before escalating. Check findings against known-good baselines first.
  • Document the trail. Future analysts need the hypothesis, queries, and results.

Examples

  • "Hunt for lateral movement using PsExec across all Windows hosts in the last 30 days."
  • "Search for any signs of credential dumping or LSASS access."
  • "Run a data-driven hunt for unusual outbound network connections."
  • "Check whether this IP from a threat report appears anywhere in our endpoint network data."

References

  • references/query-templates.md β€” starter ES|QL templates for lateral movement, C2
    beaconing, brute force, and rare process execution
  • references/hunting-guide.md β€” query design principles, hunting examples by MITRE
    tactic, and investigation pivots

Operations

HTTP API (shorthand)elastic CLI command
GET /_cat/indiceselastic es cat indices --index '<pattern>'
GET /{index}/_mappingelastic es indices get-mapping --index '<index>'
POST /_queryelastic es esql query --format tsv --query '<esql>'
POST /{index}/_searchelastic es search --index '<index>' --input-file '<query.json>'
This skill doesn’t include stateful context yet, instructions only. Learn about stateful skills.

Security

Loading security scan...

Reviews (0)

Browse all β†’
kibana-connectorsCreate and manage Kibana connectors for Slack, PagerDuty, Jira, webhooks, and more via REST API or Terraform. Use when configuring third-party integrations or managing connectors as code.0 installsobservability-service-reliabilityDesign and operate service reliability targets in Elastic Observability: choose an SLI type and a defensible target, pick a time window and budgeting method, create and maintain SLOs through the Kibana API, attach burn-rate alert rules, and decide when an SLO is the wrong instrument and a threshold rule, anomaly job, or synthetics monitor is right. Use when defining or reviewing SLOs and error budgets, tuning burn-rate alerting, reducing alert noise, or setting up availability monitoring for a user-facing endpoint.0 installskibana-auditEnable and configure Kibana audit logging for saved object access, logins, and space operations. Use when setting up Kibana audit, filtering events, or correlating Kibana and ES audit logs.0 installselasticsearch-query-optimizationDiagnose slow Elasticsearch Query DSL searches and propose measured fixes. Use when a search is slow, profile output shows an expensive clause, exact-match filters sit in scoring context, or leading wildcards dominate latency. Ground every recommendation in search profiling β€” move non-scoring clauses to filter context, eliminate leading wildcards, and re-profile to confirm improvement.0 installselasticsearch-anomaly-detection-explainerExplain Elasticsearch ML anomaly detection scores, model behavior, and result interpretation. Use when the user asks why a score is high or low, how the model learns, what the numbers mean, or how to troubleshoot unexpected anomaly scores.0 installsobservability-sre-triageTriage a degraded or suspect service end to end: read SLO status and burn rate, check active alerting rules and ML anomalies, measure throughput, latency, and error rate, assess dependency health and infrastructure saturation, and funnel logs down to the failures that explain it. Use when someone asks whether a service is healthy, why it is slow or erroring, what is in its logs, or which attribute distinguishes the requests that are failing. Also use when someone asks for the query behind any of those signals β€” throughput, latency percentiles, error rate, dependency health, or log volume β€” over APM/OTel traces, metrics, or logs.0 installs

More from Elastic

View source β†’
cloud-network-securityManage Serverless network security (traffic filters): create, update, and delete IP filters and AWS PrivateLink VPC filters. Use when restricting network access or configuring private connectivity.1 installscloud-provisioningProvision and operate Elastic Cloud infrastructure: create, connect to, update, and delete Serverless projects (Elasticsearch, Observability, Security); manage traffic filters (IP and AWS PrivateLink network security); and manage the lifecycle of Elastic Cloud Hosted deployments. Use when creating or performing day-2 operations on serverless projects or hosted deployments, or restricting their network access.1 installsobservability-service-healthAssess APM service health using SLOs, alerts, ML, throughput, latency, error rate, and dependencies. Use when checking service status, performance, or when the user asks about service health.0 installsobservability-edot-java-instrumentInstrument a Java application with the Elastic Distribution of OpenTelemetry (EDOT) Java agent for automatic tracing, metrics, and logs. Use when adding observability to a Java service that has no existing APM agent.0 installskibana-dashboardsCreate and manage Kibana Dashboards and Lens visualizations. Use when you need to define dashboards and visualizations declaratively, version control them, automate their deployment, or improve layout, sections, controls, or chart design.0 installsobservability-edot-dotnet-migrateMigrate a .NET application from the classic Elastic APM .NET agent to the EDOT .NET SDK. Use when switching from Elastic.Apm.* packages to Elastic.OpenTelemetry.0 installs

More Security skills

Browse category β†’

Frequently asked questions about security-threat-hunting

What does the security-threat-hunting skill do?

Hypothesis-driven threat hunting in Elastic Security using iterative ES|QL exploration. Covers IOC search, anomaly identification, baseline comparison, lateral movement tracking, and turning hunt findings into cases and detection rules. Use when running a proactive hunt, investigating suspicious activity patterns, searching for indicators of compromise, or looking for rare events in security telemetry. It's a reusable SKILL.md instruction set that loads into your AI coding assistant on demand, no prompt engineering, no copy-pasting every session.

How do I install the security-threat-hunting skill?

Run `npx @skills-hub-ai/cli install elastic-security-threat-hunting` from your terminal. The CLI writes the SKILL.md to the correct location for your AI tool (e.g. ~/.claude/skills/elastic-security-threat-hunting/ for Claude Code or ~/.cursor/skills/ for Cursor with --target cursor) and adds it to your project's .skills.json lockfile.

Which AI tools does security-threat-hunting work with?

security-threat-hunting runs in Claude Code. It follows the open Agent Skills standard (SKILL.md), so the same skill works in every supported tool without modification.

Is the security-threat-hunting skill free?

Yes. Every skill on skills-hub.ai is free and open-source. There are no premium tiers, paywalls, or usage limits. You only pay for whatever AI assistant you're already using.

How do I use security-threat-hunting after installing it?

In Claude Code, type `/elastic-security-threat-hunting` (or whatever slash command the skill registers) and the AI follows the skill's instructions immediately. You can also reference it by name in natural language, your AI loads the skill into context when relevant.

Can I share the security-threat-hunting skill with my team?

Yes. Commit your project's .skills.json lockfile and teammates run `npx @skills-hub-ai/cli install` (no args) to install every skill at the exact version you pinned. Organization-scoped installs work via skills-hub.ai organizations.