Question Analysis
On a Linux system, find any process creation record where awk is used with a BEGIN rule to launch a shell. What was the exact command invoked?
ee72b37d-b8f5-46a5-a9e7-0ff50035ffd5
Question ID
17/23
Models Correct
1
Valid Answer
74%
Success Rate
Reference Answer
Human-validated correct answer for this question
awk 'BEGIN {system("/bin/sh &")}’
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 | awk 'BEGIN {system("/bin/sh &")}' | DeviceProcessEvents
| where ActionType == "ProcessCreated"
| where ProcessCommandLine contains "awk"
| where ProcessCommandLine contains "BEGIN"
| where ProcessCommandLine contains "system("
| where ProcessCommandLine contains "sh" or ProcessCommandLine contains "bash"
| project Timestamp, DeviceName, InitiatingProcessCommandLine, ProcessCommandLine | Correct | 1 | 11.19s | 0.0056 |
gpt-35-turbo | awk 'BEGIN {system("/bin/sh &")'} | DeviceProcessEvents
| where ProcessCommandLine contains "awk" and ProcessCommandLine contains "BEGIN"
| project ProcessCommandLine | Correct | 1 | 3.77s | 0.0029 |
gpt-4-turbo-2024-04-09 | awk 'BEGIN {system("/bin/sh &")}' | DeviceProcessEvents
| where ActionType == 'ProcessCreated'
| where (InitiatingProcessCommandLine contains 'awk' and InitiatingProcessCommandLine has 'BEGIN')
| where (InitiatingProcessCommandLine contains '/bin/bash' or InitiatingProcessCommandLine contains '/bin/sh')
| extend shellCommand = case(InitiatingProcessCommandLine contains '/bin/bash', '/bin/bash', InitiatingProcessCommandLine contains '/bin/sh', '/bin/sh', '')
| project DeviceName, AccountName, InitiatingProcessCommandLine, ProcessCommandLine, TimeGenerated, shellCommand
| where shellCommand != '' | Correct | 4 | 47.11s | 0.2198 |
gpt-4.1 | No answer provided | No query generated | Incorrect | 5 | 0.00s | 0.0449 |
gpt-4.1-finetuned | No answer provided | No query generated | Incorrect | 5 | 0.00s | 0.0324 |
gpt-4.1-mini | No answer provided | No query generated | Incorrect | 5 | 0.00s | 0.0062 |
gpt-4.1-nano | No answer provided | No query generated | Incorrect | 5 | 0.00s | 0.0011 |
gpt-4o | awk 'BEGIN {system("/bin/sh &")}' | DeviceProcessEvents
| where InitiatingProcessCommandLine has "awk" and InitiatingProcessCommandLine matches regex @"BEGIN.*sh"
| project TimeGenerated, DeviceName, DeviceId, InitiatingProcessCommandLine | Correct | 1 | 3.50s | 0.0149 |
gpt-5-high | awk 'BEGIN {system("/bin/sh &")}' | let linuxDevices = DeviceInfo
| where OSPlatform =~ "Linux"
| summarize by DeviceId;
DeviceProcessEvents
| where ActionType == "ProcessCreated"
| where DeviceId in (linuxDevices)
// awk variants and busybox awk
| where FileName in~ ("awk","gawk","mawk","nawk") or (FileName =~ "busybox" and ProcessCommandLine has " awk")
// BEGIN rule + shell execution indicators
| where ProcessCommandLine has "BEGIN"
and (
// system() used to launch a shell
(ProcessCommandLine has "system(" and ProcessCommandLine has_any ("/bin/sh","/bin/bash","/bin/dash","/bin/ash","/bin/ksh","/bin/zsh"," sh"," bash"," dash"," ash"," ksh"," zsh"))
// or piping to a shell command
or ProcessCommandLine has_any ("| /bin/sh","| '/bin/sh","| \"/bin/sh","| /bin/bash","| '/bin/bash","| \"/bin/bash")
)
| project TimeGenerated, DeviceName, AccountName, FileName, FolderPath, ProcessCommandLine, InitiatingProcessFileName, InitiatingProcessCommandLine, InitiatingProcessAccountName, DeviceId
| order by TimeGenerated desc | Correct | 1 | 105.09s | 0.0610 |
gpt-5-mini-high | awk 'BEGIN {system("/bin/sh &")}' | // Find Linux process creations where awk uses a BEGIN rule to launch a shell
// Search both DeviceProcessEvents and DeviceEvents (some environments populate either table)
let src = union DeviceProcessEvents, DeviceEvents;
src
| where isnotempty(ProcessCommandLine)
// Narrow to commands that call awk and include a BEGIN clause
| where tolower(ProcessCommandLine) contains "awk" and tolower(ProcessCommandLine) contains "begin"
// Look for common indicators of launching a shell from awk: system/exec, explicit /bin/sh or /bin/bash, piping to a shell, getline usage
| where (
tolower(ProcessCommandLine) contains "system"
or tolower(ProcessCommandLine) contains "exec("
or tolower(ProcessCommandLine) contains "/bin/sh"
or tolower(ProcessCommandLine) contains "/bin/bash"
or tolower(ProcessCommandLine) contains "|/bin"
or tolower(ProcessCommandLine) contains "getline"
)
// Also include entries that match a broader regex for patterns like: awk 'BEGIN{system("/bin/sh")}'
or ProcessCommandLine matches regex "(?i)\\bawk\\b.*BEGIN.*system\\s*\\("
| project TimeGenerated, DeviceName, DeviceId, AccountName, ProcessId, ProcessCreationTime, FileName, CommandLine=ProcessCommandLine, InitiatingProcessFileName, InitiatingProcessCommandLine
| distinct TimeGenerated, DeviceName, DeviceId, AccountName, ProcessId, ProcessCreationTime, FileName, CommandLine, InitiatingProcessFileName, InitiatingProcessCommandLine
| order by TimeGenerated desc
| take 100 | Correct | 2 | 26.60s | 0.0081 |
gpt-5-mini-low | awk 'BEGIN {system("/bin/sh &")}' | // Search DeviceProcessEvents and DeviceEvents for awk BEGIN blocks that launch a shell
let src = union DeviceProcessEvents, DeviceEvents;
src
| where isnotempty(ProcessCommandLine) or isnotempty(FileName)
// Focus on records that reference awk
| where ProcessCommandLine has "awk" or FileName has_cs "awk"
// Reduce noise by requiring a BEGIN block and evidence of shell invocation or functions that can spawn shells
| where ProcessCommandLine has "BEGIN"
| where ProcessCommandLine has_any ("system(", "popen(", "exec(", "/bin/sh", "/bin/bash", "/bin/dash", "/usr/bin/sh", "/usr/bin/bash", "/usr/bin/dash")
// Keep the full command and extract the BEGIN{...} block if present
| extend Command = tostring(ProcessCommandLine)
| extend AwkBeginBlock = extract("(BEGIN\\s*\\{[^}]*\\})", 1, Command)
| project TimeGenerated, DeviceName, FileName, ProcessId, ProcessCreationTime, Command, AwkBeginBlock, InitiatingProcessFileName, InitiatingProcessId, InitiatingProcessCommandLine, RawEvent = pack_all()
| order by TimeGenerated desc
| take 500 | Correct | 5 | 70.64s | 0.0197 |
gpt-5-mini-medium | awk 'BEGIN {system("/bin/sh &")}' | union DeviceProcessEvents, DeviceEvents
| extend cmd = tostring(ProcessCommandLine)
| where isnotempty(cmd)
| extend lcmd = tolower(cmd)
// Look for awk invoking a shell in a BEGIN rule: require awk, begin, system(, and a shell name
| where lcmd contains "awk" and lcmd contains "begin" and lcmd contains "system(" and (lcmd contains "sh" or lcmd contains "bash" or lcmd contains "/bin/sh")
| project TimeGenerated, DeviceName, FileName, ProcessId, ProcessCreationTime, ProcessCommandLine = cmd, InitiatingProcessFileName, InitiatingProcessCommandLine, InitiatingProcessId, ReportId, TenantId
| order by TimeGenerated desc
| take 100 | Correct | 2 | 333.48s | 0.0692 |
gpt-5-nano-high | No answer provided | No query generated | Incorrect | 5 | 0.00s | 0.0076 |
gpt-5-nano-medium | /bin/sh & | DeviceProcessEvents
| where (InitiatingProcessFileName endswith "awk" or InitiatingProcessCommandLine contains "awk")
| where InitiatingProcessCommandLine contains "BEGIN"
| where InitiatingProcessCommandLine contains "system("
| extend ShellArg = extract(@"system\(\s*([^\)]+)\s*\)", 1, InitiatingProcessCommandLine)
| where isnotempty(ShellArg)
| where ShellArg contains "/bin/sh" or ShellArg contains "/bin/bash"
| join kind=inner (
DeviceInfo
| where OSPlatform contains "Linux" or OSDistribution contains "Linux"
| project DeviceId, DeviceName, OSPlatform, OSDistribution
) on DeviceId
| project TimeGenerated, DeviceName, InitiatingProcessFileName, InitiatingProcessCommandLine, ShellArg, ProcessId, InitiatingProcessId, OSPlatform, OSDistribution
| sort by TimeGenerated desc | Incorrect | 2 | 81.20s | 0.0049 |
grok-3-beta | awk 'BEGIN {system("/bin/sh &")}' | DeviceProcessEvents
| where FileName contains 'awk'
| where ProcessCommandLine has 'BEGIN' and ProcessCommandLine has_any ('sh', 'bash', 'shell')
| project DeviceName, ProcessCreationTime, ProcessCommandLine, FileName, FolderPath, InitiatingProcessFileName, InitiatingProcessCommandLine
| order by ProcessCreationTime desc | Correct | 1 | 10.02s | 0.0215 |
grok-3-mini-beta | awk 'BEGIN {system("/bin/sh &")}' | DeviceProcessEvents
| join kind=inner (DeviceInfo | where OSPlatform == "Linux" | project DeviceId, OSPlatform) on DeviceId
| where ProcessCommandLine contains "awk" and ProcessCommandLine contains "BEGIN" and (ProcessCommandLine contains "system" and ProcessCommandLine contains "/bin/sh")
| project TimeGenerated, DeviceName, ProcessCommandLine
| order by TimeGenerated desc | Correct | 1 | 16.10s | 0.0018 |
o1-high | awk 'BEGIN {system("/bin/sh &")}' | DeviceProcessEvents
| join kind=inner (
DeviceInfo
| where OSPlatform =~ "Linux"
) on DeviceId
| where ActionType == "ProcessCreated"
| where FileName endswith "awk" // or FileName has "awk" if you suspect a path
| where ProcessCommandLine has_all ("BEGIN", "system(")
| project TimeGenerated, DeviceName, ProcessCommandLine
| order by TimeGenerated desc | Correct | 4 | 112.13s | 0.6877 |
o1-low | awk 'BEGIN {system("/bin/sh &")}' | DeviceProcessEvents
| where ActionType == "ProcessCreated"
| join kind=innerunique (
DeviceInfo
| where OSPlatform == "Linux"
) on DeviceId
| where FileName == "awk" or ProcessCommandLine has "awk"
| where ProcessCommandLine has "BEGIN"
| where ProcessCommandLine has_any ("sh", "bash")
| project TimeGenerated, DeviceName, AccountName, ProcessCommandLine
| order by TimeGenerated desc | Correct | 1 | 37.12s | 0.2594 |
o3-high | awk 'BEGIN {system("/bin/sh &")}' | // Suspicious use of awk BEGIN rule to spawn a shell on Linux
let shell_rx = @"BEGIN[^{]*\{[^}]*((/bin/)?(sh|bash|zsh|ksh)|\b(sh|bash|zsh|ksh)\b)"; // case-insensitive by default
DeviceProcessEvents
| where FileName =~ "awk" or ProcessCommandLine contains "awk "
| where ProcessCommandLine contains "BEGIN" // quick pre-filter
| join kind=inner (
DeviceInfo
| where OSPlatform =~ "Linux"
| project DeviceId
) on DeviceId
| where ProcessCommandLine matches regex shell_rx
| project TimeGenerated,
DeviceName,
AccountName,
AccountDomain,
FileName,
ProcessCommandLine,
InitiatingProcessCommandLine,
InitiatingProcessParentFileName,
InitiatingProcessParentId,
DeviceId
| order by TimeGenerated desc | Correct | 2 | 53.72s | 0.0430 |
o3-mini-high | awk 'BEGIN {system("/bin/sh &")}' | DeviceProcessEvents
| where ProcessCommandLine contains "awk" and ProcessCommandLine contains "BEGIN"
| where ProcessCommandLine contains "/bin/sh" or ProcessCommandLine contains "sh -"
| project TimeGenerated, DeviceName, ProcessCommandLine, ProcessId
| order by TimeGenerated desc | Correct | 1 | 22.84s | 0.0114 |
o3-mini-low | awk 'BEGIN {system("/bin/sh &")}' | DeviceProcessEvents
| where ProcessCommandLine has "awk"
| where ProcessCommandLine has "BEGIN"
| where ProcessCommandLine has_any ("/bin/sh", "/bin/bash")
| project TimeGenerated, DeviceName, ProcessCommandLine | Correct | 2 | 24.88s | 0.0180 |
o4-mini-high | awk 'BEGIN {system("/bin/sh &")}' | let linuxDevices = DeviceInfo
| where OSPlatform == "Linux"
| distinct DeviceId;
DeviceProcessEvents
| where DeviceId in (linuxDevices)
// Filter to awk executions
| where FileName =~ "awk" or FileName endswith "awk"
// Look for BEGIN block invoking a shell via system(...)
| where ProcessCommandLine matches regex @"\bawk\b.*\bBEGIN\s*\{[^}]*system\s*\("
| project TimeGenerated, DeviceName, InitiatingProcessAccountName, ProcessCommandLine
| sort by TimeGenerated desc | Correct | 3 | 84.57s | 0.0258 |
o4-mini-low | awk 'BEGIN {system("/bin/sh &")}' | let linuxDevices = DeviceInfo
| where OSPlatform == "Linux"
| distinct DeviceId;
DeviceProcessEvents
| where DeviceId in (linuxDevices)
| where tolower(ProcessCommandLine) has "awk"
// look for BEGIN rule and system call launching a shell
| where tolower(ProcessCommandLine) has "begin" and tolower(ProcessCommandLine) has "system(\"/bin/sh"
| project TimeGenerated, DeviceName, ProcessId, FileName, ProcessCommandLine
| sort by TimeGenerated desc | Correct | 1 | 38.81s | 0.0102 |