A Windows system shows a cmd.exe process spawn that appears to have been used for environment discovery. Review the process creation records to identify the exact command the adversary ran to enumerate environment variables.

KQL answer reference and model-by-model benchmark comparison

f400d1c0-1804-4ff8-b069-ef5ddd2adbf3
Question ID
17/23
Models Correct
1
Valid Answer
74%
Success Rate
Reference Answer

Human-validated correct answer for this question

set
Model Performance Comparison

See how different AI models performed on this question

ModelAnswerKQL QueryStatusAttemptsTimeCost
gemini-2.5-flash-preview-04-17
set
DeviceProcessEvents | where ActionType == "ProcessCreated" | where FileName =~ "cmd.exe" | where ProcessCommandLine contains "/c set" | project Timestamp, DeviceName, AccountName, InitiatingProcessCommandLine, ProcessCommandLine
Correct
3
47.24s
0.0237
gpt-35-turbo
No answer provided
No query generated
Incorrect
5
0.00s
0.0107
gpt-4-turbo-2024-04-09
set comspec=%windir%\System32\calc.exe & cscript %windir%\System32\manage-bde.wsf
DeviceProcessEvents | where FileName == 'cmd.exe' | where ProcessCommandLine contains 'set' or ProcessCommandLine contains 'env' or ProcessCommandLine contains 'echo' | project DeviceName, DeviceId, ProcessCommandLine, ProcessCreationTime | order by ProcessCreationTime desc
Correct
2
26.05s
0.1400
gpt-4.1
set comspec=%windir%\System32\cmd.exe
DeviceProcessEvents | where FileName =~ "cmd.exe" | where ActionType has_any ("ProcessCreated", "CreateProcess") | where ProcessCommandLine matches regex @"(?i)set(\s|$)" or ProcessCommandLine matches regex @"(?i)echo\s+%[A-Z_]+%" or ProcessCommandLine matches regex @"(?i)for.*%[A-Z_]+%" or ProcessCommandLine matches regex @"%[A-Za-z0-9_]+%" | project TimeGenerated, DeviceName, AccountName, FileName, ProcessCommandLine, InitiatingProcessAccountName, InitiatingProcessCommandLine | order by TimeGenerated desc
Correct
5
34.90s
0.0987
gpt-4.1-finetuned
"cmd.exe" /c set "SYSTEMROOT=C:\Windows\Temp" && cmd /c desktopimgdownldr.exe /lockscreenurl:https://raw.githubusercontent.com/redcanaryco/atomic-red-team/master/atomics/T1197/T1197.md /eventName:desktopimgdownldr
DeviceProcessEvents | where FileName =~ "cmd.exe" and (ProcessCommandLine has "set" )
Correct
1
14.32s
0.0269
gpt-4.1-mini
set comspec=%windir%\System32\cmd.exe
DeviceProcessEvents | where FileName == "cmd.exe" | where ProcessCommandLine has_any ("set ", "echo %", "env") | project DeviceName, ProcessCreationTime, ProcessCommandLine | order by ProcessCreationTime desc
Correct
1
4.31s
0.0025
gpt-4.1-nano
reg query HKLM\SYSTEM\CurrentControlSet\Control\TimeZoneInformation /v TimeZoneKeyName
DeviceProcessEvents | where FileName =~ "cmd.exe" | where ProcessCommandLine contains "set" or ProcessCommandLine contains "env" | project ProcessId, ProcessCreationTime, ProcessCommandLine, InitiatingProcessId, InitiatingProcessParentFileName, DeviceName, FileName
Correct
1
2.86s
0.0009
gpt-4o
"cmd.exe" /c set comspec=%windir%\System32\cmd.exe
DeviceProcessEvents | where FileName == "cmd.exe" | where tolower(ProcessCommandLine) contains "set" | project TimeGenerated, DeviceName, AccountName, AccountDomain, FileName, ProcessCommandLine
Correct
1
3.40s
0.0218
gpt-5-high
set
let envVarToken = @"(?i)%[A-Z_][A-Z0-9_]*%"; DeviceProcessEvents | where ActionType == "ProcessCreated" | where FileName =~ "cmd.exe" | extend cmd = tostring(ProcessCommandLine) | where // set listing (no assignment) (cmd matches regex @"(?i)\b(?:/c|/k)?\s*set(\s|$|\|)" and not(cmd matches regex @"(?i)\bset\s+/(?:a|p)\b") and not(cmd matches regex @"(?i)\bset\s+[A-Z_][A-Z0-9_]*\s*=")) or cmd matches regex @"(?i)\bfor\s+/f.*\('set'\)" // for /f ... in ('set') or cmd matches regex @"(?i)\bset\s*\|\s*findstr\b" // set piped to findstr or cmd matches regex strcat(@"(?i)\becho\s+", envVarToken) // echo %VAR% | extend EnumMethod = case( cmd matches regex @"(?i)\bfor\s+/f.*\('set'\)", "for /f in ('set')", cmd matches regex @"(?i)\bset\s*\|\s*findstr\b", "set | findstr", cmd matches regex @"(?i)\becho\s+%[A-Z_][A-Z0-9_]*%", "echo %VAR%", cmd matches regex @"(?i)\bset(\s|$|\|)", "set listing", "unknown") | project TimeGenerated, DeviceName, AccountDomain, AccountName, FileName, ProcessCommandLine, EnumMethod, InitiatingProcessFileName, InitiatingProcessParentFileName, InitiatingProcessCommandLine, ProcessId, InitiatingProcessId, LogonId, InitiatingProcessLogonId, MachineGroup | order by TimeGenerated desc
Correct
1
95.99s
0.0600
gpt-5-mini-high
set
( DeviceProcessEvents | extend SourceTable = "DeviceProcessEvents", CmdLine = tostring(ProcessCommandLine), EventTime = ProcessCreationTime ) | union ( DeviceEvents | extend SourceTable = "DeviceEvents", CmdLine = tostring(coalesce(ProcessCommandLine, InitiatingProcessCommandLine, tostring(AdditionalFields.CommandLine))), EventTime = coalesce(ProcessCreationTime, TimeGenerated) ) | where tolower(FileName) == "cmd.exe" or tolower(InitiatingProcessFileName) == "cmd.exe" or tolower(CmdLine) contains "cmd.exe" | where isnotempty(CmdLine) // Look for common environment-enumeration commands: 'set', 'setx', or 'echo %VAR%' | where CmdLine matches regex @"(?i)\b(set|setx)\b" or CmdLine matches regex @"(?i)echo\s+%[A-Za-z0-9_]+%" | project EventTime, SourceTable, DeviceName, AccountDomain, AccountName, FileName, ProcessId, CmdLine, InitiatingProcessFileName, InitiatingProcessCommandLine, InitiatingProcessId, ReportId | sort by EventTime desc | take 200
Correct
1
32.84s
0.0097
gpt-5-mini-low
No answer provided
No query generated
Incorrect
5
0.00s
0.0268
gpt-5-mini-medium
No answer provided
No query generated
Incorrect
5
0.00s
0.0148
gpt-5-nano-high
"cmd.exe" /c set comspec=%windir%\System32\cmd.exe
DeviceProcessEvents | where (FileName == "cmd.exe" or InitiatingProcessFileName == "cmd.exe" or ProcessCommandLine contains "cmd.exe" or InitiatingProcessCommandLine contains "cmd.exe") | extend CmdLine = coalesce(ProcessCommandLine, InitiatingProcessCommandLine) | extend CmdLineLC = tolower(CmdLine) | where CmdLineLC contains " set " or CmdLineLC contains " /c set" or CmdLineLC contains " /k set" | project TimeGenerated, DeviceName, DeviceId, CmdLine, InitiatingProcessFileName, InitiatingProcessId, InitiatingProcessCreationTime | order by TimeGenerated desc
Correct
1
41.03s
0.0026
gpt-5-nano-medium
cmd.exe /c set comspec=%windir%\System32\cmd.exe
let TimeRange = 24h; DeviceProcessEvents | where tolower(FileName) == "cmd.exe" or tolower(InitiatingProcessFileName) == "cmd.exe" or tolower(ProcessCommandLine) contains "cmd.exe" | where ProcessCreationTime >= ago(TimeRange) | where ProcessCommandLine contains "set" | project TimeCreated = ProcessCreationTime, DeviceName, DeviceId, ProcessId, InitiatingProcessId, CommandLine = ProcessCommandLine, InitiatingProcessCommandLine, InitiatingProcessFileName, InitiatingProcessAccountName, InitiatingProcessAccountDomain, InitiatingProcessCreationTime | sort by TimeCreated desc
Correct
1
35.06s
0.0036
grok-3-beta
set
DeviceProcessEvents | where FileName =~ "cmd.exe" | where ProcessCommandLine contains "set" or ProcessCommandLine contains "env" or ProcessCommandLine contains "printenv" | project DeviceName, AccountName, ProcessCreationTime, ProcessCommandLine, InitiatingProcessFileName, InitiatingProcessCommandLine | order by ProcessCreationTime desc
Correct
1
12.86s
0.0365
grok-3-mini-beta
"cmd.exe" /c set comspec=%windir%\System32\cmd.exe
DeviceProcessEvents | where FileName == 'cmd.exe' | where ProcessCommandLine contains 'set' | project TimeGenerated, DeviceName, ProcessCommandLine, AccountName | order by TimeGenerated desc | limit 100
Correct
1
19.05s
0.0023
o1-high
No answer provided
No query generated
Incorrect
5
0.00s
1.6474
o1-low
No answer provided
No query generated
Incorrect
5
0.00s
1.5992
o3-high
set
// --- cmd.exe used for environment variable discovery --------------------------------- DeviceProcessEvents | where ActionType == "ProcessCreated" // new process start | where FileName =~ "cmd.exe" // only CMD shells // -------------------------------------------------------------------- // Identify typical env-var enumeration syntaxes issued from cmd.exe // – "cmd /c set" (dump all variables) // – "set <filter>" (filtered dump) // – "wmic environment get …" (WMIC technique) // – "echo %VAR%" (echo individual variable) // -------------------------------------------------------------------- | where ProcessCommandLine matches regex @"(?i)(/c\s+)?set(\s|$|>|&)|wmic\s+environment|echo\s+%[A-Z0-9_]+%" | project TimeGenerated, DeviceName, AccountDomain, AccountName, ProcessCommandLine, FolderPath, InitiatingProcessParentFileName, InitiatingProcessCommandLine, ReportId, SHA256 | order by TimeGenerated asc
Correct
5
779.89s
0.1242
o3-mini-high
set
DeviceProcessEvents | where FileName =~ "cmd.exe" | where ProcessCommandLine has "/c set" or ProcessCommandLine has "set" | project TimeGenerated, DeviceName, FileName, ProcessCommandLine, FolderPath, InitiatingProcessCommandLine | order by TimeGenerated desc
Correct
1
20.60s
0.0173
o3-mini-low
set
DeviceProcessEvents | where FileName =~ "cmd.exe" | where ProcessCommandLine contains_cs "set" | project TimeGenerated, DeviceName, AccountName, ProcessId, ProcessCommandLine, InitiatingProcessCommandLine, FolderPath | order by TimeGenerated desc
Correct
1
44.32s
0.0204
o4-mini-high
cmd.exe /c set comspec=%windir%\System32\cmd.exe
DeviceProcessEvents | where FileName =~ "cmd.exe" | where ProcessCommandLine has "/c set" | project TimeGenerated, DeviceName, InitiatingProcessAccountName, InitiatingProcessAccountDomain, ProcessCommandLine | sort by TimeGenerated desc
Correct
1
48.11s
0.0086
o4-mini-low
No answer provided
No query generated
Incorrect
5
0.00s
0.0346