Question Analysis
On a Windows endpoint, look for evidence of a base64-encoded PowerShell payload execution. Which executable launched the encoded command?
a50d5a97-2531-499e-a1de-5544c74432c6
Question ID
16/23
Models Correct
1
Valid Answer
70%
Success Rate
Reference Answer
Human-validated correct answer for this question
powershell.exe
Model Performance Comparison
See how different AI models performed on this question
Model | Answer | KQL Query | Status | Attempts | Time | Cost |
---|---|---|---|---|---|---|
gemini-2.5-flash-preview-04-17 | No answer provided | No query generated | Incorrect | 5 | 0.00s | 0.0159 |
gpt-35-turbo | powershell.exe | DeviceProcessEvents
| where ProcessCommandLine contains 'powershell' and ProcessCommandLine contains ' -encodedcommand'
| project InitiatingProcessFileName | Correct | 1 | 2.97s | 0.0023 |
gpt-4-turbo-2024-04-09 | powershell.exe | DeviceProcessEvents
| where ProcessCommandLine has_any ('-EncodedCommand', 'eN') and InitiatingProcessFileName =~ 'powershell.exe'
| project TimeGenerated, DeviceName, InitiatingProcessFileName, InitiatingProcessCommandLine, InitiatingProcessParentFileName, InitiatingProcessParentId, InitiatingProcessId
| distinct TimeGenerated, DeviceName, InitiatingProcessFileName, InitiatingProcessCommandLine, InitiatingProcessParentFileName, InitiatingProcessParentId, InitiatingProcessId | Correct | 1 | 10.50s | 0.0532 |
gpt-4.1 | powershell.exe | DeviceProcessEvents
| where FileName =~ "powershell.exe" or FileName =~ "pwsh.exe"
| where ProcessCommandLine has_any ("-enc ", "-encodedcommand ")
| project TimeGenerated, DeviceName, FileName, FolderPath, ProcessCommandLine, InitiatingProcessFileName, InitiatingProcessCommandLine, AccountName, AccountDomain
| order by TimeGenerated desc | Correct | 1 | 5.75s | 0.0113 |
gpt-4.1-finetuned | powershell.exe | DeviceProcessEvents
| where ProcessCommandLine matches regex ".* -e.*([A-Za-z0-9+/=]){10,}.*"
| summarize count() by InitiatingProcessFileName, bin(Timestamp, 5m)
| sort by count_ desc | Correct | 2 | 13.26s | 0.0065 |
gpt-4.1-mini | powershell.exe | DeviceProcessEvents
| where FileName == "powershell.exe" or FileName == "pwsh.exe"
| where ProcessCommandLine has "-EncodedCommand" or ProcessCommandLine has "-e "
| project TimeGenerated, DeviceName, FileName, ProcessId, ProcessCommandLine, InitiatingProcessFileName, InitiatingProcessCommandLine
| order by TimeGenerated desc | Correct | 1 | 4.14s | 0.0023 |
gpt-4.1-nano | No answer provided | No query generated | Incorrect | 5 | 0.00s | 0.0016 |
gpt-4o | No answer provided | No query generated | Incorrect | 5 | 0.00s | 0.0526 |
gpt-5-high | powershell.exe | let EncodedCmdRegex = @"(?i)\s-?(?:e|enc|encodedcommand)\b";
let EncodedArgRegex = @"(?i)-(?:e|enc|encodedcommand)\s+['\""]?([A-Za-z0-9+/=]{20,})";
let EncPSEvents =
DeviceProcessEvents
| where FileName matches regex @"(?i)^(?:powershell(?:\.exe)?|pwsh(?:\.exe)?|powershell_ise(?:\.exe)?)$"
| where ProcessCommandLine matches regex EncodedCmdRegex
or tolower(ProcessCommandLine) has "[convert]::frombase64string("
or tolower(ProcessCommandLine) has "frombase64string("
| extend EncodedArg = extract(EncodedArgRegex, 1, ProcessCommandLine);
EncPSEvents
| summarize executions=count(), firstSeen=min(TimeGenerated), lastSeen=max(TimeGenerated) by DeviceName, InitiatingProcessFileName, InitiatingProcessFolderPath, InitiatingProcessSHA256
| order by lastSeen desc | Correct | 1 | 85.79s | 0.0533 |
gpt-5-mini-high | No answer provided | No query generated | Incorrect | 5 | 0.00s | 0.0144 |
gpt-5-mini-low | powershell.exe | let ps_regex = @"(?i)(?:-encodedcommand|-e)\s+([A-Za-z0-9+/=]+)"; // looks for -EncodedCommand or -e with base64
let dotnet_regex = @"(?i)(?:Convert::FromBase64String|Convert\.FromBase64String|FromBase64String|System\.Text\.Encoding|Text\.Encoding)";
DeviceProcessEvents
| where Timestamp between (startofday(ago(7d)) .. now())
| where FileName has_any ('powershell.exe','pwsh.exe','powershell_ise.exe') or ProcessCommandLine has_any('-encodedcommand','-e','FromBase64String','Convert.FromBase64String','FromBase64String')
| extend Cmd = tostring(ProcessCommandLine), InitiatingCmd = tostring(InitiatingProcessCommandLine)
| where Cmd has '-EncodedCommand' or Cmd has ' -e ' or Cmd has 'FromBase64String' or InitiatingCmd has '-EncodedCommand' or InitiatingCmd has '-e' or InitiatingCmd has 'FromBase64String'
| extend EncodedMatch = extract(ps_regex, 1, Cmd), EncodedInInitiator = extract(ps_regex, 1, InitiatingCmd)
| extend HasDotNetDecode = iff(Cmd matches regex dotnet_regex or InitiatingCmd matches regex dotnet_regex, 1, 0)
| project Timestamp, DeviceName, DeviceId, AccountName, AccountDomain, FileName, ProcessId, ProcessCreationTime, ProcessCommandLine=Cmd, InitiatingProcessFileName, InitiatingProcessId, InitiatingProcessCreationTime, InitiatingProcessCommandLine=InitiatingCmd, EncodedMatch, EncodedInInitiator, HasDotNetDecode
| where isnotempty(EncodedMatch) or isnotempty(EncodedInInitiator) or HasDotNetDecode==1
| summarize FirstSeen = min(Timestamp), LastSeen = max(Timestamp), count() by DeviceName, DeviceId, InitiatingProcessFileName, InitiatingProcessId, InitiatingProcessCommandLine, FileName, ProcessId, ProcessCommandLine, AccountName
| order by FirstSeen desc
| Correct | 1 | 33.85s | 0.0067 |
gpt-5-mini-medium | powershell.exe | union DeviceProcessEvents, DeviceEvents
| where isnotempty(ProcessCommandLine)
| where tolower(ProcessCommandLine) has_any ("powershell","pwsh")
// Match common encoded-argument forms and a sufficiently long Base64-like token to reduce false positives
| where ProcessCommandLine matches regex @"(?i)(?:-enc(?:odedcommand)?|-e)\s+([A-Za-z0-9+/=]{40,})"
| extend EncodedPayload = extract(@"(?i)(?:-enc(?:odedcommand)?|-e)\s+([A-Za-z0-9+/=]{40,})", 1, ProcessCommandLine)
| project TimeGenerated, DeviceName, FileName, ProcessId, ProcessCommandLine, InitiatingProcessFileName, InitiatingProcessId, InitiatingProcessCommandLine, InitiatingProcessAccountName, EncodedPayload
| summarize Count = count(), SampleCommands = make_list(ProcessCommandLine, 5), EncodedSamples = make_list(EncodedPayload, 5), Devices = make_list(DeviceName, 5) by InitiatingProcessFileName, InitiatingProcessId, InitiatingProcessCommandLine, InitiatingProcessAccountName
| order by Count desc | Correct | 1 | 31.18s | 0.0065 |
gpt-5-nano-high | powershell.exe | DeviceProcessEvents
| where FileName in ("powershell.exe","pwsh.exe")
| where ProcessCommandLine contains "-EncodedCommand"
| extend LauncherExecutable = InitiatingProcessFileName
| project TimeGenerated, DeviceName, LauncherExecutable, LauncherCommandLine = InitiatingProcessCommandLine, EncodedProcess = FileName, EncodedCommandLine = ProcessCommandLine
| summarize Launches = count() by LauncherExecutable, LauncherCommandLine, EncodedProcess, EncodedCommandLine
| order by Launches desc | Correct | 1 | 34.53s | 0.0021 |
gpt-5-nano-medium | No answer provided | No query generated | Incorrect | 5 | 0.00s | 0.0078 |
grok-3-beta | powershell.exe | DeviceProcessEvents
| where FileName contains "powershell.exe"
| where ProcessCommandLine contains "encodedcommand" or ProcessCommandLine matches regex @"[A-Za-z0-9+/]{50,}"
| summarize Count = count() by InitiatingProcessFileName, DeviceName
| order by Count desc | Correct | 1 | 10.53s | 0.0205 |
grok-3-mini-beta | powershell.exe | DeviceProcessEvents
| where FileName startswith 'powershell'
| where ProcessCommandLine contains '-EncodedCommand'
| project Timestamp, DeviceName, ProcessCommandLine, InitiatingProcessFileName | Correct | 1 | 15.20s | 0.0016 |
o1-high | powershell.exe | DeviceProcessEvents
| where Timestamp >= ago(7d)
| where FileName in~ ("powershell.exe", "pwsh.exe", "powershell_ise.exe")
| where ProcessCommandLine has_any ("-enc ", "-EncodedCommand")
| project TimeGenerated, DeviceName, FileName, ProcessCommandLine, InitiatingProcessFileName, InitiatingProcessCommandLine
| order by TimeGenerated desc | Correct | 1 | 23.01s | 0.1918 |
o1-low | powershell.exe | DeviceProcessEvents
| where FileName in~ ("powershell.exe", "powershell_ise.exe", "pwsh.exe")
| where ProcessCommandLine has_any ("-enc", "-encodedCommand")
| project TimeGenerated, DeviceName, FileName, ProcessCommandLine, InitiatingProcessFileName, InitiatingProcessCommandLine | Correct | 1 | 25.49s | 0.2137 |
o3-high | powershell.exe | DeviceProcessEvents
// === Time range is supplied by the calling UI / hunting blade ===
| where FileName in~ ("powershell.exe", "pwsh.exe", "powershell_ise.exe")
// Look for typical switches that precede a Base-64 payload (case-insensitive)
| where tolower(ProcessCommandLine) has_any (" -enc", " -e ", " -encodedcommand", " -ec")
// Pull out the first plausible Base-64 string that follows the switch
| extend EncodedPayload = extract(@"(?i)(?:-e|-enc|-encodedcommand|/e|/enc|/encodedcommand)\s+([A-Za-z0-9+/]{20,}={0,2})", 1, ProcessCommandLine)
| where isnotempty(EncodedPayload)
// === ANSWER THE QUESTION ===
// Which executable launched the encoded-command PowerShell?
| summarize EncodedExecCount = count(), ExampleDevices = make_set(DeviceName, 5)
by LaunchingExecutable = InitiatingProcessFileName,
LaunchingExecutablePath = InitiatingProcessFolderPath
| sort by EncodedExecCount desc
// ===== Raw event details (uncomment if needed) =====
// | project TimeGenerated, DeviceName, FileName, ProcessCommandLine, EncodedPayload,
// LaunchingExecutable = InitiatingProcessFileName,
// LaunchingExecutablePath = InitiatingProcessFolderPath,
// LaunchingProcessCommandLine = InitiatingProcessCommandLine,
// InitiatingProcessCreationTime | Correct | 5 | 178.19s | 0.0930 |
o3-mini-high | dash | DeviceProcessEvents
| where tolower(InitiatingProcessCommandLine) contains "-encodedcommand" or tolower(InitiatingProcessCommandLine) contains "-enc"
| summarize Count = count() by InitiatingProcessFileName
| order by Count desc | Incorrect | 1 | 14.57s | 0.0105 |
o3-mini-low | powershell.exe | DeviceProcessEvents
| where ProcessCommandLine contains "-EncodedCommand"
| project TimeGenerated, DeviceName, FileName, ProcessCommandLine, InitiatingProcessFileName, InitiatingProcessCommandLine
| extend ParentExecutable = coalesce(InitiatingProcessFileName, "N/A")
| order by TimeGenerated desc | Correct | 1 | 32.82s | 0.0110 |
o4-mini-high | powershell.exe | DeviceProcessEvents
| where FileName in~ ("powershell.exe", "pwsh.exe")
// Match –EncodedCommand or –enc followed by a Base64‐style string
| where tolower(ProcessCommandLine) matches regex @"-enc(odedcommand)?\s+[A-Za-z0-9+/=]{20,}"
| project Timestamp, DeviceName, ProcessCommandLine, InitiatingProcessFileName, InitiatingProcessCommandLine
| order by Timestamp desc | Correct | 1 | 25.97s | 0.0084 |
o4-mini-low | No answer provided | No query generated | Incorrect | 5 | 0.00s | 0.0313 |