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.
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 ?
(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.
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.
Assigning CVE-2013-6412.
Created augeas tracking bugs for this issue: Affects: fedora-all [bug 1036082] Affects: epel-5 [bug 1036083]
Patch submitted, pending review: https://github.com/hercules-team/augeas/pull/58
Merged upstream: https://github.com/hercules-team/augeas/commit/f5b4fc0c
Acknowledgment: This issue was discovered by the Red Hat Security Response Team.
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
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.
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.
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.