Answers · MCP security
Our assistant used the DynamoDB MCP Server to design a data model and then generate a CDK app from dynamodb_data_model.json, and we ran cdk deploy on it. We've now seen CVE-2026-85654 about code injection in that CDK generator. How does it work, which versions are affected, and how do we check a CDK project we already generated?
Last updated
TL;DR: Yes, in versions 2.0.10 through 2.1.5. AWS's advisory GHSA-35jj-hwvm-792x (CVE-2026-85654, high, CVSS 3.1 7.8), published September 8, 2026, says the server's CDK generator rendered a Jinja2 template (stack.ts.j2) with autoescape off and copied table, index and attribute names from dynamodb_data_model.json into the generated TypeScript stack without adequate sanitization: nine string-literal positions and four identifier positions. A crafted name could carry TypeScript code, and running cdk synth or cdk deploy on the generated project would run it on the developer's machine with that user's privileges, including any AWS credentials in the environment. Version 2.1.6, uploaded to PyPI on August 14, 2026 (UTC), validates table and index names against DynamoDB's own naming rules and escapes every string value. Upgrade, regenerate any CDK app made by an affected version, and read the generated stack before running it.
What should I check, step by step?
1. Check the installed version of awslabs.dynamodb-mcp-server. 2.0.10 through 2.1.5 are affected and 2.1.6 is the first fixed release; PyPI listed 2.1.11 as the newest on November 24, 2026.
- If you run it with uvx and awslabs.dynamodb-mcp-server@latest, as the README shows, restart the MCP client and confirm the version the process loaded. Pinned versions don't update themselves.
- Find CDK projects generated by an affected version and regenerate them with 2.1.6 or later, instead of patching the old output by hand.
- Before any cdk synth or deploy of a generated stack, read the TypeScript file. Table, index and attribute names should be plain quoted strings; anything that closes a quote and adds code is a red flag.
- Check dynamodb_data_model.json itself: table and index names should only use letters, digits, underscore, hyphen and dot, 3 to 255 characters. Treat a model file from a pull request, a template or a shared folder as untrusted input.
- Run cdk synth and deploy with short-lived, least-privilege credentials, not an admin profile that stays in your shell.
- If an affected version ever generated a stack from a model file you didn't write and you ran it, check the machine and the AWS accounts those credentials could reach, and rotate the credentials.
What is CVE-2026-85654 in the DynamoDB MCP Server?
The DynamoDB MCP Server helps an AI coding assistant design DynamoDB tables and data models. Its generate_resources tool, with resource_type cdk, turns dynamodb_data_model.json into a CDK app that deploys the tables. AWS's advisory GHSA-35jj-hwvm-792x, published September 8, 2026, covers versions 2.0.10 through 2.1.5 and is filed under CWE-1336, special elements in a template engine not neutralized.
- According to the advisory, the generator rendered stack.ts.j2 with autoescape off, and table names, index names and attribute names from the model file went into the TypeScript stack without adequate sanitization, in nine string-literal positions and four identifier positions. A name containing a quote and some code would become code in the generated stack. Nothing runs when the file is generated; it runs when the developer runs cdk synth or cdk deploy, on their own machine with their full privileges and whatever AWS credentials are in the environment. The CVSS vector reflects that: local, with user interaction.
- The model file is the attack surface. An assistant writes it, but so can anyone who can change it: a teammate's pull request, a sample project or text the assistant was told to follow. The advisory's workaround is to review the model file for odd table, index or attribute names before generating and to avoid model files from untrusted sources.
How does DynamoDB MCP Server 2.1.6 fix CVE-2026-85654 in the CDK generator?
The fix is pull request 4384 in awslabs/mcp, merged August 13, 2026, released in 2.1.6. Its commit message explains the split: table and index names land in TypeScript identifier positions, where escaping can't help, so they're now validated against the character set and length DynamoDB itself enforces (letters, digits, underscore, hyphen and dot, 3 to 255 characters). Attribute names have no character limit in DynamoDB, so they can't be rejected; instead every string-literal value in the template now goes through Jinja's tojson filter, which writes a properly quoted and escaped string.
- A second change anchors the name check with a full match, because a plain match would have let a name ending in a newline through. The generator also now turns names that start with a digit or contain dots into legal TypeScript identifiers, and reports a clash if two names map to the same one.
Why does code generated by an MCP tool need review before you run it?
Code generators sit between data and code: they take values, usually names, and write them into a program someone will run later. If the template doesn't escape for the language it writes, any value can become code, and the moment of danger is the build or deploy step, often far from where the value came from.
- For MCP tools that generate code, infrastructure templates or scripts, treat the output as untrusted until a person has read it, and run builds with credentials that can't do more than the job needs. For anyone building such tools, escape for the target language at every position and validate names that become identifiers, as this fix does.
How do I ask Rightshold about this (free, no key)?
Add the MCP server https://www.rightshold.com/mcp to Claude, Cursor, ChatGPT, Grok or VS Code, then ask: “Before my assistant runs cdk deploy on the CDK app the DynamoDB MCP Server generated, ask me to approve that exact command, with a hash of the generated stack file, and wait for my yes or no.”
{
"tool": "request_human_approval",
"arguments": {
"action": {
"command": "cdk deploy",
"generated_by": "awslabs.dynamodb-mcp-server generate_resources (resource_type cdk)",
"server_version": "2.1.11",
"stack_file_sha256": "<sha256 of the generated stack .ts file>"
},
"summary": "Deploy the DynamoDB tables from the generated CDK app after reading the stack file",
"expires_in_minutes": 30
}
}- Needs a key for your account. It hashes the action details and returns an approval id and a one-time token for the owner. Only the account owner can decide it, with an account key; delegated agent keys are refused, so the assistant can't approve its own request. Anyone can check the signed decision free with verify_human_approval, including that the action matches what was approved.
- It doesn't read or check the generated stack or the model file, and it can't stop a command your assistant runs directly. It only covers commands your agent or harness routes through it first, so upgrade and read the generated code as well.
Rightshold isn't affiliated with AWS. It doesn't scan MCP server code, generated CDK apps or data model files, and an approval record isn't a finding that a deploy is safe. Advisory details are as published by AWS in the awslabs/mcp repository's advisory GHSA-35jj-hwvm-792x, the fix as described in pull request 4384 and its template diff, the tool as described in the server's README, and release dates as listed on PyPI, all read November 24, 2026; advisories get updated, so confirm fixed versions on the linked pages.
What are the sources?
- awslabs/mcp security advisory GHSA-35jj-hwvm-792x / CVE-2026-85654: code injection in the CDK generator in awslabs.dynamodb-mcp-server
- awslabs/mcp pull request 4384: fix(dynamodb-mcp-server): validate and escape names in CDK generator
- DynamoDB MCP Server README (generate_resources, dynamodb_data_model.json, install config)
- PyPI: awslabs.dynamodb-mcp-server release history
Related
- Can an MCP tool marked read-only write files? AWS Pricing MCP server CVE-2026-126816
- Can opening an untrusted repository with the MCP git server run code on your machine?
- How to pin MCP server versions and review changes before upgrading
- Which AWS Labs Postgres, MySQL and DocumentDB MCP server versions fix the read-only mode bypasses
Not legal advice. JSON · Markdown · All answers
Get a free API key in one call
No card and no email needed. 100 free credits; the license and policy checks stay free without a key.
curl -s -X POST https://www.rightshold.com/v1/accounts/signup -H "Content-Type: application/json" -d '{"accept_terms":true}'
export RIGHTSHOLD_API_KEY=rs_... # the api_key from the reply (shown once)
curl -s https://www.rightshold.com/v1/licenses/check -H "Authorization: Bearer $RIGHTSHOLD_API_KEY" \
-H "Content-Type: application/json" -d '{"license":"MIT","intended_use":{"commercial_use":true}}'
