threatdeck
Live 13:45 UTC ·

Detection library

KQLHunting query: tune before alertingAI coding agents on endpoints

Shell startup file modified by a script runtime or by an AI agent's child process

s1ngularity's telemetry.js appended `sudo shutdown -h 0` to ~/.bashrc and ~/.zshrc, and SpecterOps showed an agent-reachable `sed 'w ~/.zshenv'` primitive that plants commands run by every new zsh. Editors and installers rarely write these files; node, python, sed or a process spawned by an AI agent writing them is unusual.

Log source
Microsoft Defender for Endpoint: DeviceFileEvents (macOS / Linux)
Techniques
AML.T0142 Event Triggered Execution · ASI05 Unexpected Code Execution · LLM03 Supply Chain · AML.T0010 Supply Chain Compromise
MITRE ATT&CK
T1546.004Unix Shell Configuration Modification
Reviewed
2026-11-10

Query

let ai_agents = dynamic(["claude", "claude.exe", "codex", "codex.exe", "cursor-agent", "Cursor", "Cursor.exe", "Cursor Helper (Plugin)", "gemini", "copilot", "Windsurf", "Windsurf.exe", "q"]);
let startup_files = dynamic([".zshrc", ".zshenv", ".zprofile", ".bashrc", ".bash_profile", ".profile"]);
let script_writers = dynamic(["node", "bun", "deno", "python", "python3", "perl", "ruby", "sed", "tee"]);
DeviceFileEvents
| where Timestamp > ago(14d)
| where ActionType in ("FileCreated", "FileModified", "FileRenamed")
| where FileName in (startup_files)
| where InitiatingProcessFileName in~ (script_writers) or InitiatingProcessParentFileName in~ (ai_agents)
| project Timestamp, DeviceName, FolderPath, ActionType, InitiatingProcessFileName,
          InitiatingProcessCommandLine, InitiatingProcessParentFileName, InitiatingProcessAccountName
| order by Timestamp desc

Expected false positives

  • Version managers and installers (nvm, pyenv, conda, rustup) that add PATH lines via scripts
  • Dotfile managers written in Python or Node

Sources

Reviewed against vendor documentation, not tested in your environment. Defensive use only.

Following

Follow the vendors, products, AI tools, techniques and actors you care about. Matching stories, CVEs and exploited bugs are marked, a Following tab appears in the feed, and returning visits show what changed. Saved only in this browser.

Presets

Get updates

A personal RSS feed of new stories on everything you follow. Paste it into any feed reader, Slack or Teams RSS app.