Summary
A critical input-handling vulnerability in LocalStack allows crafted content hosted at a web-accessible URL to be processed through the CloudFormation deployment endpoint. If an attacker can cause a malicious URL to be supplied as templateURL, the content may execute arbitrary code within the Docker container.
A critical input-handling vulnerability in LocalStack allows crafted content hosted at a web-accessible URL to be processed through the CloudFormation deployment endpoint. If an attacker can cause a malicious URL to be supplied as templateURL, the content may execute arbitrary code within the Docker container.
Affected context
The issue affects LocalStack deployments that expose or otherwise permit access to the _localstack/cloudformation/deploy endpoint and accept externally controlled templateURL values. Risk is higher when the service can reach attacker-controlled web content and the container has sensitive credentials, mounted files, network access, or elevated privileges.
The issue affects LocalStack deployments that expose or otherwise permit access to the _localstack/cloudformation/deploy endpoint and accept externally controlled templateURL values. Risk is higher when the service can reach attacker-controlled web content and the container has sensitive credentials, mounted files, network access, or elevated privileges.
Exploit preconditions
- Attack surface: The LocalStack CloudFormation deployment endpoint
- Required access: The ability to submit or influence a deployment request containing a
templateURL - Trigger point: Retrieval and processing of content referenced by the supplied URL
- Why exploitation is possible: Attacker-controlled content is trusted during template handling and may be interpreted in a way that permits code execution inside the container
- Attack surface: The LocalStack CloudFormation deployment endpoint
- Required access: The ability to submit or influence a deployment request containing a
templateURL - Trigger point: Retrieval and processing of content referenced by the supplied URL
- Why exploitation is possible: Attacker-controlled content is trusted during template handling and may be interpreted in a way that permits code execution inside the container
Why this happens
The underlying flaw is insufficient neutralization and trust-boundary enforcement for externally supplied template content. A remote URL is accepted as deployment input without adequately ensuring that the retrieved content is limited to a safe, expected template representation. This behavior aligns with CWE-79: Improper Neutralization of Input During Web Page Generation, while the resulting execution path also reflects broader script or code injection risks.
The underlying flaw is insufficient neutralization and trust-boundary enforcement for externally supplied template content. A remote URL is accepted as deployment input without adequately ensuring that the retrieved content is limited to a safe, expected template representation. This behavior aligns with CWE-79: Improper Neutralization of Input During Web Page Generation, while the resulting execution path also reflects broader script or code injection risks.
Potential impact
- Arbitrary code execution within the LocalStack Docker container
- Exposure of environment variables, mounted files, or service credentials
- Modification of emulated cloud resources and deployment state
- Unauthorized access to reachable internal services
- Container compromise that could support further lateral movement
- Arbitrary code execution within the LocalStack Docker container
- Exposure of environment variables, mounted files, or service credentials
- Modification of emulated cloud resources and deployment state
- Unauthorized access to reachable internal services
- Container compromise that could support further lateral movement
General mitigation guidance
Mitigation generally focuses on reducing trust in remote template references and ensuring that template processing cannot interpret attacker-controlled content as executable logic.
Common defensive patterns include:
- Prefer validated, locally controlled template sources over arbitrary remote URLs
- Apply strict allowlists for permitted hosts, schemes, redirects, and content types
- Enforce schema validation and content-size limits before template processing
- Use parsers and execution paths that treat template data as inert data
- Restrict container privileges, filesystem access, credentials, and outbound network connectivity
- Require authentication and authorization for deployment endpoints
- Isolate development emulators from sensitive production networks and secrets
Mitigation generally focuses on reducing trust in remote template references and ensuring that template processing cannot interpret attacker-controlled content as executable logic.
Common defensive patterns include:
- Prefer validated, locally controlled template sources over arbitrary remote URLs
- Apply strict allowlists for permitted hosts, schemes, redirects, and content types
- Enforce schema validation and content-size limits before template processing
- Use parsers and execution paths that treat template data as inert data
- Restrict container privileges, filesystem access, credentials, and outbound network connectivity
- Require authentication and authorization for deployment endpoints
- Isolate development emulators from sensitive production networks and secrets
How teams detect issues like this
Organizations can look for this weakness through:
- Static analysis and code review checks for deployment endpoints that accept remote URLs
- Review of URL-fetching logic, redirect handling, content validation, and template evaluation
- Dynamic testing with controlled external resources and benign non-executable marker content
- Web and container logs showing unusual requests to the deployment endpoint or unexpected outbound connections
- Policy enforcement that blocks unapproved remote template locations and restricts container egress
Automated security review tools may help identify unsafe input flows and remote-content processing patterns.
Organizations can look for this weakness through:
- Static analysis and code review checks for deployment endpoints that accept remote URLs
- Review of URL-fetching logic, redirect handling, content validation, and template evaluation
- Dynamic testing with controlled external resources and benign non-executable marker content
- Web and container logs showing unusual requests to the deployment endpoint or unexpected outbound connections
- Policy enforcement that blocks unapproved remote template locations and restricts container egress
Automated security review tools may help identify unsafe input flows and remote-content processing patterns.
Sources
| Source | Link |
|---|---|
| localstack. | localstack.com |
| cyberroute. | cyberroute.github.io/ |
| github. | github.com/ |
| github. | github.com/ |

