Summary
Podman incorrectly propagates host environment variables into containers when images define variables with a key but no value or use wildcard patterns.
A malicious container image can leverage this behavior to exfiltrate sensitive session-specific environment data from the host into the container, becoming risky whenever untrusted images are run.
Affected context
This vulnerability occurs when Podman is used to run OCI container images that declare environment variables with a key but no associated value, or that include wildcard notation in their environment configuration.
In such scenarios, Podman may unintentionally treat these declarations as instructions to copy corresponding environment variables from the host session into the container, including potentially sensitive values like credentials, tokens, and configuration secrets.
The risk is most pronounced in workflows that run images from untrusted or semi-trusted registries, automated pipelines, or shared development environments where host environment variables contain confidential information.
Exploit preconditions
- Attack surface: Podman runtime environment when launching containers from crafted images.
- Required access: Ability to supply or influence the container image being run (e.g., publishing a malicious image, compromising a registry, or influencing image selection).
- Trigger point: Container start-up, where Podman processes environment directives from the image and merges them with the host environment.
- Why exploitation is possible: Podman interprets environment keys without values or wildcard patterns as instructions to import corresponding environment variables from the host session, unintentionally exposing host-side secrets to the container.
Why this happens
The underlying issue is an unsafe environment propagation pattern in the container runtime that blends host and container environments without strict separation or explicit consent.
Podman's logic for handling environment variables defined in images treats key-only variables and wildcard specifications as cues to copy host variables into the container, violating the expected isolation between host and container execution contexts.
This maps primarily to CWE-200: Exposure of Sensitive Information to an Unauthorized Actor, since sensitive host data becomes accessible inside the container, and to CWE-668: Exposure of Resource to Wrong Sphere, as host environment resources are unintentionally exposed to the container's security domain.
Potential impact
- A malicious container can read and exfiltrate host environment variables present in the launching session.
- Credentials, API keys, OAuth tokens, and other secrets stored in environment variables may be leaked.
- Configuration details such as endpoints, feature flags, or internal network information can be exposed.
- Attackers may pivot using leaked secrets to access back-end services, CI/CD systems, or cloud resources.
- Privacy and compliance violations can occur if regulated data is embedded in environment variables.
General mitigation guidance
Mitigation patterns focus on reducing trust in container images and tightening boundaries between host and container environments.
Common approaches include:
- Designing container runtime configurations so that host environment variables are not implicitly imported; favor explicit, minimal environment whitelists per container.
- Treating environment variables as sensitive assets, avoiding storage of long-lived secrets in generic shell sessions, and isolating secret-bearing environments from day-to-day Podman usage.
- Applying least-privilege principles to environment injection, only passing specific, necessary values to containers rather than broad patterns.
- Using hardened base images and image policies that avoid ambiguous or wildcard-based environment declarations.
- Employing external secret management systems instead of relying on host environment variables to supply confidential data to containers.
How teams detect issues like this
Effective detection typically combines configuration analysis with runtime inspection:
- Static review of container images (Dockerfiles, Containerfiles) and metadata to identify environment variables defined without values or using wildcard-like patterns that could cause host environment importing.
- Code review and policy checks in CI/CD pipelines to enforce strict environment-passing rules, flagging broad or implicit environment mappings.
- Automated tools or scripts that analyze Podman run configurations and wrappers for unsafe environment propagation (e.g., excessive use of
--envor patterns that mirror the host environment). - Runtime audits and logs to track which environment variables are visible inside containers, correlating unusual exposure with image configurations.
- Organizational policies that require security sign-off on new images, especially those sourced from external registries, focusing on how they handle environment variables.

