SigmaHunting query: tune before alertingAI coding agents on endpoints
AI coding agent CLI started with an approval-bypass flag
Claude Code (--dangerously-skip-permissions, --permission-mode bypassPermissions), Gemini CLI (--yolo, --approval-mode=yolo), Codex CLI (--dangerously-bypass-approvals-and-sandbox, alias --yolo) and Amazon Q (--trust-all-tools) can run every tool call without confirmation. The Nx s1ngularity malware used exactly these flags to make installed AI CLIs search the disk for secrets. Outside isolated sandboxes, these flags let prompt injection or a malicious dependency act with the user's full rights. Expect hits from developers who use bypass mode on purpose: CI runners and container shims are filtered out, and the rule is a low-severity inventory hunt rather than an alert.
- Log source
- Process creation (EDR / Sysmon for Linux / macOS Endpoint Security)
- Techniques
- ASI02 Tool Misuse and Exploitation · LLM06 Excessive Agency · AML.T0053 AI Agent Tool Invocation · ASI05 Unexpected Code Execution
- MITRE ATT&CK
- T1059Command and Scripting Interpreter
- Reviewed
- 2026-11-10
Query
title: AI Coding Agent CLI Started With Approval Bypass Flag
id: ad765f0f-d0dc-4c0c-929f-05005c389d2a
status: experimental
description: Detects AI coding agent CLIs launched with flags that auto-approve every tool call or disable the sandbox.
references:
- https://code.claude.com/docs/en/permission-modes
- https://learn.chatgpt.com/docs/developer-commands?surface=cli
- https://github.com/google-gemini/gemini-cli/blob/main/docs/reference/configuration.md
- https://www.stepsecurity.io/blog/supply-chain-security-alert-popular-nx-build-system-package-compromised-with-data-stealing-malware
author: ThreatDeck
date: 2026-11-09
modified: 2026-11-10
tags:
- attack.execution
- attack.t1059
- detection.threat-hunting
logsource:
category: process_creation
detection:
selection_flags:
CommandLine|contains:
- '--dangerously-skip-permissions'
- 'bypassPermissions'
- '--yolo'
- '--approval-mode=yolo'
- '--approval-mode yolo'
- '--trust-all-tools'
- '--dangerously-bypass-approvals-and-sandbox'
selection_tools:
CommandLine|contains:
- 'claude'
- 'gemini'
- 'codex'
- 'q chat'
filter_optional_ci_runners:
# GitHub Actions, GitLab, Buildkite and Azure Pipelines agents: bypass mode in CI is expected
ParentImage|endswith:
- '/Runner.Worker'
- '\Runner.Worker.exe'
- '/gitlab-runner'
- '\gitlab-runner.exe'
- '/buildkite-agent'
- '/Agent.Worker'
- '\Agent.Worker.exe'
filter_optional_containers:
# Devcontainers and sandboxes started through a container runtime shim
ParentImage|endswith:
- '/containerd-shim-runc-v2'
- '/docker-init'
condition: all of selection_* and not 1 of filter_optional_*
falsepositives:
- Developers who use bypass modes interactively on their workstations (expect one hit per such developer per session; treat as an inventory and policy review, not an alert)
- Agents run in disposable VMs or containers whose parent is not one of the filtered runner or shim processes
- Wrapper scripts and IDE integrations that start agents in bypass mode
level: low Expected false positives
- Every developer who runs bypass mode on a workstation will match once per session: this is an inventory hunt, not an alert. For the malware pattern use the s1ngularity query (bypass flag plus non-interactive mode plus a script-runtime parent)
- CI runners (GitHub Actions, GitLab, Buildkite, Azure Pipelines) and container shims are filtered; add your own runner or sandbox parent processes to the filters
- Wrapper scripts and IDE integrations that start agents in bypass mode
Sources
- Claude Code docs: Permission modes
- Codex CLI command reference
- Gemini CLI docs: Configuration (--yolo, mcpServers)
- StepSecurity: Nx build system package compromised with data-stealing malware
- Elastic rule: GenAI CLI started with unsafe permission bypass
Reviewed against vendor documentation, not tested in your environment. Defensive use only.