Bug 1368938 (CVE-2016-7097)

Summary: CVE-2016-7097 kernel: Setting a POSIX ACL via setxattr doesn't clear the setgid bit
Product: [Other] Security Response Reporter: Andrej Nemec <anemec>
Component: vulnerabilityAssignee: Red Hat Product Security <security-response-team>
Status: CLOSED ERRATA QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: unspecifiedCC: aquini, arm-mgr, bhu, carnil, dhoward, fhrbata, gansalmon, iboverma, ichavero, itamar, jforbes, jkacur, joelsmith, jonathan, jross, jwboyer, kernel-maint, kernel-mgr, labbott, lgoncalv, madhu.chinakonda, matt, mchehab, mcressma, nmurray, plougher, rt-maint, rvrbovsk, slawomir, vdronov, williams
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
It was found that when file permissions were modified via chmod and the user modifying them was not in the owning group or capable of CAP_FSETID, the setgid bit would be cleared. Setting a POSIX ACL via setxattr sets the file permissions as well as the new ACL, but doesn't clear the setgid bit in a similar way. This could allow a local user to gain group privileges via certain setgid applications.
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-06-08 02:57:34 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: 1368939, 1371252, 1371253, 1371254, 1371255, 1371256    
Bug Blocks: 1368940    

Description Andrej Nemec 2016-08-22 08:00:13 UTC
A vulnerability was found in the Linux kernel. When file permissions are modified via chmod and the user is not in the owning group or capable of CAP_FSETID, the setgid bit is cleared in inode_change_ok(). Setting a POSIX ACL via setxattr sets the filepermissions as well as the new ACL, but doesn't clear the setgid bit in a similar way; this allows to bypass the check in chmod.

Suggested upstream patch:

http://marc.info/?l=linux-fsdevel&m=147162313630259&w=2

http://www.spinics.net/lists/linux-fsdevel/msg101138.html

Upstream commits:

https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=073931017b49d9458aa351605b43a7e34598caef

https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=497de07d89c1410d76a15bec2bb41f24a2a89f31

Previous suggestions:

http://www.spinics.net/lists/linux-fsdevel/msg98328.html

https://patchwork.kernel.org/patch/9137067/

https://patchwork.kernel.org/patch/9138935/

CVE request+assignment:

http://seclists.org/oss-sec/2016/q3/380

http://seclists.org/oss-sec/2016/q3/382

Comment 1 Andrej Nemec 2016-08-22 08:01:02 UTC
Created kernel tracking bugs for this issue:

Affects: fedora-all [bug 1368939]

Comment 2 Andrej Nemec 2016-08-22 08:03:44 UTC
Acknowledgments:

Name: Andreas Gruenbacher (Red Hat), Jan Kara (SUSE)

Comment 3 Andrej Nemec 2016-08-29 07:12:01 UTC
Statement:

This issue affects the Linux kernel packages as shipped with Red Hat Enterprise Linux 5. This has been rated as having Moderate security impact and is not currently planned to be addressed in future updates. For additional information, refer to the Red Hat Enterprise Linux Life Cycle: https://access.redhat.com/support/policy/updates/errata/.

This issue affects the Linux kernel packages as shipped with Red Hat Enterprise Linux 6, 7 and MRG-2. Future Linux kernel updates for the respective releases might address this issue.

Comment 9 errata-xmlrpc 2017-03-21 13:12:37 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 6

Via RHSA-2017:0817 https://rhn.redhat.com/errata/RHSA-2017-0817.html

Comment 10 errata-xmlrpc 2017-08-01 19:09:06 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 7

Via RHSA-2017:2077 https://access.redhat.com/errata/RHSA-2017:2077

Comment 11 errata-xmlrpc 2017-08-02 07:48:02 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 7

Via RHSA-2017:1842 https://access.redhat.com/errata/RHSA-2017:1842

Comment 12 errata-xmlrpc 2017-09-06 20:37:51 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise MRG 2

Via RHSA-2017:2669 https://access.redhat.com/errata/RHSA-2017:2669