threatdeck
Live 13:45 UTC ·

Detection library

YARAHunting query: tune before alertingMCP servers and agent configuration

YARA: MCP or hook config that launches a script from a hidden home directory or pipes curl into a shell

Injected MCP servers and hooks need a command to run. SANDWORM_MODE pointed a fake MCP entry at `node` plus a server.js in a randomly named hidden home folder (for example ~/.dev-utils/), and hook-based persistence runs scripts from project folders. This rule flags MCP or hook JSON configs that start node, python or a shell on a script inside a dot-directory of the home folder, or that pipe a download into a shell. Exclude well-known tool folders in your scanner if they cause noise.

Log source
File scan of AI tool config files (~/.claude.json, ~/.claude/settings.json, ~/.cursor/mcp.json, claude_desktop_config.json, .mcp.json, ~/.gemini/settings.json)
Techniques
AML.T0081 Modify AI Agent Configuration · AML.T0110 AI Agent Tool Poisoning · ASI04 Agentic Supply Chain Vulnerabilities · AML.T0142 Event Triggered Execution
MITRE ATT&CK
T1546Event Triggered ExecutionT1564.001Hidden Files and Directories
Reviewed
2026-11-10

Query

rule ThreatDeck_AI_Agent_Config_Runs_Hidden_Home_Script
{
    meta:
        description = "MCP server or hook config launching a script from a hidden home directory, or curl/wget piped to a shell"
        reference = "https://socket.dev/blog/sandworm-mode-npm-worm-ai-toolchain-poisoning"
        author = "ThreatDeck"
        date = "2026-11-09"
    strings:
        $mcp = "\"mcpServers\"" ascii
        $hooks = "\"hooks\"" ascii
        $runtime = /"command"\s*:\s*"(node|bun|deno|python3?|bash|sh)"/ ascii
        $hidden_abs = /\/(Users|home)\/[^\/"]{1,64}\/\.[a-z0-9_-]{3,32}\/[a-z0-9_.-]{1,64}\.(js|mjs|cjs|py|sh)"/ ascii nocase
        $hidden_tilde = /~\/\.[a-z0-9_-]{3,32}\/[a-z0-9_.-]{1,64}\.(js|mjs|cjs|py|sh)"/ ascii nocase
        $pipe_shell = /(curl|wget)[^"\n]{0,300}\|\s*(sh|bash|zsh)\b/ ascii
        $tool_dir1 = "/.nvm/" ascii
        $tool_dir2 = "/.npm/_npx/" ascii
        $tool_dir3 = "/.local/share/" ascii
    condition:
        filesize < 2MB and ($mcp or $hooks) and
        (($runtime and ($hidden_abs or $hidden_tilde) and not any of ($tool_dir*)) or $pipe_shell)
}

Expected false positives

  • Developers who keep their own MCP servers in a dot-directory such as ~/.mcp-servers/
  • Hooks that run helper scripts from ~/.config or similar folders

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.