osqueryHunting query: tune before alertingAI coding agents on endpoints
s1ngularity (Nx) artifacts: AI CLI bypass runs in shell history and /tmp/inventory.txt
The malicious Nx versions (August 2025) asked installed AI CLIs to write paths of secret files to /tmp/inventory.txt (backup /tmp/inventory.txt.bak), then read and exfiltrated them. StepSecurity's remediation guidance is to look for these files and for AI CLI runs with bypass flags in shell history. Shell history only shows interactive use, so the inventory files are the stronger signal.
- Log source
- osquery on macOS / Linux developer machines (scheduled or live query)
- Techniques
- LLM03 Supply Chain · AML.T0010 Supply Chain Compromise · AML.T0055 Unsecured Credentials · ASI02 Tool Misuse and Exploitation
- MITRE ATT&CK
- T1195.002Compromise Software Supply ChainT1552.001Credentials In Files
- Reviewed
- 2026-11-10
Query
SELECT 'shell_history' AS source, u.username AS owner, sh.command AS detail, sh.history_file AS path
FROM users u CROSS JOIN shell_history sh USING (uid)
WHERE sh.command LIKE '%--dangerously-skip-permissions%'
OR sh.command LIKE '%--trust-all-tools%'
OR sh.command LIKE '%--dangerously-bypass-approvals-and-sandbox%'
OR (sh.command LIKE '%--yolo%' AND (sh.command LIKE '%gemini%' OR sh.command LIKE '%codex%'))
UNION ALL
SELECT 'inventory_file' AS source, CAST(f.uid AS TEXT) AS owner,
datetime(f.mtime, 'unixepoch') AS detail, f.path AS path
FROM file f
WHERE f.path IN ('/tmp/inventory.txt', '/tmp/inventory.txt.bak'); Expected false positives
- Developers who use bypass flags interactively (review, but not s1ngularity)
- Unrelated tools that happen to write /tmp/inventory.txt (check contents for lists of secret file paths)
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
- osquery table specs (process_open_files, processes, shell_history, file)
Reviewed against vendor documentation, not tested in your environment. Defensive use only.