Bug 680798 (CVE-2011-1098) - CVE-2011-1098 logrotate: TOCTOU race condition by creation of new files (between opening the file and moment, final permissions have been applied) [information disclosure]
Summary: CVE-2011-1098 logrotate: TOCTOU race condition by creation of new files (betw...
Status: CLOSED ERRATA
Alias: CVE-2011-1098
Product: Security Response
Classification: Other
Component: vulnerability
Version: unspecified
Hardware: All
OS: Linux
low
low
Target Milestone: ---
Assignee: Red Hat Product Security
QA Contact:
URL:
Whiteboard: impact=low,public=20110213,reported=2...
Keywords: Security
Depends On: 688518 688519 688520
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-02-27 19:41 UTC by Jan Lieskovsky
Modified: 2019-06-08 18:45 UTC (History)
5 users (show)

(edit)
Clone Of:
(edit)
Last Closed: 2015-07-30 13:14:03 UTC


Attachments (Terms of Use)
proposed patch (1.75 KB, patch)
2011-03-16 11:02 UTC, Jan Kaluža
no flags Details | Diff


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2011:0407 normal SHIPPED_LIVE Moderate: logrotate security update 2011-03-31 15:16:26 UTC

Description Jan Lieskovsky 2011-02-27 19:41:45 UTC
It was found that logrotate utility used insecure default
permissions, when creating of new files (time-of-check,
time-of-use, TOCTOU race condition). In some specific
configurations, a local attacker could use this flaw to
open the new file before the final permissions have been
applied, leading to disclosure of sensitive information.

Comment 3 Jan Lieskovsky 2011-03-03 10:44:32 UTC
Further flaw details from Stefan Fritsch of Debian Security Team:
==================================================================

The race is between

192 fd = open(fileName, flags, sb->st_mode);

and

198 if (fchmod(fd, (S_IRUSR | S_IWUSR) & sb->st_mode)) {

and later

204 if (fchown(fd, sb->st_uid, sb->st_gid)) {


An attacker may be able to open the newly created file after line 192,
even if he has no permissions to open the file after lines 198 and 204
have been executed. Once he has the open file descriptor, he can read
what will be written into the file. No symlink attack is needed.

Comment 4 Huzaifa S. Sidhpurwala 2011-03-11 06:28:08 UTC
This has been assigned CVE-2011-1098

Comment 8 Jan Kaluža 2011-03-16 11:02:53 UTC
Created attachment 485707 [details]
proposed patch

This patch fixes the issue by creating temp file with umask 0000, then change owner/mode and renames it to log file.

Upstream fixed it by use of "su" directive patch described in Bug
680799 Comment 2, but this patch breaks backward compatibility for some configurations. Attached patch is possible workaround which keeps backward compatibility.

Comment 10 Huzaifa S. Sidhpurwala 2011-03-17 09:53:11 UTC
Created logrotate tracking bugs for this issue

Affects: fedora-all [bug 688520]

Comment 11 errata-xmlrpc 2011-03-31 15:16:37 UTC
This issue has been addressed in following products:

  Red Hat Enterprise Linux 6

Via RHSA-2011:0407 https://rhn.redhat.com/errata/RHSA-2011-0407.html

Comment 13 Josh Bressers 2011-06-29 17:42:12 UTC
Statement:

The Red Hat Security Response Team has rated this issue as having low security impact, a future update may address this flaw.


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