An open API service providing security vulnerability metadata for many open source software ecosystems.

GSA_kwCzR0hTQS1qM3J3LWZ4NmctcTQ2as4ABPH7

Moderate EPSS: 0.00016% (0.02693 Percentile) EPSS:

Apptainer ineffectively applies selinux and apparmor --security options

Affected Packages Affected Versions Fixed Versions
go:github.com/apptainer/apptainer
PURL: pkg:go/github.com%2Fapptainer%2Fapptainer
< 1.4.5 1.4.5
0 Dependent packages
4 Dependent repositories

Affected Version Ranges

All affected versions

v0.1.0, v0.1.1, v1.0.0, v1.0.0-rc.1, v1.0.0-rc.2, v1.0.0-rc.2.1, v1.0.0-rc.2.2, v1.0.0-rc.2.3, v1.0.0-rc.2-2, v1.0.0-rc.2-3, v1.0.1, v1.0.2, v1.0.3, v1.1.0, v1.1.0-rc.1, v1.1.0-rc.2, v1.1.0-rc.3, v1.1.1, v1.1.2, v1.1.3, v1.1.4, v1.1.5, v1.1.6, v1.1.7, v1.1.8, v1.1.9, v1.2.0, v1.2.0-rc.1, v1.2.0-rc.2, v1.2.1, v1.2.2, v1.2.3, v1.2.4, v1.2.5, v1.3.0, v1.3.0-rc.1, v1.3.0-rc.2, v1.3.1, v1.3.2, v1.3.3, v1.3.4, v1.3.5, v1.3.6, v1.4.0, v1.4.0-rc.1, v1.4.0-rc.2, v1.4.1, v1.4.2, v1.4.3, v1.4.4

All unaffected versions

v1.4.5

Impact

In Apptainer versions less than 1.4.5, a container can disable two of the forms of the little used --security option, in particular the forms --security=apparmor:<profile> and --security=selinux:<label> which otherwise put restrictions on operations that containers can do. The --security option has always been mentioned in Apptainer documentation as being a feature for the root user, although these forms do also work for unprivileged users on systems where the corresponding feature is enabled. Apparmor is enabled by default on Debian-based distributions and SElinux is enabled by default on RHEL-based distributions, but on SUSE it depends on the distribution version.

In addition, a bug in the detection of selinux support in Apptainer's suid mode means that --security selinux:<label> flags may not be applied, even in the absence of an attack. In that case a warning message is emitted indicating that selinux is unavailable, but the warning may be may be overlooked, mis-interpreted, or not seen when apptainer is run from a script or other tool. Failure to apply requested restrictions should result in a fatal error rather than just a warning message.

Patches

Ineffective write of selinux process labels is addressed via an update to the containers/selinux dependency in https://github.com/apptainer/apptainer/pull/3226. That update brings in the upstream fix for https://github.com/advisories/GHSA-cgrx-mc8f-2prm which was for a different but related vulnerability.

Ineffective write of apparmor process profiles is addressed in commit 4313b42.

Failure to detect apparmor / selinux support, when --security flags are provided, is made an error rather than a warning in commit 82f1790.

Workarounds

There are no known workarounds, other than to define system-wide apparmor / selinux policy for Apptainer itself. This would apply to all containers, not just those run with the --security flags, and could impact the operation of Apptainer itself.

References

Thanks to Sylabs for finding this issue, fixing it in https://github.com/sylabs/singularity/security/advisories/GHSA-wwrx-w7c9-rf87 which was easy to import into Apptainer, and disclosing it early to the Apptainer project for a coordinated release.

The related upstream runc disclosure which inspired the investigation is https://github.com/opencontainers/runc/security/advisories/GHSA-cgrx-mc8f-2prm.

References: