Bug 1296253 (CVE-2016-0723)

Summary: CVE-2016-0723 kernel: Kernel memory disclosure and crash in tty layer
Product: [Other] Security Response Reporter: Adam Mariš <amaris>
Component: vulnerabilityAssignee: Red Hat Product Security <security-response-team>
Status: CLOSED WONTFIX QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: unspecifiedCC: aquini, arm-mgr, bhu, blc, carnil, dhoward, dominik.mierzejewski, fhrbata, iboverma, jkacur, joelsmith, jross, kernel-mgr, kstutsma, lgoncalv, matt, mcressma, mlangsdo, nmurray, osoukup, plougher, rt-maint, rvrbovsk, sardella, security-response-team, slawomir, slong, williams, wmealing
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
A use-after-free flaw was discovered in the Linux kernel's tty subsystem, which allows for the disclosure of uncontrolled memory location and possible kernel panic. The information leak is caused by a race condition when attempting to set and read the tty line discipline. A local attacker could use the TIOCSETD (via tty_set_ldisc) to switch to a new line discipline; a concurrent call to a TIOCGETD ioctl performing a read on a given tty could then access previously allocated memory. Up to 4 bytes could be leaked when querying the line discipline or the kernel could panic with a NULL-pointer dereference.
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-06-08 02:47:13 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: 1300224    
Bug Blocks: 1296261    
Attachments:
Description Flags
Proposed patch none

Description Adam Mariš 2016-01-06 17:51:46 UTC
A flaw was discovered in the linux kernel tty subsystem which allows for disclosure of uncontrolled memory location and possible kernel panic. The information leak is caused by a race condition when attempting to set and read the tty line discipline.  An attacker can use the TIOCSETD (via tty_set_ldisc ) to switch to a new line discipline, a concurrent call to with a TIOCGETD ioctl performs a read on a given tty may be able to access memory previously  allocated.  Up to 4 bytes may leaked when querying the line discipline.


The problematic code:

case TIOCGETD:
  return put_user(tty->ldisc->ops->num, (int __user *)p);

The flaw is triggered when ldisc's address is loaded before the new address is set and the access is performed after the old is freed, which results to crash due to the kernel accessing an invalid address. If an attacker prepares the kernel slab by setting up the ldisc struct at the correct offset they can effectively read 4 bytes from any kernel memory.

Invalid data at the ldisc address may also panic the machine if it is not pointing to valid mappable memory.

Upstream fix:
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=5c17c861a357e9458001f021a7afa7aab9937439

Original proposed fix:
https://bugzilla.redhat.com/attachment.cgi?id=1112221&action=diff

Comment 1 Adam Mariš 2016-01-06 17:54:08 UTC
Created attachment 1112221 [details]
Proposed patch

Comment 4 Andrej Nemec 2016-01-20 10:06:29 UTC
Created kernel tracking bugs for this issue:

Affects: fedora-all [bug 1300224]

Comment 5 Andrej Nemec 2016-01-20 10:08:00 UTC
This issue went public via this correspondence:

http://lkml.iu.edu/hypermail/linux/kernel/1511.3/03045.html

Comment 6 Fedora Update System 2016-02-01 02:21:29 UTC
kernel-4.3.4-300.fc23 has been pushed to the Fedora 23 stable repository. If problems still persist, please make note of it in this bug report.

Comment 7 Fedora Update System 2016-02-01 06:22:12 UTC
kernel-4.3.4-200.fc22 has been pushed to the Fedora 22 stable repository. If problems still persist, please make note of it in this bug report.

Comment 8 Wade Mealing 2016-02-16 04:46:19 UTC
Statement: 

This issue affects kernels in Red Hat Enterprise Linux 5, 6 and 7. 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/.