Bug 1282542 - (CVE-2015-7529) CVE-2015-7529 sos: Usage of predictable temporary files allows privilege escalation
CVE-2015-7529 sos: Usage of predictable temporary files allows privilege esca...
Status: CLOSED ERRATA
Product: Security Response
Classification: Other
Component: vulnerability (Show other bugs)
unspecified
All Linux
medium Severity medium
: ---
: ---
Assigned To: Red Hat Product Security
impact=moderate,public=20151201,repor...
: Security
Depends On: 1286933 1286934 1290953 1290954 1290955 1310409 1310466
Blocks: 1282568
  Show dependency treegraph
 
Reported: 2015-11-16 12:14 EST by Adam Mariš
Modified: 2016-12-20 20:13 EST (History)
30 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
An insecure temporary file use flaw was found in the way sos created certain sosreport files. A local attacker could possibly use this flaw to perform a symbolic link attack to reveal the contents of sosreport files, or in some cases modify arbitrary files and escalate their privileges on the system.
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-12-20 20:13:53 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
[policies] move hash determination to policies (4.55 KB, patch)
2015-11-20 14:04 EST, Bryn M. Reeves
no flags Details | Diff
[policies] refactor Policy.display_results() args (4.20 KB, patch)
2015-11-20 14:04 EST, Bryn M. Reeves
no flags Details | Diff
[sosreport] move archive checksumming to sosreport (4.59 KB, patch)
2015-11-20 14:05 EST, Bryn M. Reeves
no flags Details | Diff
[sosreport] prepare report in a private subdirectory (8.10 KB, patch)
2015-11-20 14:06 EST, Bryn M. Reeves
no flags Details | Diff

  None (edit)
Description Adam Mariš 2015-11-16 12:14:35 EST
A vulnerability in sosreport was reported, allowing a privilege escalation to unprivileged attacker on RHEL-6, and change the owner and content of certain files on RHEL-7.

sosreport creates temporary directory in /tmp with predictable name sosreport-$hostname-$date with permissions set to 700. Then it creates a tar file with the aforementioned name + .tar suffix. Further it invokes open() with no O_NOFOLLOW nor O_EXCL set, which can be exploited by placing a file or a symlink in its place.

Attacker can create his own file to steal the content or can create a symlink to create/modify arbitrary files. On RHEL-7, there is fs.protected_symlinks sysctl provided, which closes this vector. With the setting target of the symlink must match symlink's owner. On RHEL-6 this feature is missing, so the attacker is able to modify arbitrary files and escalate privileges.
Comment 1 Bryn M. Reeves 2015-11-16 13:03:49 EST
> sosreport creates temporary directory in /tmp with predictable name 
> sosreport-$hostname-$date"

The name of the directory is not predictable - it's the fact that we then re-use that (now published in the file system) name for the final tar archive that allows a malicious user to predict the archive path name.

I expect to push a fix for this upstream in the next couple of days however due to product integration needs we may need to use a slightly different approach in any urgent erratas.
Comment 3 Adam Mariš 2015-11-16 13:46:35 EST
Acknowledgments:

This issue was discovered by Mateusz Guzik of Red Hat.
Comment 13 Bryn M. Reeves 2015-11-20 14:04 EST
Created attachment 1097279 [details]
[policies] move hash determination to policies
Comment 14 Bryn M. Reeves 2015-11-20 14:04 EST
Created attachment 1097280 [details]
[policies] refactor Policy.display_results() args
Comment 15 Bryn M. Reeves 2015-11-20 14:05 EST
Created attachment 1097281 [details]
[sosreport] move archive checksumming to sosreport
Comment 16 Bryn M. Reeves 2015-11-20 14:06 EST
Created attachment 1097283 [details]
[sosreport] prepare report in a private subdirectory
Comment 25 Huzaifa S. Sidhpurwala 2015-12-01 01:30:46 EST
Created sos tracking bugs for this issue:

Affects: fedora-all [bug 1286934]
Comment 50 Fedora Update System 2015-12-28 17:55:25 EST
sos-3.2-2.fc23 has been pushed to the Fedora 23 stable repository. If problems still persist, please make note of it in this bug report.
Comment 51 errata-xmlrpc 2016-02-09 03:44:11 EST
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 6

Via RHSA-2016:0152 https://rhn.redhat.com/errata/RHSA-2016-0152.html
Comment 52 errata-xmlrpc 2016-02-16 05:39:02 EST
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 7

Via RHSA-2016:0188 https://rhn.redhat.com/errata/RHSA-2016-0188.html

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