PoC Archive PoC Archive
High CVE-2026-11417 patched

Supply Chain Command Injection in AWS CDK's NodejsFunction — CVE-2026-11417

by Hesham Ashraf (HeshamASH) · 2026-07-05

CVSS 3.1/10
Severity
High
CVE
CVE-2026-11417
Category
cloud
Affected product
aws-cdk-lib (npm package), NodejsFunction L2 construct
Affected versions
All versions prior to 2.245.0
Disclosed
2026-07-05
Patch status
patched

Metadata

FieldValue
Date Added2026-07-05
Last Updated2026-06
Author / ResearcherHesham Ashraf (HeshamASH)
CVE / AdvisoryCVE-2026-11417
Categorycloud
SeverityHigh
CVSS ScoreCVSSv3.1: 7.3, CVSSv4: 7.0
StatusPoC
Tagsaws, cdk, supply-chain, command-injection, esbuild, nodejs, ci-cd, rce
RelatedN/A

Affected Target

FieldValue
Software / Systemaws-cdk-lib (npm package), NodejsFunction L2 construct
Versions AffectedAll versions prior to 2.245.0
Language / PlatformTypeScript/Node.js, runs on any machine executing cdk synth (dev workstations, CI/CD)
Authentication RequiredNo
Network Access RequiredNo (local build-time execution, though impact is typically delivered via a supply-chain vector)

Summary

The AWS CDK NodejsFunction construct bundles Lambda handlers with esbuild during cdk synth, and prior to 2.245.0 it built the esbuild invocation by directly interpolating several user/construct-controlled properties (externalModules, loader, define, inject, esbuildArgs) into a single shell command string that was then executed via bash -c / cmd /c. Because none of these properties were sanitized for shell metacharacters, a value such as foo & echo PWNED > pwned.txt placed in externalModules would split the command and execute the attacker’s payload as a second, independent shell command. This made it possible for a malicious or compromised third-party CDK construct (published to npm or submitted via PR) to achieve arbitrary command execution on any machine that ran cdk synth, entirely bypassing install-time defenses like npm audit or --ignore-scripts since the injection fires at synthesis time rather than install time. The included PoC is a minimal CDK app that sets a poisoned externalModules entry and confirms RCE by checking for a marker file written by the injected command.


Vulnerability Details

Root Cause

bundling.ts in aws-cdk-lib’s aws-lambda-nodejs module joined an array of esbuild CLI arguments (some built from unsanitized construct properties) into a single string and passed it to bash -c / cmd /c, allowing shell metacharacters (&, ;, |, backticks, $()) in those properties to be interpreted by the shell.

Attack Vector

  1. Attacker publishes (or contributes via PR) a CDK construct/npm package that wraps NodejsFunction and sets an externalModules/loader/define/inject/esbuildArgs value containing shell metacharacters and a payload command.
  2. A developer imports the construct and runs cdk synth (or cdk deploy, which synths first) locally or in CI/CD.
  3. CDK builds the esbuild bundling command by string concatenation and executes it via a shell, causing the injected payload (e.g. exfiltrating ~/.aws/credentials) to run alongside the legitimate esbuild invocation.
  4. Attacker collects exfiltrated data or achieves further code execution on the build host.

Impact

Arbitrary OS command execution on any developer machine or CI/CD runner performing CDK synthesis, enabling theft of AWS credentials, source code, or further pipeline compromise.


Environment / Lab Setup

Target:   aws-cdk-lib 2.244.0 (pre-patch) via a local CDK TypeScript project
Attacker: Node.js 18/20, npm, ts-node, aws-cdk-lib, constructs, esbuild

Proof of Concept

PoC Script

See poc/app.ts, poc/lambda/handler.ts, and poc/package.json in this folder.

1
2
3
4
cd poc
npm install
npm run poc   # runs `ts-node app.ts`
cat ../pwned.txt

app.ts defines a NodejsFunction whose bundling.externalModules contains foo & echo CVE-2026-11417 PWNED > ../pwned.txt. Running CDK synthesis on the vulnerable aws-cdk-lib version triggers the injected echo command, writing pwned.txt in the parent directory to confirm command execution.


Detection & Indicators of Compromise

Signs of compromise:

  • Unexplained files or network callouts appearing during cdk synth/cdk deploy runs
  • CI/CD logs showing esbuild invocations followed by unrelated shell commands (curl, cat ~/.aws/credentials, etc.)
  • Newly introduced or updated third-party CDK constructs with unusual bundling configuration values

Remediation

ActionDetail
Primary fixUpdate to aws-cdk-lib 2.245.0 or later, which replaced shell-based exec with array-based spawnSync (no shell interpretation)
Interim mitigationAudit third-party CDK constructs for unusual bundling property values, pin construct versions in the lockfile, and review PRs that touch bundling configuration with extra scrutiny

References


Notes

Mirrored from https://github.com/HeshamASH/CVE-2026-11417-AWS-CDK-RCE on 2026-07-05.