Back to skill

Security audit

MCP OAuth

Security checks for vulnerabilities and agentic risk

Overview

The skill is not malicious, but its OAuth examples could generate weak login protection for an MCP server.

Install only if you treat it as a starting reference, not production-ready security code. Before using its output, require exact client and redirect URI registration, enforce PKCE verifier checks, use secure token storage with revocation and rotation, and add centralized authorization tests proving protected MCP tools cannot run without valid auth.

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 (4)

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:134
Finding

Client PKCE Challenge Is Never Verified During Token Exchange

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:105
Finding

Dynamic Client Registration and Redirect URI Binding Are Not Enforced

Content
View full analysis
({})); const clientId = crypto.randomBytes(16).toString('hex'); return NextResponse.json({ client_id: clientId, client_name: body.client_name || 'MCP Client', redirect_uris: body.redirect_uris || [], grant_types: ['authorization_code', 'refresh_token'], response_types: ['code'], token_endpoint_auth_method: 'none', }, { status: 201 }); } ``` The authorization endpoint does not require a registered `client_id` and only checks the redirect URI hostname: ```typescript const params = req.nextUrl.searchParams; const redirectUri = params.get('redirect_uri'); const state = params.get('state'); const codeChallenge = params.get('code_challenge'); if (!redirectUri || !state || !codeChallenge) { return NextResponse.json( { error: 'invalid_request', error_description: 'Missing required parameters' }, { status: 400 }, ); } // Validate redirect_uri — allow known MCP clients const url = new URL(redirectUri); const isAllowed = url.hostname === 'claude.ai' || url.hostname === 'claude.com' || url.hostname === 'api.smithery.ai' || url.hostname === 'localhost' || url.hostname === '127.0.0.1'; if (!isAllowed) { return NextResponse.json( { error: 'invalid_request', error_description: 'redirect_uri not allowed' }, { status: 400 }, ); } ``` ### Technical Analysis The dynamic registration endpoint returns a random client identifier but does not save the client record or validate its metadata. The authorization endpoint does not request or verify `client_id`, and it does not compare `redirect_uri` ...[truncated 1974 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:286
Finding

Protected MCP Tool Execution Is Not Enforced by the Authentication Wrapper

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:247
Finding

Refresh Token Rotation Leaves Previously Used Tokens Valid

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (5)

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The manifest description says to use the skill whenever the user wants to 'add authentication', 'implement login flow', or even just says 'add auth to my MCP server' or 'my MCP server needs login'. While MCP is a domain constraint, these activation instructions are still broad and lack exclusion conditions or negative examples, which can cause unintended invocation for adjacent authentication tasks.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The authorization flow example is incomplete and under-validates OAuth inputs for a security-sensitive endpoint. It only checks presence of a few parameters and applies weak hostname-based redirect validation, while omitting stronger checks such as exact client/redirect binding, response_type validation, PKCE method enforcement, client registration lookup, and robust state/session handling; implementers may copy this into production and introduce open redirect, authorization code injection, or client impersonation flaws.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The guide recommends storing upstream access and refresh tokens for long periods in Redis without emphasizing encryption, least retention, access controls, rotation, and user consent. Because these are highly sensitive bearer credentials tied to user accounts, implementers may persist them insecurely and create account-takeover risk if Redis or logs are exposed.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The manifest and guide position the skill as adding OAuth authentication to protect MCP tools. Yet the example sets required: false and states that unauthenticated discovery is allowed, meaning the wrapper itself does not enforce authentication on requests and relies on each tool to do so correctly.

Content

No source excerpt is available for this finding.

Unrestricted Tool Access

Medium
Category
Excessive Agency
Confidence
80% confidence
Finding

Skill grants unrestricted tool access without appropriate constraints. An agent with unfettered tool access can perform arbitrary actions including file modification, network requests, and code execution.

Content

Scanner excerpt · evals/evals.json (reported line 11)May include surrounding context.

json
},
    {
      "id": 2,
      "prompt": "My MCP server needs user authentication. Users should log in with GitHub OAuth before they can use any tools. The server is on Vercel with Next.js. I need the complete OAuth PKCE flow.",
      "expected_output": "Creates the double OAuth architecture (server for MCP clients + client for GitHub), all well-known endpoints, dynamic client registration, withMcpAuth with required: false, Redis schema"
    }
  ]