hivemind
- Type
- MCP server
- Scanned
- Nov 17, 2026
- Version
- 438796a1f243
- Files read
- 756
Hivemind is a cloud memory plugin that records your AI coding sessions, summarizes codebases, and syncs reusable skills and notes across tools like Claude Code, Cursor, and Codex. The biggest risk is that it uploads your session history to a shared workspace and runs background AI agents and shell hooks with safety prompts and sandboxing turned off, allowing untrusted text in code, logs, or shared memories to run arbitrary commands on your computer.
What it can reach
- Files
- Reads repository source code and local AI chat logs, and reads or modifies settings, hooks, caches, and skill folders in ~/.deeplake, ~/.hivemind, /tmp, .git/hooks, and installed coding assistants (such as Claude, Cursor, Codex, Hermes, OpenClaw, and Pi).
- Network
- Uploads captured prompts, AI replies, tool outputs, code maps, documentation, and skills to api.deeplake.ai (or a custom server), downloads packages, updates, and AI models from npm, GitHub, ClawHub, and Hugging Face, and can serve a local dashboard on 127.0.0.1:8123.
- Shell commands
- Runs git, npm, node, and installed coding-agent CLIs (claude, codex, cursor-agent, hermes, and pi), intercepts shell commands targeting ~/.deeplake/memory/, installs git and agent hooks, and pre-approves terminal access in bundled skills.
- Secrets
- Stores and reads long-lived DeepLake API tokens in ~/.deeplake/credentials.json or HIVEMIND_TOKEN, writes tokens into temporary worker files, passes environment variables to child agent processes, and scans captured chats to mask common credentials before upload.
- Browser
- Opens your default web browser for account sign-in and to view the local HTML dashboard.
- System
- Runs detached background workers and a local background service in /tmp for embeddings, and checks /proc on Linux to detect running agent processes.
Findings
-
HighShell command injection via fixed heredoc delimiter in Cursor preToolUse hook
src/hooks/cursor/pre-tool-use.ts:136
When Cursor's Shell tool runs a command touching ~/.deeplake/memory/, the preToolUse hook replaces the command with cat <<'__HIVEMIND_RESULT__' wrapping the raw multi-line search result, doc body, or graph query output, and returns permission: "allow" so Cursor executes the replacement in the host shell without asking the user. If any line in the returned memory/doc content or echoed graph query pattern equals __HIVEMIND_RESULT__, the heredoc closes early and every subsequent line runs as an arbitrary bash command on the user's machine.
Fix: Replace the heredoc wrapper on all three return paths (graphBody, docsBody, and result) with single-quote-escaped printf (safeEchoCommand from src/hooks/pre-tool-use.ts), and validate commands with isSafe() before returning permission: "allow".
-
HighBackground workers run host agent CLIs with sandbox and approval bypass flags on untrusted transcripts
src/skillify/gate-runner.ts:175
Detached background workers automatically feed captured session events—which include untrusted web pages, pull requests, issue text, and teammate transcripts—into the host agent's CLI to generate wiki summaries, mine skills, and score SkillOpt failures. While Claude Code's wiki and skillify workers restrict tools to Read/Write on a temp folder, src/skillify/gate-runner.ts and src/hooks/codex/wiki-worker.ts invoke codex exec with --dangerously-bypass-approvals-and-sandbox, src/hooks/cursor/wiki-worker.ts and src/skillify/agent-model.ts invoke cursor-agent with --force, src/hooks/hermes/wiki-worker.ts and src/skillify/agent-model.ts invoke hermes with --yolo, and src/skillify/advisor.ts invokes claude with --permission-mode bypassPermissions. Prompt injection inside captured content can therefore trigger unsandboxed, unapproved shell commands in hidden background processes.
Fix: Run background LLM calls with tools disabled (such as --tools "" or read-only sandboxing) and capture structured stdout directly in Node instead of granting blanket tool and sandbox bypasses.
-
MediumPersonal-scope skills are uploaded to the shared table and auto-installed on all teammates' machines
Skillify defaults to scope = "me" and documents hivemind skillify scope <me|team> as controlling the sharing scope for newly mined skills. However, skillify-worker.ts still inserts scope = "me" rows into the shared DeepLake skills table, and buildPullSql/runPull select the scope column without ever filtering on it. Because every agent's SessionStart hook automatically runs autoPullSkills() for all users into global skill folders (~/.claude/skills/, ~/.agents/skills/, ~/.hermes/skills/, ~/.pi/agent/skills/), private "me" skills—as well as unreviewed SkillOpt auto-published skill edits—propagate to every workspace member's agents automatically.
Fix: Avoid uploading scope = "me" skills to the shared org table (or restrict buildPullSql/runPull so non-author pulls only install rows with scope = 'team'), and gate SkillOpt org-wide skill overwrites behind explicit review or opt-in.
-
MediumUnescaped double-quoted echo on missing virtual paths leaks host environment variables
Although other Bash rewrites in src/hooks/pre-tool-use.ts use safeEchoCommand (single-quoted printf) to prevent shell expansion, the virtual-path-not-found branch builds echo ${JSON.stringify(notFound)} and returns permissionDecision: "allow". Because isSafe() blocks $(...) and backticks but permits $VAR and ${VAR}, a prompt-injected agent calling Bash with cat ~/.deeplake/memory/$ANTHROPIC_API_KEY is auto-approved to run a double-quoted echo in the real host shell, expanding secret environment variables into tool output.
Fix: Use safeEchoCommand(notFound) instead of echo ${JSON.stringify(notFound)} when constructing the allow decision.
-
MediumWorld-readable temporary worker directories expose DeepLake API token and session transcripts
src/hooks/spawn-wiki-worker.ts:104
Unlike spawnSkillifyWorker (which sets mode 0o700 on its temp directory and 0o600 on config.json), all five wiki-worker spawners (src/hooks/spawn-wiki-worker.ts, codex, cursor, hermes, and harnesses/pi/extension-source/hivemind.ts) create /tmp/deeplake-wiki-<sessionId>-<ts> and write config.json—containing the user's 365-day org-scoped DeepLake API token—and session.jsonl with default permissions (0755 directory, 0644 files under standard umask). On shared multi-user hosts, another local user can read the token and transcript while the worker runs.
Fix: Create the temporary directory with mode 0o700 (or fs.mkdtempSync under a 0o700 ~/.deeplake directory) and write config.json and session.jsonl with mode 0o600 across all wiki-worker spawners.
-
MediumUnsanitized orgName in committed .hivemind file enables hidden SessionStart prompt injection
src/hooks/session-start.ts:347
When starting a session inside a cloned repository, the SessionStart hooks (Claude Code, Cursor, Hermes, and pi) read .hivemind and interpolate orgName and workspaceId directly into additionalContext without stripping newlines or capping length. If a malicious repo commits a .hivemind file that sets only orgName (leaving orgId and workspaceId unchanged so no 'routed by' notice is shown), multi-line text in orgName is injected verbatim into the trusted SessionStart context block where === HIVEMIND RULES === team instructions appear.
Fix: Apply sanitizeForContext() (stripping newlines/control characters and capping length) to effOrg and effWs in every SessionStart hook, and ignore or validate orgName against the server's organization list.
-
MediumUnencoded workspaceId allows URL path traversal on authenticated DeepLake API requests
When a cloned repository's .hivemind file specifies a workspaceId that does not match a known alias, resolveWorkspaceRef returns the raw string and DeeplakeApi interpolates this.workspaceId directly into ${this.apiUrl}/workspaces/${this.workspaceId}/tables/query and /tables without encodeURIComponent() or identifier validation. Opening an agent in a repo whose .hivemind sets workspaceId to segments containing ../ and # causes automatic SessionStart and capture hooks to send authenticated GET and POST requests carrying the user's Bearer token to arbitrary endpoints on api.deeplake.ai.
Fix: URL-encode this.workspaceId with encodeURIComponent() in all DeeplakeApi URLs and reject workspaceId values containing slashes, dots, or query/fragment characters.
-
MediumMissing secret redaction in pi extension capture and Codex Stop hook capture
harnesses/pi/extension-source/hivemind.ts:1139
Other agent capture hooks run redactSecrets() over serialized events before embedding and uploading them to the team-shared sessions table, but writeSessionRow in harnesses/pi/extension-source/hivemind.ts (covering all pi user prompts, tool inputs/outputs, and replies) and src/hooks/codex/stop.ts (covering Codex's final assistant message) serialize entry with plain JSON.stringify() and upload it unredacted. Any API keys, tokens, or passwords appearing in pi sessions or Codex assistant replies are exposed to everyone in the DeepLake workspace.
Fix: Apply redactSecrets() to the serialized JSON line in harnesses/pi/extension-source/hivemind.ts and src/hooks/codex/stop.ts before computing embeddings and inserting into the sessions table.
-
MediumHermes installer globally disables hook consent prompts via hooks_auto_accept
hivemind hermes install unconditionally sets hooks_auto_accept: true in ~/.hermes/config.yaml without warning in the documentation. As noted in uninstallHermes(), that global setting causes Hermes to silently auto-accept any shell hooks without prompting the user for consent, weakening Hermes's built-in hook review boundary for unrelated hooks while Hivemind is installed.
Fix: Do not enable hooks_auto_accept globally without explicit user consent; let Hermes prompt once to trust Hivemind's hooks (matching the Codex installer flow) or prompt the user before setting the flag.
-
MediumAutomatic runtime npm install and native build of unpinned packages at SessionStart
On Claude Code and Codex SessionStart (even before login), session-start-setup.ts automatically spawns graph-deps-worker.js, which runs npm install --no-package-lock on caret-range tree-sitter packages into ~/.hivemind/embed-deps and then executes npm rebuild to compile native addons; similarly, autoupdate.ts runs npm install -g @deeplake/hivemind@<latest> detached on every session start by default. Fetching and compiling unpinned npm packages in the background at runtime without lockfile hash verification exposes users to upstream registry compromises.
Fix: Pin exact dependency versions and integrity hashes (or bundle preverified lockfiles) for runtime parser installations, and make background package installation and global self-updates opt-in.
-
MediumDocumentation generator invokes host coding agents with approval and sandbox bypasses
When generating or updating repository documentation (via hivemind docs wiki, generate, refresh, or sync, or automatically in the background on SessionStart and post-commit when docs auto on is enabled), Hivemind embeds raw repository source files, git diffs, and shared wiki pages directly into prompts passed to runHostPrompt. Although this step only needs plain markdown text on stdout, refresh-llm.ts launches Claude Code with --permission-mode bypassPermissions (without disabling tools), Codex with --dangerously-bypass-approvals-and-sandbox, and Cursor Agent with --force, while setting HIVEMIND_CAPTURE=false. Prompt injection hidden in a source comment, string literal, pulled commit diff, or shared doc row can trick the background agent into executing arbitrary unsandboxed shell commands or modifying files without user approval or session logging.
Fix: Disable tool execution and preserve sandboxing when invoking host CLIs for documentation text generation: pass --tools "" and --strict-mcp-config instead of --permission-mode bypassPermissions for claude, use --sandbox read-only instead of --dangerously-bypass-approvals-and-sandbox for codex, and omit --force for cursor-agent.
-
LowMissing skill-name path validation when writing merged skills in skillify dedupe
src/skillify/dedupe-authors.ts:107
Unlike pull.ts and skill-writer.ts (which enforce assertValidSkillName()), rowToRemoteSkill() and readLocal() in src/skillify/dedupe-authors.ts accept arbitrary name values from remote skills rows and local SKILL.md frontmatter. If matching entries contain ../ traversal segments in name, running hivemind skillify dedupe writes SKILL.md outside the skills root directory.
Fix: Validate skill names with assertValidSkillName() in rowToRemoteSkill(), readLocal(), and writeSlot() before joining filesystem paths.
-
LowPrivate unpushed-branch documentation store is created without owner-only permissions
When refreshing wiki pages on an unpushed git branch, Hivemind withholds generated documentation from the cloud table and stores it locally under ~/.hivemind/docs-private/ so unpushed code descriptions stay private to the machine owner. However, unlike ~/.deeplake/credentials.json and the recall cache, writeMap creates the directory and JSON files without explicit 0700 or 0600 modes, leaving private branch docs readable by other local OS users under a standard 0022 umask.
Fix: Pass { recursive: true, mode: 0o700 } to mkdirSync when creating the private store directory and { mode: 0o600 } to writeFileSync when writing temporary store files.
