Bug 1034261 (CVE-2013-6412)

Summary: CVE-2013-6412 augeas: incorrect permissions set on newly created files
Product: [Other] Security Response Reporter: Tomas Hoger <thoger>
Component: vulnerabilityAssignee: Red Hat Product Security <security-response-team>
Status: NEW --- QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: unspecifiedCC: aortega, apevec, apevec, ayoung, chrisw, dcleal, gkotton, iheim, jkurik, lhh, lutter, markmc, mbooth, rbryant, rhos-maint, rhs-bugs, rwheeler, sclewis, srevivo, ssaha, vbellur
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard: impact=moderate,public=20131125,reported=20131120,source=redhat,cvss2=2.6/AV:L/AC:H/Au:N/C:P/I:P/A:N,rhel-6/augeas=affected,rhel-7/augeas=notaffected,openstack-3/augeas=notaffected,openstack-4/augeas=notaffected,rhes-2.1/augeas=notaffected,fedora-all/augeas=affected,epel-5/augeas=affected
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Bug Depends On: 1036079, 1036080, 1036081, 1036082, 1036083, 1054129, 1058938    
Bug Blocks: 1034264    

Description Tomas Hoger 2013-11-25 09:05:59 EST
Augeas upstream commit 051c73a9:

https://github.com/hercules-team/augeas/commit/051c73a9

introduced a flaw in the way Augeas sets permissions on newly created files.  The above commit aims to address a regression introduced in the fix for CVE-2012-0786 (see bug 772257 comment 39), which introduced a use of mkstemp() to create new files.  mkstemp() always sets 0600 file permissions regardless of the current umask setting.  Commit 051c73a9 attempts to fix file permissions based on umask setting, but it does not correctly handle certain umask values, causing Augeas to make newly created files world writable.  A local user could possibly use this flaw to modify configuration files created by an application using Augeas.
Comment 1 lutter@watzmann.net 2013-11-25 10:44:12 EST
I would fix this by changing the second arg to fchmod on line 1105 to '0666 - curumsk & 0666' - do you think that is sufficient as a fix here ?
Comment 2 Dominic Cleal 2013-11-25 10:45:26 EST
(In reply to lutter@watzmann.net from comment #1)
> I would fix this by changing the second arg to fchmod on line 1105 to '0666
> - curumsk & 0666' - do you think that is sufficient as a fix here ?

Or 0666 & ~curumask I think.
Comment 4 Tomas Hoger 2013-11-28 10:12:01 EST
This issue only affects augeas packages in Red Hat Enterprise Linux 6 as of RHSA-2013:1537 (augeas-1.0.0-5.el6), released as part of Red Hat Enterprise Linux 6.5, which is the update that corrected CVE-2012-0786 and introduced this problem - see bug 772257 comment 51.  augeas packages in older Red Hat Enterprise Linux 6 versions are not affected.
Comment 5 Tomas Hoger 2013-11-29 06:36:14 EST
Assigning CVE-2013-6412.
Comment 7 Tomas Hoger 2013-11-29 06:39:38 EST
Created augeas tracking bugs for this issue:

Affects: fedora-all [bug 1036082]
Affects: epel-5 [bug 1036083]
Comment 8 Dominic Cleal 2013-12-02 13:10:53 EST
Patch submitted, pending review:
https://github.com/hercules-team/augeas/pull/58
Comment 9 Dominic Cleal 2014-01-14 04:36:23 EST
Merged upstream:
https://github.com/hercules-team/augeas/commit/f5b4fc0c
Comment 10 Martin Prpic 2014-01-14 05:05:33 EST
Acknowledgment:

This issue was discovered by the Red Hat Security Response Team.
Comment 12 errata-xmlrpc 2014-01-20 12:32:28 EST
This issue has been addressed in following products:

  Red Hat Enterprise Linux 6

Via RHSA-2014:0044 https://rhn.redhat.com/errata/RHSA-2014-0044.html
Comment 13 Fedora Update System 2014-03-15 11:06:02 EDT
augeas-1.2.0-1.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 14 Fedora Update System 2014-03-15 11:11:09 EDT
augeas-1.2.0-1.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 15 Fedora Update System 2014-08-07 20:41:07 EDT
augeas-1.2.0-1.el5 has been pushed to the Fedora EPEL 5 stable repository.  If problems still persist, please make note of it in this bug report.