REDHAT-BUG-2585333: High severity Flatpak Flatpak vulnerability
A Flatpak application with no special privileges can call flatpak-portal’s Spawn() such that two different file descriptors are mapped to the same handle. That can make dup2() fail; because the failure is not handled, a file descriptor that was originally open inside flatpak-portal is passed into the subsandbox instead. An attacker can predict the unfiltered D-Bus session bus fd number and obtain a full sandbox escape. Mitigated by exiting the child if fd mapping fails (commit f107d8a); more thoroughly fixed by FlatpakUniqueFDList preventing multiple uses of one fd (commits 07b007e, b1b596e, a7b55f8). Fixed in Flatpak 1.18.6 and 1.19.4 (1.18.5/1.19.3 tags also contain the fix but those releases failed and were superseded). Backports exist on the unsupported flatpak-1.16.x git branch; there is no formal upstream 1.16.x security release.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
Flatpakto a version that resolves this vulnerability.Fixed in 1.18.6 - Upgrade
Upgrade
Flatpakto a version that resolves this vulnerability.Fixed in 1.19.4
Event History
Frequently Asked Questions
Who can exploit this issue?
A Flatpak application running without special privileges can exploit it by invoking flatpak-portal’s Spawn() method. The issue can lead to a full sandbox escape.
What does an attacker need to do to trigger the escape?
The attacker must cause two file descriptors to be mapped to the same handle, making dup2() fail. They can then predict the unfiltered D-Bus session bus file descriptor number and use the descriptor leaked into the subsandbox.
Which Flatpak versions contain the upstream fix?
The issue is fixed in Flatpak 1.18.6 and 1.19.4. The 1.18.5 and 1.19.3 tags also contain the fix, but those releases failed and were superseded.
What mitigation is available if an upgrade is not immediately possible?
A mitigation exits the child process when file descriptor mapping fails, preventing the leaked descriptor from being passed into the subsandbox. This is implemented by commit f107d8a; the more complete fix prevents reuse of a file descriptor through FlatpakUniqueFDList.
Is there a fix for the 1.16.x branch?
Backports exist in the unsupported flatpak-1.16.x git branch, but there is no formal upstream 1.16.x security release.