Skip to content

feat(agent-audit): flag stdio MCP servers that run inline/obfuscated code - #75

Merged
sandstream merged 2 commits into
mainfrom
feat/agent-audit-stdio-mcp
Jun 24, 2026
Merged

sandstream merged 2 commits into
mainfrom
feat/agent-audit-stdio-mcp

Conversation

@sandstream

@sandstream sandstream commented Jun 23, 2026 •

Copy link
Copy Markdown
Owner

auditMcpServers only inspected url-based MCP servers (http://). But a stdio MCP server runs a local command (+args) on every agent startup — an unwatched code-execution surface. A malicious config can ship {"command":"node","args":["-e","…"]} or sh -c "curl … | sh".

Fix: auditMcpStdio flags only unambiguous abuse shapes — a malware-pattern command line (reusing the hook patterns) or an interpreter running INLINE code (node -e, python -c, sh -c, …). Deliberately does NOT flag the common, legitimate npx <pkg> server (noise control). Tests added. (Security review finding; relates to #47.)

…code

`auditMcpServers` only inspected `url`-based MCP servers (flagging http://).
But a *stdio* MCP server runs a local `command` (+args) on every agent startup
— an unwatched code-execution surface. A malicious `.mcp.json` / `.claude.json`
can ship `{"command":"node","args":["-e","…"]}` or `sh -c "curl … | sh"` and it
executes silently whenever the agent launches.

Add `auditMcpStdio`: flags only the unambiguous abuse shapes — a malware-pattern
command line (reusing the hook patterns: pipe-to-shell, /dev/tcp, base64|sh,
eval-substitution) or an interpreter running INLINE code (`node -e`, `python -c`,
`sh -c`, …). It deliberately does NOT flag the common, legitimate `npx <pkg>`
stdio server: blanket-warning every config is the noise that gets security
tooling ignored. Wired into `runAgentAudit` across all known config files.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015ERHw6bVUz39sAuoQZ1iyg
@github-actions

Copy link
Copy Markdown

✅ Docker image built successfully

  • CLI image: docker.io/sandstream/kit:test

Broadens kit's agent coverage beyond Claude/Cursor/VSCode:

- agent-audit: scan `opencode.json`/`opencode.jsonc` and `.codex/config.*` for
  plaintext secrets (format-agnostic via findSecrets), and recognize OpenCode's
  `mcp` server container in the cleartext-http and inline-code stdio checks
  (alongside `mcpServers`/`servers`).
- scan-transcripts: walk `.codex/` (project) + `~/.codex/projects/<slug>` for
  replayed-secret leaks, alongside the existing `.claude`/`.opencode`/`.cursor`/
  `.aider` dirs.

This also covers agents driven through the t3code GUI harness, since t3code runs
the underlying Codex/Claude/Cursor/OpenCode whose dirs these are. (Follow-up:
OpenCode's array-form `command` is not yet stdio-audited — missed detection, not
a false positive.)

Stacked on the stdio-MCP-audit branch.


Claude-Session: https://claude.ai/code/session_015ERHw6bVUz39sAuoQZ1iyg

Co-authored-by: Claude <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

✅ Docker image built successfully

  • CLI image: docker.io/sandstream/kit:test

@sandstream
sandstream merged commit 7668bfd into main Jun 24, 2026
15 checks passed
@sandstream
sandstream deleted the feat/agent-audit-stdio-mcp branch June 24, 2026 04:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants