Bug 1446288 (CVE-2017-7482)

Summary: CVE-2017-7482 kernel: net/rxrpc: overflow in decoding of krb5 principal
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, bhu, blc, dhoward, eshatokhin, fhrbata, gansalmon, hkrzesin, hwkernel-mgr, iboverma, ichavero, itamar, jforbes, jkacur, jonathan, jross, jwboyer, kernel-maint, kernel-mgr, labbott, lgoncalv, madhu.chinakonda, matt, mchehab, mcressma, mlangsdo, nmurray, pholasek, plougher, rt-maint, rvrbovsk, security-response-team, vdronov, williams, wmealing
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: kernel 4.12 Doc Type: If docs needed, set a value
Doc Text:
Keberos 5 tickets being decoded when using the RXRPC keys incorrectly assumes the size of a field. This could lead to the size-remaining variable wrapping and the data pointer going over the end of the buffer. This could possibly lead to memory corruption and possible privilege escalation.
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-06-08 03:11:37 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: 1451579, 1451580, 1451581, 1451582, 1451583, 1451584, 1451585, 1464888, 1466125, 1466126, 1466127    
Bug Blocks: 1446290    

Description Andrej Nemec 2017-04-27 15:18:07 UTC
When a kerberos 5 ticket is being decoded so that it can be loaded into an rxrpc-type key, the length of a variable-length field is checked to make sure that it's not going to overrun the allocated buffer space.

The data is padded to the nearest four-byte boundary and the code doesn't check for this extra four-byte aligned padding.  This can lead to the size-remaining variable wrapping and the data pointer accessing or reading past the end of the buffer.  The read functionality could allow for a 3 byte infoleak and the write flaw could allow for an uncontrolled 3 byte write to kernels slab memory.  This could lead to memory corruption and possible privilege escalation although no known exploit exists at the time of writing.

Discussion an a CVE-ID assignment:

http://seclists.org/oss-sec/2017/q2/602

Upstream fix
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5f2f97656ada8d811d3c1bef503ced266fcd53a0

Comment 1 Andrej Nemec 2017-04-27 15:24:24 UTC
Acknowledgments:

Name: Shi Lei (Qihoo 360 Gear Team)

Comment 3 Wade Mealing 2017-05-19 03:26:10 UTC
Statement:

This issue does not affect the Linux kernel packages as shipped with Red Hat Enterprise Linux 5,6 and 7 as the module is not enabled on these systems.

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

Comment 6 Wade Mealing 2017-06-26 08:06:23 UTC
Created kernel tracking bugs for this issue:

Affects: fedora-all [bug 1464888]

Comment 8 Evgenii Shatokhin 2017-06-29 12:12:54 UTC
As far as I can see in the kernel sources for the version 3.10.0-514.26.1 in RHEL 7, the affected code (from net/rxrpc/ar-key.c) is only built when CONFIG_AF_RXRPC is set. However, that kernel and at least some earlier ones have "# CONFIG_AF_RXRPC is not set" in their config files.

So RHEL 7 is actually not affected by this issue, right? Or, perhaps, I am missing something.

Comment 9 Wade Mealing 2017-07-04 01:13:48 UTC
You're 100% right, I had originally grepped the config for CONFIG_RX_RPC not CONFIG_AF_RX_RPC.  Kernel-rt/MRG-2 still seems to use this as a module it remains affected.

Closing trackers for 6 and 7 adjusting statement.

Comment 10 Justin M. Forbes 2018-01-29 17:17:40 UTC
This was fixed for Fedora with 4.11.8 stable updates

Comment 11 errata-xmlrpc 2019-03-26 07:45:12 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise MRG 2

Via RHSA-2019:0641 https://access.redhat.com/errata/RHSA-2019:0641