Bug 1039811 (CVE-2013-6435) - CVE-2013-6435 rpm: race condition during the installation process
Summary: CVE-2013-6435 rpm: race condition during the installation process
Keywords:
Status: CLOSED ERRATA
Alias: CVE-2013-6435
Product: Security Response
Classification: Other
Component: vulnerability
Version: unspecified
Hardware: All
OS: Linux
high
high
Target Milestone: ---
Assignee: Red Hat Product Security
QA Contact:
URL:
Whiteboard:
Depends On: 1163052 1163053 1163054 1163055 1163056 1163057 1163058 1163059 1163060 1163061 1172125
Blocks: 1039813
TreeView+ depends on / blocked
 
Reported: 2013-12-10 04:12 UTC by Murray McAllister
Modified: 2023-05-12 01:11 UTC (History)
11 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
It was found that RPM wrote file contents to the target installation directory under a temporary name, and verified its cryptographic signature only after the temporary file has been written completely. Under certain conditions, the system interprets the unverified temporary file contents and extracts commands from it. This could allow an attacker to modify signed RPM files in such a way that they would execute code chosen by the attacker during package installation.
Clone Of:
Environment:
Last Closed: 2014-12-19 04:48:19 UTC
Embargoed:


Attachments (Terms of Use)
rpm-4.8.0-CVE-2013-6435.patch (version without umask) (2.67 KB, patch)
2014-11-11 10:17 UTC, Florian Weimer
no flags Details | Diff
rpm-4.8.0-CVE-2013-6435.patch (version with umask) (1003 bytes, patch)
2014-11-11 12:23 UTC, Florian Weimer
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2014:1974 0 normal SHIPPED_LIVE Important: rpm security update 2014-12-09 23:07:29 UTC
Red Hat Product Errata RHSA-2014:1975 0 normal SHIPPED_LIVE Important: rpm security update 2014-12-09 23:07:03 UTC
Red Hat Product Errata RHSA-2014:1976 0 normal SHIPPED_LIVE Important: rpm security update 2014-12-10 00:50:38 UTC

Description Murray McAllister 2013-12-10 04:12:37 UTC
IssueDescription:

It was found that RPM wrote file contents to the target installation directory under a temporary name, and verified its cryptographic signature only after the temporary file has been written completely. Under certain conditions, the system interprets the unverified temporary file contents and extracts commands from it. This could allow an attacker to modify signed RPM files in such a way that they would execute code chosen by the attacker during package installation.

Acknowledgements:

This issue was discovered by Florian Weimer of the Red Hat Product Security Team.

Comment 17 Florian Weimer 2014-11-11 10:17:21 UTC
Created attachment 956207 [details]
rpm-4.8.0-CVE-2013-6435.patch (version without umask)

Proposed patch for RPM 4.8.

This is based on Panu's suggestion in comment #8, but creates the file with mode 0 instead, instead of using chmod afterwards, closing yet another race.

Comment 24 Florian Weimer 2014-11-11 12:23:40 UTC
Created attachment 956268 [details]
rpm-4.8.0-CVE-2013-6435.patch (version with umask)

This variant of the patch is smaller than the previous one.  The RPM transaction code is not thread-safe already, so another umask call should not be a problem.

Comment 25 Panu Matilainen 2014-11-11 12:46:09 UTC
Yeah, that is short and sweet, and trivial to backport. 

Except that there is no rpmfiFSizeIndex() in < 4.8.x versions, but should be easy enough to replace with direct struct access.

Comment 29 Huzaifa S. Sidhpurwala 2014-12-09 12:50:40 UTC
Created rpm tracking bugs for this issue:

Affects: fedora-all [bug 1172125]

Comment 30 errata-xmlrpc 2014-12-09 18:08:00 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 6.5 EUS - Server and Compute Node Only
  Red Hat Enterprise Linux 6.4 EUS - Server and Compute Node Only
  Red Hat Enterprise Linux 5.6 Long Life
  Red Hat Enterprise Linux 5.9 EUS - Server Only
  Red Hat Enterprise Linux 6.2 AUS

Via RHSA-2014:1975 https://rhn.redhat.com/errata/RHSA-2014-1975.html

Comment 31 errata-xmlrpc 2014-12-09 18:08:17 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 6
  Red Hat Enterprise Linux 5

Via RHSA-2014:1974 https://rhn.redhat.com/errata/RHSA-2014-1974.html

Comment 32 errata-xmlrpc 2014-12-09 19:50:55 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 7

Via RHSA-2014:1976 https://rhn.redhat.com/errata/RHSA-2014-1976.html

Comment 33 Fedora Update System 2014-12-17 04:46:12 UTC
rpm-4.12.0.1-4.fc21 has been pushed to the Fedora 21 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 34 Fedora Update System 2014-12-29 09:57:21 UTC
rpm-4.11.3-2.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 35 Thomas Jarosch 2015-01-22 11:37:40 UTC
Is it intentional that the fix for fc22 as in "rpm-4.12.0.1-6.fc22.src.rpm"

does not contain the line

+    rpm_loff_t left = rpmfiFSizeIndex(fsmGetFi(fsm), fsm->ix);

from Florian's patch?

Comment 36 Karel Srot 2015-03-18 07:55:53 UTC
Hi Florian, 
could you please take a look at #c35?

Comment 37 Panu Matilainen 2015-03-18 08:18:18 UTC
It is intentional, rpm 4.12 code already does that for other reasons.


Note You need to log in before you can comment on or make changes to this bug.