CQURE Hacks #81: The Ultimate KQL Query Toolkit for Threat Hunters and Security Analysts

Source: CQURE Academy

Author: Daniel

URL: https://cqureacademy.com/blog/cqure-hacks-81-the-ultimate-kql-query-toolkit-for-threat-hunters-and-security-analysts/

https://cqureacademy.com/blog/cqure-hacks-81-the-ultimate-kql-query-toolkit-for-threat-hunters-and-security-analysts/

ONE SENTENCE SUMMARY:

Eight reusable KQL queries enable baselining, incident response, and threat hunting through traffic, auth, scanning, C2, anomalies, fingerprints, and egress monitoring.

MAIN POINTS:

  1. Daily baseline query tracks volume, success rate, failures, intrusion attempts, and unique IPs.
  2. Trend binning with 1-day intervals helps detect deviations like sudden intrusion spikes.
  3. Incident-response query identifies top malicious IPs, timing, attack types, ports, and protocols.
  4. make_set() highlights multi-technique attackers and supports rapid blocklisting and triage.
  5. Failed authentication analysis uses hourly grouping and thresholds to spot brute force patterns.
  6. Distinct source/target counts differentiate password spraying from targeted account attacks.
  7. Port-scan detection monitors 15-minute windows, flagging hosts probing multiple ports quickly.
  8. Botnet C2 hunting profiles payload percentiles and user agents to find beaconing behavior.
  9. Protocol anomaly detection flags rare protocol-port combinations and scores suspicious patterns via joins.
  10. User-agent and egress queries distinguish scanners from attackers and expose risky outbound communications.

TAKEAWAYS:

  1. Establish normal behavior first, then investigate meaningful deviations.
  2. Pivot quickly from baseline anomalies to attacker attribution and response actions.
  3. Use time windows, thresholds, and uniqueness metrics to reduce noise and reveal patterns.
  4. Combine behavioral profiling (payloads, user agents, protocol-port mismatches) with scoring for stealthy threats.
  5. Treat these queries as a coordinated, customizable toolkit run on reliable schedules.