/

CVE-2026-13760

Severity:

HIGH RISK

(7.3)

OS Command Injection (CWE-78) in AWS CDK Docker Build

CVE-2026-13760

Awaiting Analysis

Vulnerability type

Category:

OS Command Injection

CWE:

CWE-78

Impact:

Arbitrary Command Execution on Build Host

Severity:

HIGH RISK

(7.3)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

An OS command injection vulnerability in the AWS CDK NodejsFunction Docker bundling pipeline allows crafted dependency version strings in package.json to be interpreted as shell commands.

If an actor can influence package.json dependency versions used during Docker-based bundling with nodeModules, they may execute arbitrary commands on the host running the CDK toolchain.

Affected context

This vulnerability appears in development or CI/CD environments where AWS CDK projects use the NodejsFunction construct with Docker-based bundling and the nodeModules option configured.

It becomes relevant when dependency version strings in package.json are dynamically sourced, modified by external parties, or otherwise not fully trusted.

The issue resides in the OsCommand helper used during bundling, where dependency version strings are incorporated into shell commands without robust escaping or neutralization.

Exploit preconditions

  • Attack surface: The CDK build and deployment pipeline, including local developer machines and CI/CD runners that execute cdk commands.
  • Required access: Ability to control or modify package.json dependency version strings that are processed by Docker-based NodejsFunction bundling.
  • Trigger point: Running the CDK toolchain such as cdk synth, cdk deploy, or other commands that invoke NodejsFunction bundling with nodeModules specified.
  • Why exploitation is possible: The OsCommand helper incorporates untrusted dependency version values into shell commands executed by the host environment, allowing shell metacharacters in version strings to alter command structure and inject arbitrary commands.

Why this happens

The underlying bug follows the OS command injection pattern described by CWE-78.

Instead of treating dependency version strings as opaque data, the OsCommand helper composes shell commands by concatenating or interpolating these values directly into command lines.

Shells interpret characters like ;, &&, |, and backticks as control operators, so unescaped or improperly validated input can break out of the intended command context.

At a higher level, this reflects a trust boundary failure: metadata derived from package.json, which may be influenced by external sources, is implicitly trusted as safe to embed in commands executed on the host.

Potential impact

  • Arbitrary command execution on the developer workstation or CI/CD runner executing the CDK toolchain
  • Theft or exposure of credentials, access tokens, and cloud configuration present on the build host
  • Tampering with generated CloudFormation templates or deployment artifacts
  • Lateral movement within the development or CI/CD environment
  • Planting backdoors or malicious dependencies in the project or build outputs

General mitigation guidance

Mitigation typically focuses on treating all command components as untrusted data and avoiding shell interpretation wherever possible.

Helpful defensive patterns include:

  • Constructing process invocations using parameterized APIs (e.g., exec variants that take argument arrays) instead of building shell command strings.
  • Applying strict validation to dependency version strings, limiting them to an allowed character set and expected patterns rather than filtering out "bad" characters.
  • Performing escaping/quoting at the API boundary when interaction with a shell is unavoidable, using well-tested escaping routines rather than ad-hoc concatenation.
  • Reducing trust in package.json sources by reviewing dependency updates and avoiding automatic ingestion from unvetted channels.
  • Running build and bundling steps under least-privilege accounts and isolated environments (such as minimal-permission CI jobs or dedicated build containers) to contain impact if a command is injected.

How teams detect issues like this

Detection strategies generally aim to surface insecure command construction and unusual behavior during builds.

Common approaches include:

  • Static analysis rules that flag string concatenation or interpolation used to build shell commands, especially when including data from configuration files like package.json.
  • Targeted code review focusing on helper utilities that wrap OS command execution (e.g., "OsCommand" abstractions), checking for robust argument handling and escaping.
  • Build pipeline policies that monitor for unexpected environment changes, network calls, or process spawns during bundling steps.
  • Optional use of automated security scanners or linters integrated into CI, configured to detect CWE-78 patterns and unsafe uses of child process APIs.

Sources

SourceLink
aws.amazon.comaws.amazon.com/security/security-bulletins/2026-050-aws/
github.comgithub.com/aws/aws-cdk/releases/tag/v2.260.0
github.comgithub.com/aws/aws-cdk/security/advisories/GHSA-vcrf-j523-4mrf

Frequently asked

questions

Not directly. Exploitation typically occurs through manipulation of package.json dependency version strings that the CDK build process consumes, which may be influenced by source control changes or dependency automation rather than by direct network access.

An attacker needs the ability to control or modify the dependency version fields in the project's package.json that participate in the Docker-based NodejsFunction bundling process, such as via a pull request, compromised repository, or poisoned source for project templates.

The safest pattern is to avoid invoking a shell with concatenated command strings and instead use APIs that accept command arguments as structured arrays, combined with strict validation of any configuration-derived values passed to OS-level processes.

Design build helpers so they treat configuration data as untrusted by default, validate and constrain formats before use, avoid shell interpretation when possible, and enforce secure coding policies (including automated checks) for any utility that spawns external processes as part of the toolchain.

Find out what's already
exploitable in your codebase.