Back to skill

Security audit

MCP Engineering

Security checks for vulnerabilities and agentic risk

Overview

This is a documentation-only MCP engineering skill whose behavior matches its purpose, though users should avoid copying its full-parameter logging example without redaction.

Before installing, treat this as a general MCP engineering guide rather than production-ready secure code. If you copy its templates, redact or allowlist logged fields, avoid logging tokens or request bodies, pin npx/npm package versions for repeatable use, and keep any generated MCP tools scoped to least privilege with explicit confirmation for writes or deployment.

Vulnerability Patterns
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (1)

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:494
Finding
Unredacted MCP Tool Parameters May Expose Secrets in Logs## Vulnerability Details **File Location**: `SKILL.md`, lines 494–498 **Vulnerability Type**: Sensitive-data exposure through indiscriminate parameter logging **Risk Level**: Medium **Vulnerable Code:** ```typescript server.tool("my_tool", description, schema, async (params) => { const requestId = crypto.randomUUID().slice(0, 8); console.error(`[${requestId}] my_tool called:`, JSON.stringify(params)); const start = Date.now(); ``` Related guidance at line 447 also recommends recording calls “with what params” without requiring redaction: ```markdown - [ ] Audit log: who called what tool, when, with what params ``` ### Technical Analysis The logging template serializes the complete MCP tool parameter object and writes it to standard error. Tool parameters may contain API keys, authorization tokens, passwords, session identifiers, personal information, document contents, or proprietary business data. Standard error is commonly collected by process supervisors, container runtimes, cloud platforms, and centralized logging services. Consequently, sensitive parameters can be retained beyond their intended lifetime, become visible to additional operators, or be transmitted to an external logging provider. The pattern conflicts with the Skill's own credential-protection guidance at line 444, which states that API keys and secrets must never appear in tool responses, but it does not extend equivalent protection to logs. This is a documentation and template-level flaw rather than evidence that this repository itself actively exfiltrates data. However, servers generated from the template can reproduce the vulnerability. ### Attack Path 1. An MCP server adopts the provided logging template. 2. A tool accepts a sensitive value, such as an access token, password, private document, or personal record. 3. A legitimate user or attacker invokes the tool and places that value in `params`. 4. `JSON.stringify(params)` seria ...[truncated 1114 chars]
Remediation
## Remediation Suggestions 1. Do not log complete parameter objects. Log only operational metadata by default: ```typescript console.error(`[${requestId}] my_tool called`); ``` 2. If parameter logging is necessary, use an explicit allowlist of fields known not to contain sensitive information: ```typescript const auditFields = { itemId: params.itemId, operation: params.operation, }; console.error(`[${requestId}] my_tool called:`, auditFields); ``` 3. Implement recursive, case-insensitive redaction for keys such as `authorization`, `apiKey`, `token`, `secret`, `password`, `cookie`, `session`, and `credential`. Treat unknown fields as sensitive by default. 4. Never log request bodies, document contents, authentication headers, OAuth codes, or raw error objects that may embed request configuration. 5. Revise the audit checklist to require minimal metadata, redaction, access controls, retention limits, and a documented lawful purpose for each logged field. 6. Restrict log access according to least privilege, encrypt logs in transit and at rest, define short retention periods, and ensure secret rotation and incident-response procedures cover accidental logging. 7. Add automated tests that submit known marker secrets and verify that the markers do not appear in standard output, standard error, log files, or exported telemetry.
Vulnerability Patterns
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Output HandlingUnvalidated Output Injection, Cross-Context Output, Unbounded Output
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (6)

Credential Access

High
Category
Privilege Escalation
Content
```yaml
# MCP OAuth flow
1. Client requests tool → server returns 401 with auth URL
2. User completes OAuth in browser → gets access token
3. Client stores token, includes in subsequent requests
4. Server validates token, calls external API on user's behalf
```
Confidence
70% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Vague Triggers

Medium
Confidence
89% confidence
Finding
The README suggests activation via broad natural-language prompts such as "Build an MCP server for [any API]" and "Secure my MCP server for production" without defining exact trigger scope, constraints, or exclusion conditions. These phrases are general enough to overlap with ordinary agent requests, which can make it unclear when this specific skill should activate versus other engineering or security skills.

Rp1

Medium
Category
MCP Rug Pull
Confidence
70% confidence
Finding
npx commands without a version suffix (e.g. @1.0.0) create a rug-pull risk if the upstream server is compromised and publishes a malicious update.

Rp1

Medium
Category
MCP Rug Pull
Confidence
70% confidence
Finding
npx commands without a version suffix (e.g. @1.0.0) create a rug-pull risk if the upstream server is compromised and publishes a malicious update.

Unbounded Output

Medium
Category
Output Handling
Content
| "Invalid params" | Schema mismatch between client/server | Verify schema with `--schema` flag |
| Agent picks wrong tool | Ambiguous descriptions | Rewrite descriptions, add "Use this when..." |
| Agent calls tool in loop | Tool returning confusing error | Return clearer error with "do NOT retry" |
| Large response crashes | No output truncation | Add pagination or character limit |
| Auth errors intermittent | Token expiry | Implement token refresh |

### Debug Workflow
Confidence
60% confidence
Finding
Output size or generation rate is not bounded. Unbounded output enables denial-of-service through resource exhaustion, log flooding, or context-window stuffing.

Vague Triggers

Medium
Confidence
90% confidence
Finding
The skill registers very broad natural-language triggers such as 'Build an MCP server' and 'Secure my MCP server,' which can overlap with ordinary user requests and cause unintended activation. In an agent ecosystem, overbroad activation increases the chance this skill is invoked in the wrong context, potentially steering sensitive design, security, or implementation decisions without explicit user intent.

Static analysis

No suspicious patterns detected.