ES|QLHunting query: tune before alertingAI coding agents on endpoints
AI CLI run non-interactively with a bypass flag by a script interpreter (s1ngularity pattern)
The Nx s1ngularity postinstall script (telemetry.js) checked for claude, gemini and q with `which`, then ran `claude --dangerously-skip-permissions -p`, `gemini --yolo -p` and `q chat --trust-all-tools --no-interactive` with a prompt telling the agent to list secret files into /tmp/inventory.txt. GTIG's QUIETVAULT stealer also drives on-host AI CLIs to hunt for secrets. This query finds AI CLIs started in print/non-interactive mode with a bypass flag whose parent is a script runtime rather than an interactive shell.
- Log source
- Elastic Defend process events (logs-endpoint.events.process-*)
- Techniques
- ASI02 Tool Misuse and Exploitation · LLM03 Supply Chain · AML.T0053 AI Agent Tool Invocation · AML.T0010 Supply Chain Compromise · AML.T0055 Unsecured Credentials
- MITRE ATT&CK
- T1195.002Compromise Software Supply ChainT1552.001Credentials In Files
- Reviewed
- 2026-11-10
Query
FROM logs-endpoint.events.process-*
| WHERE @timestamp > NOW() - 30 days
AND event.type == "start"
AND (process.command_line LIKE "*--dangerously-skip-permissions*"
OR process.command_line LIKE "*bypassPermissions*"
OR process.command_line LIKE "*--yolo*"
OR process.command_line LIKE "*--trust-all-tools*"
OR process.command_line LIKE "*--dangerously-bypass-approvals-and-sandbox*")
AND (process.command_line LIKE "* -p *" OR process.command_line LIKE "*--print*"
OR process.command_line LIKE "*--no-interactive*" OR process.command_line LIKE "* exec *")
AND process.parent.name IN ("node", "node.exe", "bun", "bun.exe", "deno", "python", "python3", "sh", "dash")
| KEEP @timestamp, host.name, user.name, process.parent.name, process.parent.command_line, process.command_line
| SORT @timestamp DESC Expected false positives
- CI jobs and agent SDK wrappers (for example GitHub Actions integrations) that call the CLI from node with bypass flags
- Internal automation that scripts agents for code review or refactoring
Sources
- StepSecurity: Nx build system package compromised with data-stealing malware
- Wiz: s1ngularity — Nx supply chain attack (Aug 2025)
- Nx security advisory GHSA-cxm3-wv7p-598c
- Google GTIG: AI threat tracker — advances in threat actor usage of AI tools (Nov 2025)
Reviewed against vendor documentation, not tested in your environment. Defensive use only.