Research Academy My account Customers About Blog Careers Legal Contact Resellers

MCP server vulnerabilities

MCP server vulnerabilities are flaws in Model Context Protocol (MCP) servers that websites expose so that AI assistants and agents can use their functionality. An MCP server is a web API. It accepts requests from any client that can send them, not only from AI assistants, and it is subject to the same vulnerabilities as any other API.

Some MCP server vulnerabilities are specific to a protocol. For example, a server might hide a tool from some users without stopping them from calling it, or trust a session ID as proof of who the user is.

In this topic, you'll learn how to interact with MCP servers directly using Burp Suite, and how to find and exploit common MCP server vulnerabilities.

What is MCP?

The Model Context Protocol (MCP) is an open protocol that lets AI applications connect to external tools and data. Applications can expose functionality to AI assistants through an MCP server. The MCP client in the assistant connects to the server and discovers what it can do.

An MCP server can offer several kinds of capability:

  • Tools - Named functions that the client can call with arguments, such as list_products or update_email. When a tool runs, it typically queries a database or performs an action on behalf of the user.
  • Resources - Data that the client can read by URI, such as files, database records, or documents.
  • Prompts - Reusable prompt templates that the client can fill in with arguments.

From a security perspective, each of these is equivalent to an API endpoint. The AI assistant decides when to use them, but nothing stops an attacker from sending the same requests directly, with arguments of their own choosing.

How MCP servers work

Remote MCP servers send JSON-RPC 2.0 messages over HTTP, usually to a single endpoint such as /mcp. The client sends each message in the body of a POST request, and the server responds with JSON or with a stream of server-sent events. For example, the following request calls a tool named get_product:

POST /mcp HTTP/1.1 Host: vulnerable-website.com Content-Type: application/json Accept: application/json, text/event-stream {"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"get_product","arguments":{"productId":"1"}}}

Several versions of the protocol are in use, and they differ in how a client starts talking to a server. For the details of each version, see the MCP specification. The main differences that affect testing are:

  • In older versions, the client starts with an initialize request. The server can respond with instructions for the AI assistant, and with an Mcp-Session-Id header that the client sends in every later request. Many servers still use this flow, including the servers in our labs.
  • The latest version enforces statelessness. The client can call server/discover to learn about the server.

MCP authorization

MCP servers that need to know who the user is typically expect a bearer token in the Authorization header. Some servers accept a static API key. Others act as an OAuth 2.1 resource server.

When an OAuth-protected server receives a request without a valid token, it responds with 401 Unauthorized and a WWW-Authenticate header. This header points to the server's protected resource metadata, which in turn names the authorization server. MCP clients often register themselves with the authorization server automatically, using OAuth dynamic client registration.

Testing MCP servers

To test an MCP server, you first need to find it. Look for:

  • Documentation or settings pages that explain how to connect an AI assistant to the website.
  • Common endpoint paths, such as /mcp or /sse.
  • Metadata files such as /.well-known/oauth-protected-resource.

Once you've found the endpoint, you can send requests directly to it using Burp Repeater. You don't need an AI assistant for this. On a server that uses the initialize flow, send an initialize request first:

{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"repeater","version":"1.0"}}}

To list what the server offers, use tools/list, resources/list, resources/templates/list, and prompts/list. You can then call tools, read resources, and retrieve prompts using arguments that you control.

When you map an MCP server's attack surface, pay attention to:

  • The server's name, version, and instructions. These sometimes describe tools or behavior that the lists don't reveal.
  • Each tool's input schema, including optional arguments that a normal client wouldn't send.
  • Which requests need a token, and how the server responds to a missing, invalid, or expired token.
  • Whether the server issues an Mcp-Session-Id, and whether its value follows a recognizable pattern.

Tip

The MCP Server Scanner extension for Burp Suite Professional connects to an MCP server, discovers its tools, resources, resource templates, and prompts, and runs them through Burp Scanner. It supports several protocol versions and authentication methods. You can use it to map the servers in our labs, and to find vulnerabilities in their tools.

Vulnerabilities in MCP tools

MCP tools usually call the same backend code as the website itself. If that code is vulnerable, the tool may be too. Developers sometimes assume that tool arguments are safe because an AI assistant generates them. In fact, an attacker can send any value they like.

Test every tool argument for the same classic vulnerabilities that you would look for in any other API, such as SQL injection, path traversal, and server-side request forgery (SSRF). A tool may even expose a vulnerable query that the website's own pages never reach.

Tools that act on a user's account are also prone to access control vulnerabilities. A common mistake is to let a tool take the target user as an argument, and then trust that argument instead of the authenticated identity.

Hidden tools are not restricted tools

Many MCP servers let administrators limit which tools a user or client can use. A common flaw is to apply this limit only when the server answers tools/list. The server leaves the tool out of the list, but still runs it if a client calls it by name.

This is the MCP equivalent of hiding an admin link in the user interface while leaving the admin page itself unprotected. If you learn the name of a hidden tool, from the server's instructions, its documentation, or by guessing, try to call it directly.

Beyond tools: resources, prompts, and server information

Tools are the most obvious attack surface, but they aren't the only one. Resources, prompts, and the information a server reveals about itself can also lead to vulnerabilities. Look out for the following issues.

Resources

A client reads a resource by sending its URI in a resources/read request. Servers often build resource URIs from templates, such as file:///app/docs/{name}, which the client fills in. The server then turns the URI into a file path, a database query, or an outbound request. This makes resources prone to the same input handling flaws as tool arguments.

For example, a server that serves documentation files from a template like the one above may be vulnerable to path traversal:

{"jsonrpc":"2.0","id":5,"method":"resources/read","params":{"uri":"file:///app/docs/../../../etc/passwd"}}

When you test resources, try:

  • Path traversal sequences in any part of the URI that maps to a file path, including URL-encoded variants.
  • URIs that the server didn't list. Servers often read any URI that matches a template, or any URI at all.
  • Different URI schemes. For example, if the server lists file:// resources, try an http:// URI. If the server fetches the URI, this may lead to SSRF or let you read local files.
  • URIs that identify another user's data, such as a resource that includes a username or record ID. These may reveal access control vulnerabilities.

Prompts

A client gets a prompt by sending its name and arguments in a prompts/get request. The server inserts the arguments into a template and returns the result, which the AI assistant then acts on. Look out for:

  • Prompts that reveal sensitive information, such as internal instructions, tool names, or credentials.
  • Arguments that the server uses in other ways, such as to look up data. These may be vulnerable to injection.
  • Arguments that the server inserts into the prompt without restriction. An attacker who controls them may be able to inject instructions for the AI assistant. For more information, see Web LLM attacks.

Server information

The server's name, version, capabilities, and instructions can tell you what software it runs and what it can do. Check the version against known vulnerabilities in the MCP framework or SDK. Read the instructions for references to tools, resources, or behavior that the lists don't show.

Authentication vulnerabilities in MCP servers

An MCP server needs to know which user each request comes from, so that it can decide which tools that user may call. If the server identifies the user incorrectly, an attacker may be able to call tools as a more privileged user.

Authentication that fails open

Some MCP servers accept more than one kind of credential. For example, a server might accept its own API keys and also OAuth tokens issued for another service. If the server can't validate a token and falls back to a default identity instead of rejecting the request, it fails open.

To test for this, send three requests: one with no token, one with a valid token, and one with a token that is well-formed but invalid. Compare the responses. A server that rejects a missing token but accepts an invalid one is a strong sign of this flaw.

Session IDs used for authentication

Versions of the specification that use Mcp-Session-Id state that servers must not use sessions for authentication. Despite this, some servers check the user's token only during initialize, and then trust the Mcp-Session-Id header alone for every later request.

If the server generates session IDs that are predictable, such as sequential numbers, you may be able to guess another user's session ID. You can then act as that user without knowing their token.

OAuth vulnerabilities in MCP servers

Dynamic client registration lets anyone register a new OAuth client with the authorization server. This is convenient for MCP clients, but it means that the authorization server can't trust anything a client says about itself, including its name and its redirect URIs.

Look out for:

  • Registration that accepts any redirect URI. Desktop MCP clients usually only need loopback redirect URIs, such as http://127.0.0.1. If the server accepts a redirect URI on a domain you control, it may send authorization codes to you.
  • Consent that the server remembers by client name or another attacker-controlled property. If a user has already approved a trusted client, a malicious client with the same name may skip the consent screen. This is a form of the "confused deputy" problem.
  • Redirect URIs that the server doesn't check exactly at the authorization endpoint.

You can combine these weaknesses to steal a victim's authorization code. For example, you could register a client with a trusted client's name and a redirect URI that you control. If the server remembers consent by client name, it may treat your client as one the victim has already approved. When the victim visits your authorization link, the server skips consent and sends the code to your redirect URI.

Proof Key for Code Exchange (PKCE) helps protect authorization codes from interception. The client creates a secret value called a code verifier and sends a corresponding code challenge with its authorization request. When exchanging the authorization code for a token, the client supplies the verifier. The authorization server checks that it matches the challenge.

PKCE doesn't prevent this attack because you start the flow and choose the code verifier yourself. Once you receive the victim's authorization code, you can supply the verifier to exchange it for an access token.

Preventing MCP server vulnerabilities

You can prevent most MCP server vulnerabilities with the following measures:

  • Treat every MCP tool, resource, and prompt as a public API endpoint. Validate and parameterize its arguments in the same way as any other user input.
  • Derive the user from the authenticated token, never from a tool argument or resource URI.
  • Enforce authorization when a tool is called or a resource is read, not only when they are listed.
  • Map resource URIs to an allowlist of files or records. Don't pass them directly to the file system or to an HTTP client.
  • Reject any request whose token you can't validate. Never fall back to a default or service identity.
  • Authenticate every request. If you use session IDs, treat them only as session identifiers, generate them with a secure random generator, and bind them to the user who created them.
  • Restrict the redirect URIs that dynamically registered clients can use, and match them exactly at the authorization endpoint.
  • Record and check consent against the client ID, not against a name or other value that the client chooses.