Incus container environment configuration newline injection
lxc incus
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| github.com/lxc/incus/v6 Go |
|
|
| github.com/lxc/incus Go |
| No fix yet |
lxc incus
| Product | Affected | Fixed in |
|---|---|---|
| github.com/lxc/incus/v6 Go |
|
|
| github.com/lxc/incus Go |
| No fix yet |
Incus is a system container and virtual machine manager. In versions 6.20.0 and below, a user with the ability to launch a container with a custom YAML configuration (e.g a member of the ‘incus’ group) can create an environment variable containing newlines, which can be used to add additional configuration items in the container’s lxc.conf due to newline injection. This can allow adding arbitrary lifecycle hooks, ultimately resulting in arbitrary command execution on the host. Exploiting this issue on IncusOS requires a slight modification of the payload to change to a different writable directory for the validation step (e.g /tmp). This can be confirmed with a second container with /tmp mounted from the host (A privileged action for validation only). A fix is planned for versions 6.0.6 and 6.21.0, but they have not been released at the time of publication.
From the CVE record · GitHub_M
Incus 6.20.0 and below allows a user who can launch a container with custom YAML configuration, such as a member of the incus group, to inject newlines into an environment variable. This can add lifecycle hooks to the container’s lxc.conf and lead to arbitrary command execution on the host. The attacker needs container-launch privileges; no additional user interaction is described.
Check Incus installations running version 6.20.0 or below and users of the Go packages github.com/lxc/incus/v6 (versions 6.1.0 through those below 6.21.0) or github.com/lxc/incus (all versions).