Skip to content

CVE-2024-42472 Flatpak may allow access to files outside sandbox for certain apps

CriticalCVSS 10.0 EPSS 1.3%
Published
Updated
Exploit status
No public exploit known
CISA SSVC
No known exploitation · automatable: yes · technical impact: total
Technology
UbuntuDebian

Description

Flatpak is a Linux application sandboxing and distribution framework. Prior to versions 1.14.0 and 1.15.10, a malicious or compromised Flatpak app using persistent directories could access and write files outside of what it would otherwise have access to, which is an attack on integrity and confidentiality.

When persistent=subdir is used in the application permissions (represented as --persist=subdir in the command-line interface), that means that an application which otherwise doesn't have access to the real user home directory will see an empty home directory with a writeable subdirectory subdir. Behind the scenes, this directory is actually a bind mount and the data is stored in the per-application directory as ~/.var/app/$APPID/subdir. This allows existing apps that are not aware of the per-application directory to still work as intended without general home directory access.

However, the application does have write access to the application directory ~/.var/app/$APPID where this directory is stored. If the source directory for the persistent/--persist option is replaced by a symlink, then the next time the application is started, the bind mount will follow the symlink and mount whatever it points to into the sandbox.

Partial protection against this vulnerability can be provided by patching Flatpak using the patches in commits ceec2ffc and 98f79773. However, this leaves a race condition that could be exploited by two instances of a malicious app running in parallel. Closing the race condition requires updating or patching the version of bubblewrap that is used by Flatpak to add the new --bind-fd option using the patch and then patching Flatpak to use it. If Flatpak has been configured at build-time with -Dsystem_bubblewrap=bwrap (1.15.x) or --with-system-bubblewrap=bwrap (1.14.x or older), or a similar option, then the version of bubblewrap that needs to be patched is a system copy that is distributed separately, typically /usr/bin/bwrap. This configuration is the one that is typically used in Linux distributions. If Flatpak has been configured at build-time with -Dsystem_bubblewrap= (1.15.x) or with --without-system-bubblewrap (1.14.x or older), then it is the bundled version of bubblewrap that is included with Flatpak that must be patched. This is typically installed as /usr/libexec/flatpak-bwrap. This configuration is the default when building from source code.

For the 1.14.x stable branch, these changes are included in Flatpak 1.14.10. The bundled version of bubblewrap included in this release has been updated to 0.6.3. For the 1.15.x development branch, these changes are included in Flatpak 1.15.10. The bundled version of bubblewrap in this release is a Meson "wrap" subproject, which has been updated to 0.10.0. The 1.12.x and 1.10.x branches will not be updated for this vulnerability. Long-term support OS distributions should backport the individual changes into their versions of Flatpak and bubblewrap, or update to newer versions if their stability policy allows it. As a workaround, avoid using applications using the persistent (--persist) permission.

Upgrade path

17 packages: 16 fixed.

PackageAffectedFixed inStatus
alpine/bubblewrap(Alpine v3.20) < 0.10.0-r0 0.10.0-r0 Fixed
alpine/bubblewrap(Alpine v3.21) < 0.10.0-r0 0.10.0-r0 Fixed
alpine/bubblewrap(Alpine v3.22) < 0.10.0-r0 0.10.0-r0 Fixed
alpine/bubblewrap(Alpine v3.23) < 0.10.0-r0 0.10.0-r0 Fixed
alpine/bubblewrap(Alpine v3.24) < 0.10.0-r0 0.10.0-r0 Fixed
alpine/flatpak(Alpine v3.20) >= 1.14.0, < 1.14.10-r0 1.14.10-r0 Fixed
alpine/flatpak(Alpine v3.21) >= 1.14.0, < 1.14.10-r0 1.14.10-r0 Fixed
alpine/flatpak(Alpine v3.22) >= 1.14.0, < 1.14.10-r0 1.14.10-r0 Fixed
alpine/flatpak(Alpine v3.23) >= 1.14.0, < 1.14.10-r0 1.14.10-r0 Fixed
alpine/flatpak(Alpine v3.24) >= 1.14.0, < 1.14.10-r0 1.14.10-r0 Fixed
debian/flatpak(Debian 12) < 1.14.10-1~deb12u1; = 1.14.4-1; = 1.14.4-1+deb12u1; = 1.14.4-1+deb12u1~bpo11+1 +6 more 1.14.10-1~deb12u1 Fixed
debian/flatpak(Debian 13) < 1.14.10-1 1.14.10-1 Fixed
debian/flatpak(Debian 14) < 1.14.10-1 1.14.10-1 Fixed
flatpak < 1.14.10; = < 1.14.10; = >= 1.15.0, < 1.15.10; >= 1.14.0, < 1.14.10 +1 more 1.14.10, 1.15.10 Fixed
ubuntu/flatpak(Ubuntu 22.04) < 1.12.7-1ubuntu0.1 1.12.7-1ubuntu0.1 Fixed
ubuntu/flatpak(Ubuntu 24.04) < 1.14.6-1ubuntu0.1 1.14.6-1ubuntu0.1 Fixed
debian linux = 11.0 No fix listed Versions listed

Affected products

ProductAffected versionsFixed in
debian/flatpak(Debian:12) < 1.14.10-1~deb12u1 1.14.10-1~deb12u1
debian/flatpak(Debian:12) = 1.14.4-1 No fix listed
debian/flatpak(Debian:12) = 1.14.4-1+deb12u1 No fix listed
debian/flatpak(Debian:12) = 1.14.4-1+deb12u1~bpo11+1 No fix listed
debian/flatpak(Debian:12) = 1.14.4-2 No fix listed
debian/flatpak(Debian:12) = 1.14.5-1 No fix listed
debian/flatpak(Debian:12) = 1.14.6-1 No fix listed
debian/flatpak(Debian:12) = 1.14.6-1~deb13u1 No fix listed
debian/flatpak(Debian:12) = 1.14.8-1 No fix listed
debian/flatpak(Debian:12) = 1.14.8-1~deb12u1 No fix listed
debian/flatpak(Debian:13) < 1.14.10-1 1.14.10-1
debian/flatpak(Debian:14) < 1.14.10-1 1.14.10-1
ubuntu/flatpak(Ubuntu:22.04) < 1.12.7-1ubuntu0.1 1.12.7-1ubuntu0.1
flatpak = < 1.14.10 No fix listed
flatpak = >= 1.15.0, < 1.15.10 No fix listed
flatpak < 1.14.10 1.14.10
flatpak >= 1.15.0, < 1.15.10 1.15.10
alpine/bubblewrap(Alpine:v3.20) < 0.10.0-r0 0.10.0-r0
alpine/bubblewrap(Alpine:v3.21) < 0.10.0-r0 0.10.0-r0
alpine/bubblewrap(Alpine:v3.22) < 0.10.0-r0 0.10.0-r0
alpine/bubblewrap(Alpine:v3.23) < 0.10.0-r0 0.10.0-r0
alpine/bubblewrap(Alpine:v3.24) < 0.10.0-r0 0.10.0-r0
alpine/flatpak(Alpine:v3.20) >= 1.14.0, < 1.14.10-r0 1.14.10-r0
alpine/flatpak(Alpine:v3.21) >= 1.14.0, < 1.14.10-r0 1.14.10-r0
alpine/flatpak(Alpine:v3.22) >= 1.14.0, < 1.14.10-r0 1.14.10-r0
Show 5 more
ProductAffected versionsFixed in
alpine/flatpak(Alpine:v3.23) >= 1.14.0, < 1.14.10-r0 1.14.10-r0
alpine/flatpak(Alpine:v3.24) >= 1.14.0, < 1.14.10-r0 1.14.10-r0
ubuntu/flatpak(Ubuntu:24.04) < 1.14.6-1ubuntu0.1 1.14.6-1ubuntu0.1
flatpak >= 1.14.0, < 1.14.10 1.14.10
debian linux = 11.0 No fix listed

References