Bug 1109371 (CVE-2014-4038, CVE-2014-4039)

Summary: CVE-2014-4038 CVE-2014-4039 ppc64-diag: multiple temporary file races
Product: [Other] Security Response Reporter: Vincent Danen <vdanen>
Component: vulnerabilityAssignee: Red Hat Product Security <security-response-team>
Status: CLOSED ERRATA QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: unspecifiedCC: dhorak, hannsj_uhl, jcajka, jrusnack, secondary-arch-list
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Multiple insecure temporary file use flaws were found in the way the ppc64-diag utility created certain temporary files. A local attacker could possibly use either of these flaws to perform a symbolic link attack and overwrite arbitrary files with the privileges of the user running ppc64-diag, or obtain sensitive information from the temporary files.
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-07-22 15:25:45 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: 1164148, 1201295    
Bug Blocks: 1109372, 1121513, 1193283    

Description Vincent Danen 2014-06-13 18:41:44 UTC
As noted in the SUSE bug report [1], numerous /tmp race conditions exist in ppc64-diag, in particular:

rtas_errd/diag_support.c:233:   char command[]="/usr/bin/find /proc/device-tree -name status -print > /tmp/get_dt_files";
rtas_errd/diag_support.c:241:   fp1 = fopen("/tmp/get_dt_files", "r");
rtas_errd/prrn_hotplug:8:TMPFILE=`mktemp -p /tmp`
scripts/ppc64_diag_mkrsrc:126:mkdir "/tmp/diagSEsnap", 0775;
scripts/ppc64_diag_mkrsrc:127:$general_eed_file = "/tmp/diagSEsnap/snapH.tar.gz";

In the case of rtas_errd/prrn_hotplug, mktemp is used but is assumed to have succeeded; there is no check for the return value.

mktemp should probably be used properly in all of these.  I don't know if the data in /tmp/diagSEsnap is sensitive or not, but if it is, the permissions on that directory should probably be tightened up.

No CVE(s) have been assigned to these issues as of yet.

[1] https://bugzilla.novell.com/show_bug.cgi?id=882667

Comment 1 Vincent Danen 2014-06-17 20:22:50 UTC
MITRE assigned the following CVEs to these issues:

Common Vulnerabilities and Exposures assigned an identifier CVE-2014-4038 to
the following vulnerability:

Name: CVE-2014-4038
URL: http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2014-4038
Assigned: 20140612
Reference: http://openwall.com/lists/oss-security/2014/06/17/1
Reference: https://bugzilla.novell.com/show_bug.cgi?id=882667
Reference: https://bugzilla.redhat.com/show_bug.cgi?id=1109371

ppc64-diag 2.6.1 allows local users to overwrite arbitrary files via a
symlink attack related to (1) rtas_errd/diag_support.c and
/tmp/get_dt_files, (2) scripts/ppc64_diag_mkrsrc and
/tmp/diagSEsnap/snapH.tar.gz, or (3) lpd/test/lpd_ela_test.sh and
/var/tmp/ras.


Common Vulnerabilities and Exposures assigned an identifier CVE-2014-4039 to
the following vulnerability:

Name: CVE-2014-4039
URL: http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2014-4039
Assigned: 20140612
Reference: http://openwall.com/lists/oss-security/2014/06/17/1
Reference: https://bugzilla.redhat.com/show_bug.cgi?id=1109371

ppc64-diag 2.6.1 uses 0775 permissions for /tmp/diagSEsnap and does
not properly restrict permissions for /tmp/diagSEsnap/snapH.tar.gz,
which allows local users to obtain sensitive information by reading
files in this archive, as demonstrated by /var/log/messages and
/etc/yaboot.conf.

Comment 2 Josh Bressers 2014-06-30 20:05:05 UTC
Statement:

(none)

Comment 4 errata-xmlrpc 2015-03-05 09:09:37 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 7

Via RHSA-2015:0383 https://rhn.redhat.com/errata/RHSA-2015-0383.html

Comment 6 errata-xmlrpc 2015-07-22 06:29:28 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 6

Via RHSA-2015:1320 https://rhn.redhat.com/errata/RHSA-2015-1320.html