skills/security-threat-hunting/SKILL.md
Interactive threat hunting workflow using ES|QL and Elasticsearch queries — from hypothesis formulation through data exploration, IOC search, and finding documentation.
npx skillsauth add patrykkopycinski/elastic-cursor-plugin security-threat-huntingInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Guide the user through proactive threat hunting in their Elastic Security deployment.
Use when the user asks to:
Also activates on keywords: "threat hunt", "IOC search", "suspicious activity", "behavioral hunt", "anomaly hunt"
Do NOT use when:
security-full-setup)security-detection-engineering)Call get_cluster_context to get cached cluster awareness — version, health, installed features, and security data availability. This informs which data sources and query capabilities are available for the hunt.
Ask the user what they want to hunt for. Common starting points:
Call discover_security_data with relevant data_sources to confirm data availability.
Map the hypothesis to required data:
logs-endpoint* (Elastic Defend)packetbeat-*, logs-network_traffic*auditbeat-*, logs-system*, winlogbeat-*logs-aws.cloudtrail*, logs-gcp.audit*, logs-azure.activitylogs*packetbeat-*, logs-* with dns.* fieldslogs-endpoint* with file.* fieldsBuild iterative ES|QL queries to explore the data. Start broad and narrow down.
Example: Hunt for unusual PowerShell execution
FROM logs-endpoint*
| WHERE process.name == "powershell.exe" AND @timestamp >= NOW() - 7d
| STATS exec_count = COUNT(*), unique_args = COUNT_DISTINCT(process.args) BY host.name, user.name
| WHERE exec_count > 50 OR unique_args > 20
| SORT exec_count DESC
| LIMIT 20
Call esql_query to run each iteration. Present results and refine based on findings.
Example: Hunt for rare outbound connections
FROM logs-network_traffic*
| WHERE @timestamp >= NOW() - 24h AND direction == "outbound"
| STATS conn_count = COUNT(*), unique_hosts = COUNT_DISTINCT(source.ip) BY destination.ip, destination.port
| WHERE unique_hosts == 1 AND conn_count < 5
| SORT conn_count ASC
| LIMIT 50
Example: Hunt for brute force attempts
FROM logs-*
| WHERE event.category == "authentication" AND event.outcome == "failure" AND @timestamp >= NOW() - 24h
| STATS fail_count = COUNT(*) BY source.ip, user.name
| WHERE fail_count > 20
| SORT fail_count DESC
If specific IOCs are identified during the hunt:
Search for IP addresses:
FROM logs-* | WHERE (source.ip == "1.2.3.4" OR destination.ip == "1.2.3.4") AND @timestamp >= NOW() - 30d | STATS hits = COUNT(*) BY _index | SORT hits DESC
Search for file hashes:
FROM logs-endpoint* | WHERE process.hash.sha256 == "<hash>" AND @timestamp >= NOW() - 30d | STATS hits = COUNT(*) BY host.name, process.name
Search for domains:
Call elasticsearch_api with a wildcard query against dns.question.name or url.domain.
For each significant finding, present:
For each finding, ask the user:
manage_detection_rules)manage_cases)For findings that should become detections:
manage_detection_rules to create a rule from the hunt queryFor findings that need investigation:
manage_cases to create a casePresent the hunt results:
get_cluster_context — cached cluster awareness (version, health, capabilities)discover_security_data — verify data source availability for the huntesql_query — run iterative hunt querieselasticsearch_api — complex search queries (EQL sequences, nested, wildcard)manage_detection_rules — convert hunt findings into detection rulesmanage_cases — escalate findings to investigation casestriage_alerts — check if existing detections already cover the findingkibana_api — timeline creation, saved query managementelastic://docs/api/elasticsearch — Search API for complex hunt querieselastic://docs/api/kibana — Detection Engine for operationalizing hunt findingselastic://docs/api/security — Timeline and investigation APIsES_URL and ES_API_KEY configuredKIBANA_URL configured for rule creation and case managementInteractive Dashboard: When using Claude Desktop or other ext-apps hosts,
threat_huntrenders an investigation graph with entity expansion andattack_discoveryshows an ATT&CK flow diagram with kill chain visualization. In Cursor/CLI, both return markdown.
security-detection-engineering — operationalize hunt findings into persistent detection rulessecurity-case-management — track and manage investigations from hunt findingstesting
Start your security session with a personalized briefing — attacks, alerts, cases, rules, threat intel. Use as the first thing when starting security work.
testing
Interactive guide for complete Elastic Security setup — discovers data sources, assesses detection coverage, configures rules, and creates security dashboards.
testing
Guide for authoring custom detection rules — from threat hypothesis through rule creation, testing, and tuning with KQL, EQL, ES|QL, and threshold rules.
testing
Guide for creating and managing security investigation cases — from case creation through alert attachment, investigation tracking, and resolution.