OSG-SEC-2023-04-26 HIGH setuid-mode Apptainer exploit
Dear OSG Security Contacts,
A new version of Apptainer, v1.1.8, has been released to address a vulnerability in setuid-root Apptainer installations which expose an unpatched use-after-free flaw in the kernel to all local users. [1]
IMPACTED VERSIONS:
Apptainer v1.1.7 and earlier
All versions of Singularity
WHAT ARE THE VULNERABILITIES:
Use-after-free flaws in the kernel can be used to attack the kernel for denial of service and potentially for privilege escalation. There is an ext4 use-after-free flaw described in CVE-2022-1184 [3][4][5][6] that is exploitable through versions of Apptainer < 1.1.0, installations that include apptainer-suid < 1.1.8, and all versions of Singularity in their default configurations on older operating systems where that CVE has not been patched. That includes Red Hat Enterprise Linux 7, Debian 10 buster (unless the linux-5.10 package is installed), Ubuntu 18.04 bionic and Ubuntu 20.04 focal.
Additional details can be found in the Apptainer advisory in reference [1] below.
WHAT YOU SHOULD DO:
Review the Apptainer advisory [1] and update Apptainer to v1.1.8. Sites that are using setuid-root mode on RHEL7 should update urgently.
The updated packages can be found on the Apptainer github repository [2], and are available in the epel-testing repository for distributions that can make use of EPEL.
The following workarounds are also available:
-
Either do not install apptainer-suid (for versions 1.1.0 through 1.1.7) or set allow setuid = no in apptainer.conf (or singularity.conf for singularity versions). This requires having unprivileged user namespaces enabled and except for apptainer 1.1.x versions will disallow mounting of sif files, extfs files, and squashfs files in addition to other, less significant impacts. (Encrypted sif files are also not supported unprivileged in apptainer 1.1.x.)
-
Alternatively, use the "limit containers" options in apptainer.conf/singularity.conf to limit sif files to trusted users, groups, and/or paths. (The option "allow container extfs = no" disallows mounting extfs overlay files but does not disallow mounting of extfs overlay partitions inside SIF files, so it does not help work around the problem.)
REFERENCES
[1] https://github.com/apptainer/apptainer/security/advisories/GHSA-j4rf-7357-f4cg
[2] https://github.com/apptainer/apptainer/releases/tag/v1.1.8
[3] https://nvd.nist.gov/vuln/detail/CVE-2022-1184
[4] https://access.redhat.com/security/cve/cve-2022-1184
[5] https://security-tracker.debian.org/tracker/CVE-2022-1184
[6] https://ubuntu.com/security/CVE-2022-1184
Please contact the OSG security team at [email protected] if you have any questions or concerns. OSG Security Team