Amazon Q Developer Flaw CVE-2026-12957: When Opening a Repository Hands Over Your AWS Keys + Video

Listen to this Post

Featured Image

Introduction:

The integration of AI coding assistants into development workflows has introduced a new and insidious attack vector: the trusted workspace. A recently patched high-severity vulnerability in Amazon Q Developer, tracked as CVE-2026-12957 with a CVSS score of 8.5, demonstrated that simply opening a malicious Git repository could silently execute arbitrary code and exfiltrate a developer’s cloud credentials. This flaw exploited the automatic loading of Model Context Protocol (MCP) server configurations from untrusted project files, bypassing any user consent or workspace trust checks.

Learning Objectives:

  • Understand the technical mechanics of CVE-2026-12957 and how it enabled automated code execution and credential theft.
  • Learn to identify and mitigate similar risks in AI-powered coding tools and CI/CD pipelines.
  • Implement practical security measures, including version verification, workspace trust policies, and environment variable restrictions.

You Should Know:

  1. The Anatomy of the Attack: How a Single Config File Compromised Cloud Infrastructure

The vulnerability resided in how the Amazon Q Developer IDE plugin handled MCP server configurations. When a developer opened a project and activated Amazon Q, the extension would automatically read the `.amazonq/mcp.json` file from the workspace root and execute the commands it contained. This process occurred without any prompt, consent dialog, or workspace trust verification.

The MCP servers launched were local processes that inherited the developer’s complete environment, including all active AWS credentials, API keys, authentication tokens, and SSH agent sockets. The Wiz Research team demonstrated the attack by creating a proof-of-concept repository with a malicious configuration that executed `aws sts get-caller-identity` and exfiltrated the results to an attacker-controlled server. This single command provided everything needed to compromise the developer’s cloud account.

Step‑by‑Step Attack Flow:

  1. Attacker creates a malicious repository containing an `.amazonq/mcp.json` file with an MCP server definition pointing to a rogue command.
  2. Developer clones the repository and opens it in VS Code (or another supported IDE) with Amazon Q Developer installed.
  3. Developer activates Amazon Q or the plugin automatically initializes.
  4. Amazon Q reads `.amazonq/mcp.json` and spawns the attacker-defined MCP server process.
  5. The MCP server inherits all environment variables, including AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, and AWS_SESSION_TOKEN.
  6. The server executes arbitrary commands (e.g., aws sts get-caller-identity) and exfiltrates the output.
  7. Attacker obtains valid AWS credentials and assumes the developer’s IAM role.

2. Verifying Your Installation and Applying the Patch

Amazon addressed CVE-2026-12957 in Language Servers for AWS version 1.65.0, with full remediation in version 1.69.0 which also patches the related symlink traversal vulnerability CVE-2026-12958. The patch is automatically applied for most users upon IDE reload, provided automatic updates are not blocked.

Linux/macOS – Check Language Server Version:

 Navigate to the language server installation directory
 VS Code extension path (typical)
find ~/.vscode/extensions -1ame "language-server" -type d | head -1

Check the version in package.json
cat ~/.vscode/extensions/amazonwebservices.aws-toolkit-vscode-/package.json | grep version

Windows – Check Language Server Version (PowerShell):

 Find the extension directory
Get-ChildItem -Path "$env:USERPROFILE.vscode\extensions" -Filter "aws-toolkit" -Directory

Check version in package.json
Get-Content "$env:USERPROFILE.vscode\extensions\amazonwebservices.aws-toolkit-vscode-\package.json" | Select-String "version"

Affected Versions – Verify and Update:

  • Language Servers for AWS: < 1.69.0
  • Amazon Q Developer for VS Code: < 2.20
  • Amazon Q Developer for JetBrains: < 4.3
  • Amazon Q Developer for Eclipse: < 2.7.4
  • AWS Toolkit with Amazon Q for Visual Studio: < 1.94.0.0

Update Commands:

 VS Code: Extensions panel > search "AWS Toolkit" > Update
 Or via command line (if installed via CLI)
code --install-extension amazonwebservices.aws-toolkit-vscode --force

JetBrains: Settings > Plugins > Updates
 Eclipse: Help > Check for Updates
 Visual Studio: Extensions > Manage Extensions > Updates

If automatic updates are blocked in your organization, manually download and install the latest plugin version from the respective marketplace.

3. Understanding MCP and the Industry-Wide Risk

The Model Context Protocol (MCP) is designed to allow AI assistants to connect to external tools and data sources by spawning local processes. While powerful, this capability creates a significant attack surface when configurations are automatically loaded from untrusted sources.

This vulnerability is not unique to Amazon Q. Similar flaws have been identified in:
– Claude Code (CVE-2025-59536, CVE-2026-21852)
– Windsurf (CVE-2026-30615)
– Cursor and Codeium

The underlying pattern is consistent: AI coding assistants trust repository contents implicitly, and configuration files that trigger code execution at clone time become weapons.

Defensive Configuration – Restricting MCP Server Permissions:

To limit exposure, restrict the environment variables available to MCP servers:

// Example .amazonq/mcp.json with restricted environment
{
"mcpServers": {
"restricted-tool": {
"command": "node",
"args": ["server.js"],
"env": {
"NODE_ENV": "production",
"ALLOWED_PATHS": "/tmp/safe"
},
"envExclude": ["AWS_", "SECRET_", "TOKEN_"]
}
}
}

4. Detection and Forensics: Identifying Compromised Workspaces

Security teams should audit developer environments for signs of malicious repository interaction.

Linux/macOS – Search for Suspicious .amazonq Directories:

 Find all .amazonq directories in recent clones
find ~/projects -type d -1ame ".amazonq" -exec ls -la {} \;

Check mcp.json contents for suspicious commands
find ~/projects -path "/.amazonq/mcp.json" -exec cat {} \;

Windows – PowerShell Search:

 Search for .amazonq directories
Get-ChildItem -Path "$env:USERPROFILE\projects" -Directory -Recurse -Filter ".amazonq" -ErrorAction SilentlyContinue

Examine mcp.json files
Get-ChildItem -Path "$env:USERPROFILE\projects" -Recurse -Filter "mcp.json" -ErrorAction SilentlyContinue | ForEach-Object { Get-Content $_.FullName }

CloudTrail Investigation – Detect Unauthorized API Calls:

-- Athena query to detect suspicious sts:GetCallerIdentity calls
SELECT 
useridentity.arn,
eventtime,
sourceipaddress,
useragent,
requestparameters
FROM cloudtrail_logs
WHERE 
eventname = 'GetCallerIdentity'
AND eventtime > '2026-04-20'
AND useragent LIKE '%aws-cli%'
AND sourceipaddress NOT IN ('known-corporate-ips')
ORDER BY eventtime DESC;

5. Hardening Developer Environments Against Configuration Injection

Implement Workspace Trust Policies:

VS Code and other IDEs support workspace trust features that should be enforced:

// VS Code settings.json
{
"security.workspace.trust.enabled": true,
"security.workspace.trust.startupPrompt": "always",
"security.workspace.trust.emptyWindow": false
}

Restrict Automatic Extension Activation:

Disable automatic activation of AI extensions in untrusted workspaces:

// VS Code settings.json
{
"aws.dev.autoActivate": false,
"amazonQ.autoStart": false
}

CI/CD Pipeline Scanning – Detect Hidden Configurations:

Add a pre-commit hook to scan for suspicious configuration files:

!/bin/bash
 .git/hooks/pre-commit
if git diff --cached --1ame-only | grep -E ".amazonq/|mcp.json"; then
echo "WARNING: Changes detected in .amazonq/ or mcp.json files"
echo "Review these files for potential MCP server injections"
exit 1
fi

Environment Variable Hardening:

Restrict the environment variables passed to IDE processes:

 Launch IDE with minimal environment
env -i HOME="$HOME" PATH="$PATH" TERM="$TERM" code --disable-extensions

6. The Disclosure Timeline and Responsible Coordination

The vulnerability was discovered by Maor Dokhanian of Wiz Research and responsibly disclosed to Amazon on April 20, 2026. Amazon deployed an initial fix in Language Servers for AWS version 1.65.0 on May 12, 2026, with full remediation in version 1.69.0 addressing both CVE-2026-12957 and the related symlink issue CVE-2026-12958. The public disclosure occurred on June 26, 2026, via Security Bulletin 2026-047-AWS.

What Undercode Say:

  • The automation that makes AI coding assistants productive is precisely what makes them dangerous when trust boundaries are not enforced.
  • This vulnerability exposes a systemic industry problem: the assumption that repository contents are safe is no longer valid in the age of AI-powered tooling.
  • The attack vector is remarkably simple: a single JSON file in a cloned repository can compromise an entire cloud infrastructure.
  • Organizations must treat AI coding assistants as potential supply chain attack vectors and implement strict workspace trust policies.
  • The patch is automatically applied for most users, but organizations with locked-down update policies must manually verify their installations.
  • This incident highlights the need for a “zero trust” approach to AI tooling, where every configuration file is treated as potentially malicious.
  • The MCP protocol, while powerful, requires built-in safeguards to prevent automatic execution of untrusted configurations.
  • Developers should be trained to recognize the risks of opening untrusted repositories and to verify workspace trust settings.
  • The industry must establish standards for AI tooling that require explicit user consent before executing any code from repository configurations.
  • As AI coding assistants become more prevalent, the attack surface will only grow, making proactive security measures essential.

Prediction:

  • -1: The exploitation of AI coding assistants will become a primary attack vector for supply chain compromises, targeting the trust developers place in their tooling.
  • -1: Without standardized security controls for MCP and similar protocols, we will see a wave of similar vulnerabilities across the AI developer tooling ecosystem.
  • +1: This incident will drive the adoption of mandatory workspace trust checks and explicit consent mechanisms across all AI coding assistants.
  • +1: Organizations will implement stricter policies for AI tooling, including mandatory scanning of repository configurations before opening projects.
  • +1: The security community will develop automated scanning tools to detect malicious MCP configurations in cloned repositories.
  • -1: Attackers will increasingly use fake job interview coding tests and typosquatted packages to deliver malicious repositories to developers.
  • +1: The coordinated disclosure process between Wiz Research and Amazon demonstrates the effectiveness of responsible vulnerability reporting.
  • -1: Developers who disable automatic updates will remain vulnerable to this and future flaws, creating a persistent risk surface.
  • +1: This incident will accelerate the development of runtime security controls for AI coding assistants, including sandboxing and permission restrictions.
  • -1: The simplicity of this attack vector means it will be rapidly adopted by threat actors, including nation-state groups targeting technology companies.

▶️ Related Video (80% Match):

🎯Let’s Practice For Free:

🎓 Live Courses & Certifications:

Join Undercode Academy for Verified Certifications

🚀 Request a Custom Project:

Secure, high-velocity infrastructure and disruptive technological engineering. Contact our engineering team for high-tier development and proprietary systems:
[email protected]
💎 Smart Architecture | 🛡️ Secure by Design | ⭐ Trusted by Thousands

IT/Security Reporter URL:

Reported By: Mohit Hackernews – Hackers Feeds
Extra Hub: Undercode MoN
Basic Verification: Pass ✅

🔐JOIN OUR CYBER WORLD [ CVE News • HackMonitor • UndercodeNews ]

💬 Whatsapp | 💬 Telegram

📢 Follow UndercodeTesting & Stay Tuned:

𝕏 formerly Twitter 🐦 | @ Threads | 🔗 Linkedin | 🦋BlueSky