GHSA-4hq8-gpf5-8p68: Infoleak
Summary
An container image that contains a environment variable with just a key and no value can trick podman into passing that variable from the host into the container. This is made worse by the fact that using an asterisk () will cause podman to pass all host variables into the container. So essentially a malicious image can exfiltrate all podman environment variables that are set in the session from where the container is launched.
Details
podman run allows --env VAR1 or --env VAR which will read the variable values from the current environment and then passes them into the container. However because the same parsing logic was reused for the image config env section that means that an image variable could also gain access to that.
Patch
That image spec requires the env variables to be in the form of key=value, so to address this invalid formatted variables get rejected and the container will not run.
Fixed in https://github.com/podman-container-tools/podman/commit/6c431b73dbf8e4b20b778644d7a80caebdb75050
Workaround
Do not run untrusted images. Before running an image consider inspecting the config with podman image inspect --format '{{.Config.Env}}' <image> and check for any variables that do not have a value assigned.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
go/go.podman.io/podman/v6to a version that resolves this vulnerability.Fixed in 6.0.0 - Upgrade
Upgrade
go/github.com/containers/podman/v5to a version that resolves this vulnerability.Fixed in 5.8.4 - Upgrade
Upgrade
podmanto a version that resolves this vulnerability.Patch 6c431b73dbf8e4b20b778644d7a80caebdb75050 - Compensating control
Do not run untrusted container images.
- Operational
Before running an image, inspect its environment configuration with `podman image inspect --format '{{.Config.Env}}' <image>` and check for variables that have no value assigned.
Event History
Frequently Asked Questions
What does an attacker need to exploit this issue?
The attacker needs to persuade a user to run a malicious container image whose image configuration contains an invalid environment-variable entry with a key but no value. An asterisk in such an entry can cause Podman to pass all environment variables from the session that launched the container.
What information could be exposed?
A malicious container can receive Podman environment variables set in the session from which it is launched. Those variables may then be exfiltrated by the container.
How can I check an image before running it?
Inspect its configured environment variables with `podman image inspect --format '{{.Config.Env}}' <image>`. Look for entries that are not in `key=value` form, especially entries using an asterisk.
What can I do if I cannot apply the fix immediately?
Do not run untrusted images. Inspect image environment-variable configuration before execution and avoid images containing invalid entries without an equals sign.
What changes after applying the fix?
Invalid image environment-variable entries that do not use the required `key=value` format are rejected, and the container will not run.