Model Context Protocol SDK regex DoS in URI template parsing
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 Score | 43 of 100 Our own ranking of what to fix first. Real attacks count most, then the chance of attack, then severity. |
|---|---|
| SecurityElites fix window | Within 30 days High severity. This is our suggestion from common practice; your own policy comes first. |
| Who should own the fix | Platform or infrastructure team managing MCP servers and AI agent deployments. |
| Likely effort | About 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-01576What 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
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
| Software | Affected versions | Move to |
|---|---|---|
| @modelcontextprotocol/sdk npm | 1.3.0 up to, but not including, 1.25.2 | 1.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 attacked | Working attack code is public, so expect attacks to follow |
|---|---|
| Where the attacker must be | Anywhere that can reach it over a network, including the internet if it is exposed |
| Account needed | None. No login is needed |
| Does a person have to do something | No. It works without anyone clicking or opening anything |
| How hard it is to do | Easy. It works reliably once the attacker can reach it |
| Risk of: data being read | None |
| Risk of: data or settings being changed | None |
| Risk of: the service being taken down | High |
| Can attackers automate it at scale | Yes, according to CISA |
| How much control an attacker gains | Partial 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 > 80Find 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 - countWritten 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
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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/sdkCheck the installed version of @modelcontextprotocol/sdkfor this issue
npm list @modelcontextprotocol/sdkReview 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.
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.
Related vulnerabilities
In the same software
- MCP servers over HTTP accept unlimited request sizes, causing memory exhaustion High · GHSA-f897-62hf-6gxq
- Model Context Protocol servers can run out of memory from large requests High · CVE-2026-111768
- Model Context Protocol SDK tasks can be read by other clients sharing the store High · CVE-2026-111767
- Model Context Protocol OAuth client sends credentials to wrong authorization server High · CVE-2026-104850
- Model Context Protocol SDK can send client data to the wrong user in shared deployments High · CVE-2026-25536
- MCP SDK localhost server can be tricked into serving requests from malicious websites High · CVE-2025-66414
The same kind of mistake in other AI tools
- NLTK XML corpus reader CPU exhaustion with large comments or CDATA High · CVE-2026-128139
- NLTK WordNet methods can be made to exhaust the call stack High · CVE-2026-129223
- NLTK CCG lexicon parser can be made slow by large inputs High · CVE-2026-126299
- NLTK tree normalizer hangs on wide trees, letting attackers freeze CPU High · CVE-2026-126298
- NLTK CoNLL reader can be made to consume CPU when reading malicious corpus files High · CVE-2026-126297
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-0621For 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.