We have just published Qubes Security Bulletin (QSB) 067: Multiple RPM vulnerabilities. The text of this QSB is reproduced below. This QSB and its accompanying signatures will always be available in the Qubes Security Pack (qubes-secpack).
View QSB-067 in the qubes-secpack:
Learn about the qubes-secpack, including how to obtain, verify, and read it:
View all past QSBs:
---===[ Qubes Security Bulletin 067 ]===--- 2021-03-19 Multiple RPM vulnerabilities User action required ===================== Users must install the following specific packages in order to address the issues discussed in this bulletin: For Qubes 4.0: - rpm 22.214.171.124 (plus rebuilt packages to link with the new rpm) - qubes-core-dom0-linux 4.0.29 - qubes-mgmt-salt-dom0-update 4.0.10 For Qubes 4.1: - qubes-core-dom0-linux 4.1.10 - qubes-mgmt-salt-dom0-update 4.1.6 The packages are to be installed in dom0 via the Qubes Update tool  or via the qubes-dom0-update command as follows: For updates from the stable repository (not immediately available): $ sudo qubes-dom0-update For updates from the security-testing repository: $ sudo qubes-dom0-update --enablerepo=qubes-dom0-security-testing After installing the updates in dom0, it is necessary to install updates in Fedora-based TemplateVMs and StandaloneVMs. This can be done via the Qubes Update tool  or using qubesctl (salt) as follows: $ sudo qubesctl --skip-dom0 --templates --standalones state.sls update.qubes-vm These packages will migrate from the security-testing repository to the current (stable) repository over the next two weeks after being tested by the community. Summary ======== Demi M. Obenour has discovered several issues in the RPM package manager: - CVE-2021-20271 RPM: Signature checks bypass via corrupted RPM package - CVE-2021-3421 RPM: unsigned signature header leads to string injection into an RPM database - CVE-2021-20266 RPM: missing length checks in hdrblobInit() These issues allow an attacker who controls packages the user downloads to inject malicious content that, under some conditions, may not be detected by signature verification. Specifically, they allow the attacker to modify parts of the package header that are not protected by the signature and that are later integrated into the RPM database. This allows for corrupting the RPM database and preventing further updates of select packages. In the case of Fedora TemplateVMs, this also allows for arbitrary code execution. The CVE-2021-20271 exploit takes advantage of multiple headers in the RPM package format. In a proper RPM package, the signature is placed in a separate header (called the "signature header") and, if present, is verified by librpm when loading the file (according to the requested verification level). An RPM package also contains a "main header" that includes all the other package metadata. The main header is protected by a signature in the signature header. The payload is protected either by a signature in the signature header or by a SHA-256 hash located in the main header. The ability to distinguish between these two headers is available to librpm internals but not to external librpm users. A malformed package may contain a signature in the main header instead of the signature header. Librpm will reject such a package only if a strict signature check was requested. Otherwise, it will treat the package as unsigned. DNF, on the other hand, has no way to check whether the signature was in the correct header. It will load the package and, seeing a signature, will assume that it was verified by librpm. This allows for bypassing package signature verification. The other bugs (CVE-2021-20266, CVE-2021-3421) concern incorrect parsing of the signature header (which, while it contains the signature, is itself unsigned). These bugs lead either to crashing or to corrupting the RPM database (if such a malformed package is installed). While Fedora will release its own patches in due course, we apply a mitigation that prevents the privilege escalation aspect of these issues. We configure RPM to always verify package signatures, even if a higher level package manager (like DNF) does not explicitly request it. This way, bypassing the signature check in DNF is not enough to compromise an entire TemplateVM. Note that this change also prevents the installation of unsigned RPM packages, even when explicitly requested. See the "Side effects" section below. For the dom0 aspect of these issues in Qubes 4.0, we update RPM to a version that is not vulnerable. We have decided to update to the next major version of RPM (from 4.13 to 4.14). This is because, besides the security fix itself (which could be backported), version 4.14 has significantly improved integrity verification. In 4.14, the macro _pkgverify_level can be used to require that all packages be signed by a trusted key. It defaults to "digest", meaning that only checksums must be present, but we have set it to "all", requiring that all packages be signed. Additionally, the checks performed before importing a package have been significantly enhanced, which substantially reduces the attack surface prior to integrity verification. In the near future, we will also deploy an extra tool to perform preliminary validation of all RPM packages in dom0 before handing them over to RPM. Impact ======= The impact differs between Fedora templates and dom0: 1. For Fedora templates, an attacker who controls packages that the user downloads can completely bypass package signature verification and fully compromise Fedora templates. 2. For dom0, an attacker who controls packages that the user downloads can corrupt the RPM database and (almost silently) prevent further updates of select packages. The attack requires control over the contents of downloaded packages. This requirement differs slightly between Fedora templates and dom0: 1. For Fedora templates, the attacker would either have to a. compromise the Fedora infrastructure that is serving updates or b. perform a man-in-the-middle attack on the HTTPS connection used to download the repository metadata (which contains package hashes). 2. For dom0, the attacker would either have to attack the user's repository access (as in the Fedora template case) or compromise the UpdateVM (sys-firewall in the default configuration). Side effects ============= The mitigation forces signature verification in RPM regardless of other options. This means that RPM will refuse to install packages that are unsigned (or signed with an untrusted signature), even when explicitly requested to do so. This breaks use cases such as installing locally-built packages and installing manually-downloaded packages the integrity of which was verified separately (which is often the case for closed-source software). In such cases, neither `dnf install /path/to/the/package.rpm` nor `rpm -i /path/to/the/package.rpm` will work any longer. Instead, to install a package without a trusted signature (that has been verified by other means), use the following command: rpm --define '_pkgverify_level digest' -i /path/to/the/package.rpm If the package has any dependencies, the above command will list them, and they will have to be installed with `dnf` manually. Credits ======== These issues were discovered and reported by Demi M. Obenour. References ===========  https://bugzilla.redhat.com/show_bug.cgi?id=1934125  https://bugzilla.redhat.com/show_bug.cgi?id=1927747  https://bugzilla.redhat.com/show_bug.cgi?id=1927741  https://www.qubes-os.org/doc/updating-qubes-os/ -- The Qubes Security Team https://www.qubes-os.org/security/