Model Context Protocol SDK regex DoS in URI template parsing

HighSE Fix-First Score 43/100CVE-2026-0621SE-AIV-01576Denial of service and resource exhaustionAI agents and assistantsMade public 6 Jan 2026

Download as PDF

What this means

An attacker can send a specially crafted URI request that causes the MCP server to use 100% CPU and stop responding. The server hangs or crashes, and all clients lose access until it restarts. This affects any AI agent or application relying on that MCP server.

SecurityElites Manager Brief: the decision in one minute

A regex flaw in Model Context Protocol SDK allows attackers to freeze your MCP servers with one request. Update to v1.25.2 immediately to restore reliability.

SecurityElites Fix-First Score43 of 100
Our own ranking of what to fix first. Real attacks count most, then the chance of attack, then severity.
SecurityElites fix windowWithin 30 days
High severity. This is our suggestion from common practice; your own policy comes first.
Who should own the fixPlatform or infrastructure team managing MCP servers and AI agent deployments.
Likely effortAbout 15 minutes per service: update the npm package and restart the MCP server. Testing the fix takes another 10 minutes.

Questions to ask your team or supplier

  • Do we have a list of all services running @modelcontextprotocol/sdk, and is that list maintained automatically as services are deployed?
  • What resource templates with exploded array patterns do we actually need, and can we simplify or remove them to reduce attack surface?
  • Do we have CPU and response-time monitoring that would alert us if an MCP server becomes unresponsive, and is it connected to our on-call team?

Message you can forward to the owning team

Security notice: Model Context Protocol SDK regex DoS in URI template parsing (CVE-2026-0621)

Severity: High
SecurityElites Fix-First Score: 43 of 100
SecurityElites fix window: Within 30 days
Action: upgrade to @modelcontextprotocol/sdk 1.25.2 or later.
What we need from you: confirm whether we run this software, who owns it, and the date it will be fixed.
Full guide: https://securityelites.com/ai-vulnerabilities/cve-2026-0621-model-context-protocol-sdk-regex-dos-in-uri-template/
Source: SecurityElites AI Vulnerabilities Database, record SE-AIV-01576

What is at stake in your AI setup

  • MCP server availability: attackers can crash the server and disconnect AI agents from resources and tools they depend on
  • Tools and systems the agent is connected to: resource templates expose what APIs and databases the AI agent can access; DoS prevents legitimate requests to them
  • Compute bill: a frozen server may continue consuming CPU resources, increasing costs until manually restarted

Map where your company uses AI

Who is exposed

  • MCP servers using SDK versions 1.3.0 through 1.25.1 that accept resource requests from untrusted clients
  • AI applications deployed with vulnerable MCP server instances
  • Any system where an MCP server exposes resource templates with array patterns (e.g., {/id*}, {?tags*})

Upgrades you need

SoftwareAffected versionsMove to
@modelcontextprotocol/sdk
npm
1.3.0 up to, but not including, 1.25.21.25.2 or later

Am I affected?

Enter the version you run. Nothing you type is stored.

SecurityElites Developer Brief: the technical picture

Is it being attackedWorking attack code is public, so expect attacks to follow
Where the attacker must beAnywhere that can reach it over a network, including the internet if it is exposed
Account neededNone. No login is needed
Does a person have to do somethingNo. It works without anyone clicking or opening anything
How hard it is to doEasy. It works reliably once the attacker can reach it
Risk of: data being readNone
Risk of: data or settings being changedNone
Risk of: the service being taken downHigh
Can attackers automate it at scaleYes, according to CISA
How much control an attacker gainsPartial control, according to CISA

Read from the official severity rating: CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N

Kind of coding mistake

  • CWE-1333: a slow pattern match can freeze the service

Where it sits in the standards

OWASP Top 10 for LLM Applications 2025: LLM10 Unbounded Consumption

If you cannot upgrade today

  • Remove or replace exploded array patterns in resource templates: change {/id*} to {/id} and avoid {?tags*} style patterns until you can upgrade
  • Add request timeouts: set a 5-second timeout on all resource/read requests at the server level to prevent hangs from blocking other clients
  • Implement rate limiting: reject more than one resource/read request per second from the same client to slow down attack attempts

Signs it may already have been used against you

  • MCP server logs: sudden CPU usage spikes to 100% that correlate with resource/read requests, especially those with long or repeated characters in the URI
  • Process monitoring: MCP server process becoming unresponsive or consuming all available CPU for sustained periods
  • Request logs: resource/read requests with URIs containing long chains of repeated characters or complex patterns in parameters marked with {*}
  • Error logs: timeout or crash messages shortly after receiving URI requests with unusual length or structure

Log searches to start from

Detect potential ReDoS attacks: look for resource/read requests with very long URI values or high CPU usage spikesSplunk

index=mcp_logs (source=resource_read OR component=UriTemplate) | stats max(cpu_percent) as peak_cpu by src_ip | where peak_cpu > 80

Find resource/read requests with suspicious URI patterns that could trigger the regexElastic

source:mcp AND event.action:resource_read AND uri.path:/.+/ | stats count by src.ip, uri.path | sort - count

Written with AI as a starting point. Review them and change the index and field names to match your own logs before you rely on the result.

SecurityElites Fix Guide: step by step

  1. Find where the SDK is installedCheck all Node.js projects and services that use @modelcontextprotocol/sdk. Look in package.json files for this dependency. Record the current version of each installation.
  2. Check the current versionRun npm list @modelcontextprotocol/sdk in each project directory. Record any version from 1.3.0 up to but not including 1.25.2 as needing upgrade.
  3. Back up configuration and stateSave the current MCP server configuration, any registered resource templates, and recent logs. This protects you if the upgrade needs to be rolled back.
  4. Upgrade to the fixed versionUpdate @modelcontextprotocol/sdk to version 1.25.2 or later using npm. Run npm install in the project directory, then commit and push the change.
  5. Restart the MCP serverStop and start the MCP server process to load the new version. For containerized deployments, restart the container. For systemd services, run systemctl restart.
  6. Verify the fix is in placeRun npm list @modelcontextprotocol/sdk again and confirm the version is 1.25.2 or higher. Check the server logs to confirm it started without errors.
  7. Review logs for past exploitationSearch server logs from the past month for unexpected CPU spikes, hangs, or crashes that coincide with unusual URI requests. Note any suspicious patterns in resource/read requests.
  8. Assess if your templates need changesIf your resource templates use exploded array patterns like {/id*} or {?tags*}, consider whether they are necessary. You can remove them or combine with the workarounds to reduce attack surface.

How to confirm it is fixed: Run npm list @modelcontextprotocol/sdk and confirm the installed version is 1.25.2 or higher, then confirm the MCP server starts and responds to requests without CPU spikes.

SecurityElites Quick Fixes: copy and paste

Upgrade @modelcontextprotocol/sdk with npmupgrade

npm install @modelcontextprotocol/sdk@1.25.2
npm ls @modelcontextprotocol/sdk

Check the installed version of @modelcontextprotocol/sdkfor this issue

npm list @modelcontextprotocol/sdk

Review resource template definitions in your MCP server code for exploded patterfor this issue

// Look for resource URIs with these patterns in your code:
// {/variable*}  or  {?variable*}  or  {&variable*}
// These are more risky and should be replaced if possible with simple patterns like {/variable} or removed.

Rate and size limits with nginxgeneral hardening

limit_req_zone $binary_remote_addr zone=api:10m rate=10r/s;

server {
    location /api/ {
        limit_req zone=api burst=20 nodelay;
        client_max_body_size 2m;
    }
}

Test in a non-production environment first. General hardening examples use placeholder names and ports; change them to match your setup.

Let your AI coding assistant do the upgrade

Paste this into the coding assistant you already use, inside the project. It checks first and asks before it changes anything.

Instruction for your coding assistant

You are helping me fix a security vulnerability (CVE-2026-0621) in this project.\n\n1. Search the whole repository, including lock files, container files and CI configuration, for these packages and list every place they are pinned or installed:\n   - @modelcontextprotocol/sdk (npm): must be 1.25.2 or later
2. Tell me which version we use now and whether it is affected. Stop and ask me before changing anything.
3. After I agree, raise each one to the safe version, update the lock files, and keep every other dependency as it is.
4. Run the tests and tell me what failed.
5. Give me a short summary of the files you changed that I can put in the pull request.

SecurityElites Incident Drill: could your team handle this?

Four questions to ask in your next team meeting. If any has no clear answer, that is the gap to close.

What versions of @modelcontextprotocol/sdk are affected by this vulnerability?A good answer: Versions 1.3.0 through 1.25.1 are affected; version 1.25.2 and later are fixed.
What type of request can trigger the denial of service?A good answer: A resource/read request with a specially crafted URI sent to an MCP server that uses resource templates with exploded array patterns like {/id*} or {?tags*}.
How would you know if your MCP server was under attack using this vulnerability?A good answer: The server CPU would spike to 100%, the server would become unresponsive to requests, and clients would time out or disconnect; you would see this in CPU and response-time monitoring.
What is the minimum safe version to upgrade to?A good answer: Version 1.25.2 or any version higher than 1.25.2 contains the fix.

Run a full timed drill with your team

Ticket for your backlog

Paste into Jira, GitHub Issues or any tracker that reads Markdown.

Ready-made ticket

## Model Context Protocol SDK regex DoS in URI template parsing (CVE-2026-0621)

**Severity:** High  |  **SE Fix-First Score:** 43/100  |  **Fix window:** Within 30 days
**Record:** SE-AIV-01576 https://securityelites.com/ai-vulnerabilities/cve-2026-0621-model-context-protocol-sdk-regex-dos-in-uri-template/

### Why this matters
An attacker can send a specially crafted URI request that causes the MCP server to use 100% CPU and stop responding. The server hangs or crashes, and all clients lose access until it restarts. This affects any AI agent or application relying on that MCP server.

### What to do
1. Find where the SDK is installed
2. Check the current version
3. Back up configuration and state
4. Upgrade to the fixed version
5. Restart the MCP server
6. Verify the fix is in place
7. Review logs for past exploitation
8. Assess if your templates need changes

Full steps: https://securityelites.com/ai-vulnerabilities/cve-2026-0621-model-context-protocol-sdk-regex-dos-in-uri-template/

### Done when
- [ ] @modelcontextprotocol/sdk is at 1.25.2 or later everywhere it is installed
- [ ] Lock files, container images and CI configuration are updated
- [ ] Run npm list @modelcontextprotocol/sdk and confirm the installed version is 1.25.2 or higher, then confirm the MCP server starts and responds to requests without CPU spikes.
- [ ] Logs were checked for signs of earlier use

SecurityElites Fix Tracker

Record who owns this fix, the date it is due and when it is done, and see everything still open in one list. Free with a SecurityElites account.

Sign in to track this fix

Change history

  • 5 Jan 2026: Made public
  • 3 Dec 2026: Published

Official record

### ImpactA ReDoS vulnerability in the `UriTemplate` class allows attackers to cause denial of service. The `partToRegExp()` function generates a regex pattern with nested quantifiers (`([^/]+(?:,[^/]+)*)`) for exploded template variables (e.g., `{/id*}`, `{?tags*}`), causing catastrophic backtracking on malicious input.**Who is affected:** MCP servers that register resource templates with exploded array patterns and accept requests from untrusted clients.**Attack result:** An attacker sends a crafted URI via `resources/read` request, causing 100% CPU utilization, server hang/crash, and denial of service for all clients.### Affected VersionsAll versions of `@modelcontextprotocol/sdk` prior to the patched release.### Patchesv1.25.2 contains b392f02ffcf37c088dbd114fedf25026ec3913d3 the fix modifies the regex pattern to prevent backtracking.### Workarounds- Avoid using exploded patterns (`{/id*}`, `{?tags*}`) in resource templates - Implement request timeouts and rate limiting - Validate URIs before processing to reject suspicious patterns

Weakness type: CWE-1333

Use this record in your own tools

Get this record as JSON

curl https://securityelites.com/wp-json/se-aivd/v1/vulns/CVE-2026-0621

For scanners and pipelines: OSV format · CycloneDX format · API guide · Email alerts · Fix tracker

The plain-language sections were written with AI from the official record, and the upgrade versions come directly from the official data. Last updated 3 Dec 2026. Read the vendor advisory before changing a production system.