Bug 2041590 (CVE-2021-43860)

Summary: CVE-2021-43860 flatpak: Permissions granted to applications can be hidden from the user at install time
Product: [Other] Security Response Reporter: Guilherme de Almeida Suckevicz <gsuckevi>
Component: vulnerabilityAssignee: Red Hat Product Security <security-response-team>
Status: CLOSED ERRATA QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: unspecifiedCC: amigadave, debarshir, klember, saroy, security-response-team
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: flatpak 1.12.3, flatpak 1.10.6 Doc Type: If docs needed, set a value
Doc Text:
An incorrect authorization vulnerability was found in Flatpak. Flatpak does not properly validate that the permissions displayed to the user for an app at install time match the actual permissions granted to the app at runtime in the case that there's a null byte in the metadata file of an app. This issue allows apps to grant themselves permissions without the user's consent.
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-05-11 23:15:12 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 2041591, 2041972, 2041973    
Bug Blocks: 2041595    

Description Guilherme de Almeida Suckevicz 2022-01-17 18:52:08 UTC
Flatpak is a Linux application sandboxing and distribution framework. Prior to versions 1.12.3 and 1.10.6, Flatpak doesn't properly validate that the permissions displayed to the user for an app at install time match the actual permissions granted to the app at runtime, in the case that there's a null byte in the metadata file of an app. Therefore apps can grant themselves permissions without the consent of the user. Flatpak shows permissions to the user during install by reading them from the "xa.metadata" key in the commit metadata. This cannot contain a null terminator, because it is an untrusted GVariant. Flatpak compares these permissions to the *actual* metadata, from the "metadata" file to ensure it wasn't lied to. However, the actual metadata contents are loaded in several places where they are read as simple C-style strings. That means that, if the metadata file includes a null terminator, only the content of the file from *before* the terminator gets compared to xa.metadata. Thus, any permissions that appear in the metadata file after a null terminator are applied at runtime but not shown to the user. So maliciously crafted apps can give themselves hidden permissions. Users who have Flatpaks installed from untrusted sources are at risk in case the Flatpak has a maliciously crafted metadata file, either initially or in an update. This issue is patched in versions 1.12.3 and 1.10.6. As a workaround, users can manually check the permissions of installed apps by checking the metadata file or the xa.metadata key on the commit metadata.

Reference:
https://github.com/flatpak/flatpak/security/advisories/GHSA-qpjc-vq3c-572j

Comment 1 Guilherme de Almeida Suckevicz 2022-01-17 18:52:22 UTC
Created flatpak tracking bugs for this issue:

Affects: fedora-all [bug 2041591]

Comment 5 errata-xmlrpc 2022-05-10 13:26:31 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 8

Via RHSA-2022:1792 https://access.redhat.com/errata/RHSA-2022:1792

Comment 6 Product Security DevOps Team 2022-05-11 23:15:11 UTC
This bug is now closed. Further updates for individual products will be reflected on the CVE page(s):

https://access.redhat.com/security/cve/cve-2021-43860