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: CLOSED ERRATA QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: unspecifiedCC: apevec, apevec, chrisw, gkotton, lhh, lutter, markmc, rbryant, rhs-bugs, sclewis, srevivo
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-10-20 10:41:56 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: 1036079, 1036080, 1036081, 1036082, 1036083, 1054129, 1058938    
Bug Blocks: 1034264    

Description Tomas Hoger 2013-11-25 14:05:59 UTC
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 15:44:12 UTC
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 15:45:26 UTC
(In reply to lutter 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 15:12:01 UTC
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 11:36:14 UTC
Assigning CVE-2013-6412.

Comment 7 Tomas Hoger 2013-11-29 11:39:38 UTC
Created augeas tracking bugs for this issue:

Affects: fedora-all [bug 1036082]
Affects: epel-5 [bug 1036083]

Comment 8 Dominic Cleal 2013-12-02 18:10:53 UTC
Patch submitted, pending review:
https://github.com/hercules-team/augeas/pull/58

Comment 9 Dominic Cleal 2014-01-14 09:36:23 UTC
Merged upstream:
https://github.com/hercules-team/augeas/commit/f5b4fc0c

Comment 10 Martin Prpič 2014-01-14 10:05:33 UTC
Acknowledgment:

This issue was discovered by the Red Hat Security Response Team.

Comment 12 errata-xmlrpc 2014-01-20 17:32:28 UTC
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 15:06:02 UTC
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 15:11:09 UTC
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-08 00:41:07 UTC
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.