DETECTION ENGINEERING / PUBLIC RESOURCE

Hunt with context.
Not just queries.

Practical KQL, Splunk SPL and YARA examples for defenders. Each entry explains its data assumptions and what to investigate. No searches, rule scans or code execute on this website.

8 original research examples

KQL-001KQL · Execution

Office process starts a script interpreter

Microsoft Defender XDR · MITRE T1059

Required: DeviceProcessEvents

Show query / rule and guidance
KQL example
DeviceProcessEvents
| where Timestamp > ago(7d)
| where InitiatingProcessFileName in~ ("winword.exe", "excel.exe", "powerpnt.exe")
| where FileName in~ ("powershell.exe", "pwsh.exe", "cmd.exe", "wscript.exe")
| project Timestamp, DeviceName, AccountName, InitiatingProcessFileName, FileName, ProcessCommandLine
| order by Timestamp desc

Analyst notes: Confirm parent-child relationship and inspect signed binaries, scripts and user context. Office add-ins and approved automation can trigger.

Author: CyberIntel original. Syntax and schema reference ↗

KQL-002KQL · Execution

Suspicious PowerShell command-line patterns

Microsoft Defender XDR · MITRE T1059.001

Required: DeviceProcessEvents

Show query / rule and guidance
KQL example
DeviceProcessEvents
| where Timestamp > ago(7d)
| where FileName in~ ("powershell.exe", "pwsh.exe")
| where ProcessCommandLine has_any ("EncodedCommand", "enc", "DownloadString")
| project Timestamp, DeviceName, AccountName, ProcessCommandLine, InitiatingProcessFileName

Analyst notes: Encoded commands may be legitimate administration. Decode offline in an isolated analysis environment and correlate with initiating process and device.

Author: CyberIntel original. Syntax and schema reference ↗

SPL-001SPL · Identity

Multiple failed Windows logons by account

Splunk Enterprise / Cloud · MITRE T1110

Required: Windows Security EventCode=4625

Show query / rule and guidance
SPL example
index=wineventlog sourcetype="WinEventLog:Security" EventCode=4625 earliest=-24h
| stats count as failures dc(ComputerName) as hosts by Account_Name, src_ip
| where failures >= 10
| sort - failures

Analyst notes: Replace index=wineventlog with your actual index; event fields and aliases differ by TA. Tune thresholds for service accounts and known scanners.

Author: CyberIntel original. Syntax and schema reference ↗

SPL-002SPL · Execution

PowerShell processes from Windows 4688 telemetry

Splunk Enterprise / Cloud · MITRE T1059.001

Required: Windows Security EventCode=4688 with command line enabled

Show query / rule and guidance
SPL example
index=wineventlog sourcetype="WinEventLog:Security" EventCode=4688 earliest=-7d
| eval cmd=coalesce(Process_Command_Line, CommandLine)
| where like(lower(cmd), "%powershell%")
| table _time host Account_Name New_Process_Name cmd

Analyst notes: Requires process creation auditing and command line inclusion. Adjust field extractions and avoid treating administrative scripting as automatically malicious.

Author: CyberIntel original. Syntax and schema reference ↗

SPL-003SPL · Network

Rare DNS questions for analyst triage

Splunk Enterprise / Cloud · MITRE T1071.004

Required: DNS telemetry mapped to query field

Show query / rule and guidance
SPL example
index=dns earliest=-24h
| stats count as requests dc(src_ip) as clients by query
| where clients <= 2 AND requests >= 3
| sort - requests
| head 100

Analyst notes: Adapt index and query field to your DNS source. Rare domains alone are not malicious; enrich with reputation, domain age and requesting process.

Author: CyberIntel original. Syntax and schema reference ↗

YARA-001YARA · File triage

PE file containing example PowerShell launch strings

YARA 4.x · MITRE T1059.001

Required: Local file bytes

Show query / rule and guidance
YARA example
rule CI_Demo_PowerShell_Strings
{
    meta:
        description = "Demo only: executable with PowerShell-related strings"
        author = "CyberIntel"
    strings:
        $mz = { 4D 5A }
        $ps1 = "powershell.exe" ascii nocase
        $ps2 = "-EncodedCommand" ascii nocase
    condition:
        filesize < 20MB and $mz at 0 and ($ps1 or $ps2)
}

Analyst notes: Educational heuristic, likely false positives in installers and admin software; no malware-family attribution. Run against trusted samples in a controlled lab.

Author: CyberIntel original. Syntax and schema reference ↗

YARA-002YARA · File triage

HTML or script with suspicious eval patterns

YARA 4.x · MITRE T1059

Required: Local text/HTML/JavaScript files

Show query / rule and guidance
YARA example
rule CI_Demo_Script_Eval_Atob
{
    meta:
        description = "Demo only: common JavaScript decoding patterns"
        author = "CyberIntel"
    strings:
        $a = "eval(" ascii nocase
        $b = "atob(" ascii nocase
        $c = "fromCharCode(" ascii nocase
    condition:
        filesize < 5MB and 2 of ($a, $b, $c)
}

Analyst notes: A noisy educational indicator; legitimate applications commonly use eval and atob. Correlate with origin and obfuscation rather than auto-blocking.

Author: CyberIntel original. Syntax and schema reference ↗

YARA-003YARA · File triage

Executable with embedded URL and shell strings

YARA 4.x · MITRE T1105

Required: Local file bytes

Show query / rule and guidance
YARA example
rule CI_Demo_PE_URL_Shell
{
    meta:
        description = "Demo only: PE with network and shell strings"
        author = "CyberIntel"
    strings:
        $mz = { 4D 5A }
        $url = "http://" ascii nocase
        $url2 = "https://" ascii nocase
        $shell = "cmd.exe" ascii nocase
    condition:
        filesize < 20MB and $mz at 0 and ($shell and 1 of ($url, $url2))
}

Analyst notes: Generic strings are not maliciousness proofs. Useful only as a starting point for educational triage and enrichment.

Author: CyberIntel original. Syntax and schema reference ↗

FURTHER RESEARCH

Explore trusted open repositories.

We link to curated third-party research rather than bulk-copying content. Check each project's licence, original author, update frequency and technical assumptions.