MCP Shipyard
← Rules catalog

Tool metadata pointing at ~/.ssh, .env or MCP config files, or asking for secrets

Descriptions that point the model at credential files or tell it to collect API keys and tokens are a credential-theft pattern and fail review.

majorsecurity.credential-file-referenceClaude, ChatGPT

Remove references to credential files and any instruction to collect secrets from tool names, descriptions and parameter text. The rule security.credential-file-reference is a major finding for Claude and ChatGPT.

What you see

  • A scan reports Reference to <kind> for one of: SSH key paths and id_rsa-style names, cloud credential files (.aws/credentials, .kube/config, .docker/config.json and similar), credential stores (.netrc, .npmrc, .pgpass, browser cookie databases, shell history), system password files (/etc/passwd, /etc/shadow), MCP or agent config files (mcp.json, claude_desktop_config, and the config directories of other coding agents such as Grok Build, formerly Cursor), and .env files.
  • Or Instruction to collect secrets, when a verb such as read, collect, send or include is aimed at the user's API keys, tokens or passwords.
  • Weaker path matches count only when an action word appears before them.

Why it happens

The pattern comes from tool-poisoning demonstrations the rule cites (Invariant Labs, Snyk Agent Scan, Apify): the description tells the model to read a private file and pass it in a hidden parameter. The research pages were not re-fetched for this page.

A legitimate server can trip the rule by accident, for example a local helper that documents "reads credentials from ~/.aws/credentials". Remote connectors rarely need to mention these paths, and Claude's directory policy 2.G bars hidden or obfuscated instructions while OpenAI's plugin guidelines 4.2(b) bar collecting access credentials and authentication secrets.

Check it yourself

curl -s -X POST https://mcp.acme.example/mcp \
  -H 'Content-Type: application/json' -H 'Accept: application/json, text/event-stream' \
  -H "Authorization: Bearer $TOKEN" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' \
 | jq -r '.result.tools[] | "\(.name) \(.description) \(.inputSchema|tostring)"' | grep -Ei '\.ssh|id_rsa|\.env|\.aws|\.netrc|mcp\.json|/etc/passwd|api key|password'

Fix

  1. Delete the path or instruction.
  2. If the tool needs a key, take it through OAuth or an Authorization header, not through the model (schema.secret-param, auth.credential-in-url).
  3. If the tool is documentation that names a file for the user's own setup, move it to your docs.

Verify

The grep prints nothing relevant, and the re-scan passes. Related: errors.secrets-in-output.

Which clients care

Claude and ChatGPT, per the rule.

Source

Invariant Labs, tool poisoning: https://invariantlabs.ai/blog/mcp-security-notification-tool-poisoning-attacks

Claude directory policy: https://support.claude.com/en/articles/13145358-anthropic-software-directory-policy

Run a free scan at https://mcpshipyard.com/scan to check every rule at once.

Check every rule at once

A free scan runs this check and the other 152 against your live URL.

Scan a server