7.0high
OS Command Injection in aws-cdk-lib Docker Bundling
- Severity
- 7.0high CVSS:4.0 by AMZN
- Exploit likelihood
- 0.85% (higher than 59% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- AMZN
- Also known as
- GHSA-vcrf-j523-4mrf
Description
OS command injection in the NodejsFunction Docker bundling pipeline (OsCommand helper) in AWS aws-cdk-lib on all platforms might allow a actor who controls dependency version strings in a project's package.json file to execute arbitrary commands on the host running the CDK toolchain via injected shell metacharacters in the OsCommand helper. This issue requires the actor to control the content of a package.json dependency version string that is processed during Docker-based bundling with nodeModules specified. To remediate this issue, users should upgrade to v2.260.0.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| AWS AWS CDK | before 2.260.0 | CVE List |
| aws-cdk-lib (npm) | before 2.260.0 | GitHub Advisory Database |
All scores
| AMZN | 7.3high CVSS:3.1 | CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:H |
| AMZN | 7.0high CVSS:4.0 | CVSS:4.0/AV:L/AC:L/AT:N/PR:L/UI:A/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N |
| GitHub | 7.3high CVSS:3.1 | CVSS:3.1/AV:L/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:H |
| GitHub | high CVSS:4.0 | CVSS:4.0/AV:L/AC:L/AT:N/PR:L/UI:A/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N |
Classification
SSVC (CISA-ADP): exploitation none, automatable no, technical impact total.
What each source says
CVE List
OS command injection in the NodejsFunction Docker bundling pipeline (OsCommand helper) in AWS aws-cdk-lib on all platforms might allow a actor who controls dependency version strings in a project's package.json file to execute arbitrary commands on the host running the CDK toolchain via injected shell metacharacters in the OsCommand helper. This issue requires the actor to control the content of a package.json dependency version string that is processed during Docker-based bundling with nodeModules specified. To remediate this issue, users should upgrade to v2.260.0.
GitHub Advisory Database
Summary
AWS CDK (aws-cdk-lib) is an open-source framework for defining cloud infrastructure in code and provisioning it through AWS CloudFormation. OS command injection issue in the NodejsFunction Docker bundling pipeline in aws-cdk-lib before 2.260.0 that might allow an actor who controls dependency version strings in a project's package.json file to execute arbitrary commands on the host running the CDK toolchain via injected shell metacharacters in the OsCommand helper. This issue requires the actor to control the content of a package.json dependency version string that is processed during Docker-based bundling with nodeModules specified.
Impact
During Docker-based Lambda bundling, when the nodeModules option is specified, NodejsFunction assembled a shell command string, including file-operation commands generated by an internal OsCommand helper, from the version strings of the modules listed in nodeModules, and executed it via a shell (bash -c) inside the bundling container. These version strings were interpolated without shell escaping, so values containing shell metacharacters could execute arbitrary commands inside the bundling container - which has read/write bind mounts to the host filesystem - with the privileges of the user running cdk synth, cdk deploy, or cdk diff. Leveraging this issue requires an actor to control a dependency version string for one of the listed modules - for example via an untrusted npm package referenced through nodeModules.
Impacted versions:
< 2.260.0
Patches
This issue has been addressed in aws-cdk-lib version 2.260.0 (PR #38133). We recommend upgrading to the latest version and ensuring any forked or derivative code is patched to incorporate the new fixes.
Workarounds
Ensure that the modules listed in the nodeModules bundling option - and the version strings declared for them in your project's package.json, as well as the versions of the corresponding installed packages - come only from trusted sources, and audit third-party constructs and dependencies that introduce them. Using local bundling instead of Docker-based bundling avoids the affected code path. Upgrading to a fixed version is the recommended remediation.
References
If you have any questions or comments about this advisory, we ask that you contact AWS Security via our vulnerability reporting page or directly via email to aws-security@amazon.com. Please do not create a public GitHub issue.
Acknowledgement
We would like to thank the external researcher Mostafa Ashraf who reported this issue through the AWS Vulnerability Disclosure Program (HackerOne @kaporia) for collaborating on it through the coordinated vulnerability disclosure process.
NVD (es)
La inyección de comandos del sistema operativo en la canalización de empaquetado Docker de NodejsFunction (ayudante OsCommand) en AWS aws-cdk-lib en todas las plataformas podría permitir a un actor que controla las cadenas de versión de las dependencias en el archivo package.json de un proyecto ejecutar comandos arbitrarios en el host que ejecuta la cadena de herramientas de CDK mediante metacaracteres de shell inyectados en el ayudante OsCommand. Este problema requiere que el actor controle el contenido de una cadena de versión de dependencia de package.json que se procesa durante el empaquetado basado en Docker con nodeModules especificado. Para remediar este problema, los usuarios deben actualizar a la v2.260.0.
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2026-13760 changed 2026-07-01 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-vcrf-j523-4mrf changed 2026-07-21 | CC-BY-4.0 |
| NVD | CVE-2026-13760 changed 2026-10-25 | Public domain |